No assert
[mirrors/Programs.git] / plugins / chrome-extensions / editor / content_script.js
1 var reload = function(responseHandler) {
2 window.location.href = window.location.href;
3 responseHandler(null);
4 };
5 var execute = function(code, responseHandler) {
6 var exception = null;
7 try {
8 eval(code);
9 } catch (exc) {
10 // there was a circular reference in jQueries exceptions that
11 // sendResponse didn't like
12 exception = {name: exc.name, message: exc.message};
13 }
14 responseHandler(exception);
15 };
16
17 chrome.extension.onRequest.addListener(
18 function(data, sender, responseHandler) {
19 if (data.reload) {
20 reload(responseHandler);
21 } else if (data.code) {
22 execute(data.code, responseHandler);
23 } else {
24 responseHandler({name: "InvalidArgumentException",
25 message: "Argument to content script not understood."});
26 }
27 });
This page took 0.460238 seconds and 4 git commands to generate.