annotate extension/modules/content-injector.js @ 4:1c02976d8809

Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
author Atul Varma <varmaa@toolness.com>
date Thu, 06 Aug 2009 17:18:45 -0700
parents 413435fc6202
children c01a64fefbf5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
1 var EXPORTED_SYMBOLS = ["init"];
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
3 const Cc = Components.classes;
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
4 const Ci = Components.interfaces;
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
5 const Cu = Components.utils;
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
6
3
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
7 const REQUEST_BOX_NAME = "powerbox_superpower_request";
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
8 const REQUEST_BOX_TEXT = "This web page wants superpowers.";
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
9 const REQUEST_BOX_BUTTON_TEXT = "Huh?";
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
10
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
11 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
12
3
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
13 function getParentChromeWindow(window) {
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
14 var mainWindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
15 .getInterface(Ci.nsIWebNavigation)
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
16 .QueryInterface(Ci.nsIDocShellTreeItem)
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
17 .rootTreeItem
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
18 .QueryInterface(Ci.nsIInterfaceRequestor)
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
19 .getInterface(Ci.nsIDOMWindow);
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
20 return mainWindow.wrappedJSObject;
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
21 }
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
22
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
23 function showRequestNotificationBox(window, caps, callback) {
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
24 var tabbrowser = getParentChromeWindow(window).getBrowser();
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
25 var browser = tabbrowser.getBrowserForDocument(window.document);
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
26
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
27 if (browser) {
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
28 var nBox = tabbrowser.getNotificationBox(browser);
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
29
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
30 var oldNotification = nBox.getNotificationWithValue(REQUEST_BOX_NAME);
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
31 if (oldNotification)
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
32 nBox.removeNotification(oldNotification);
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
33
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
34 nBox.appendNotification(REQUEST_BOX_TEXT,
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
35 REQUEST_BOX_NAME,
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
36 null,
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
37 nBox.PRIORITY_INFO_MEDIUM,
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
38 [{accessKey: null,
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
39 // TODO: Implement a real callback.
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
40 callback: function() {},
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
41 label: REQUEST_BOX_BUTTON_TEXT,
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
42 popup: null}]);
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
43 }
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
44 }
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
45
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
46 function buildRequestor(window) {
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
47 return function request(caps, callback) {
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
48 if (!(typeof(caps) == "object" ||
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
49 typeof(caps) == "string"))
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
50 throw new Error("Must provide capabilities as first parameter.");
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
51
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
52 if (typeof(callback) != "function")
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
53 throw new Error("Must provide callback as second parameter");
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
54
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
55 if (typeof(caps) == "object")
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
56 caps = new XPCSafeJSObjectWrapper(caps);
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
57 callback = new XPCSafeJSObjectWrapper(callback);
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
58
3
413435fc6202 We now show a notification box when a page calls window.powerbox.request().
Atul Varma <varmaa@toolness.com>
parents: 2
diff changeset
59 showRequestNotificationBox(window, caps, callback);
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
60 };
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
61 }
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
62
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
63 // Taken from Firebug's content/firebug/tabWatcher.js.
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
64 function safeGetName(request) {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
65 try {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
66 return request.name;
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
67 } catch (exc) {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
68 return null;
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
69 }
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
70 }
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
71
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
72 var listener = {
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
73 QueryInterface : XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
74 Ci.nsISupportsWeakReference]),
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
75
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
76 // Much of this is taken from Firebug's content/firebug/tabWatcher.js,
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
77 // specifically the FrameProgressListener object.
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
78 onStateChange : function (aWebProgress, aRequest,
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
79 aStateFlags, aStatus) {
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
80 if (aStateFlags & Ci.nsIWebProgressListener.STATE_IS_REQUEST &&
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
81 aStateFlags & Ci.nsIWebProgressListener.STATE_START) {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
82 // We need to get the hook in as soon as the new DOMWindow is
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
83 // created, but before it starts executing any scripts in the
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
84 // page. After lengthy analysis, it seems that the start of
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
85 // these "dummy" requests is the only state that works.
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
86
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
87 // TODO: Firebug's code mentions that XHTML doesn't dispatch
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
88 // any of these dummy requests, so we should probably use the
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
89 // Firebug's XHTML workaround here.
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
90 var safeName = safeGetName(aRequest);
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
91 var window = aWebProgress.DOMWindow;
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
92 if (window && window.wrappedJSObject &&
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
93 (safeName == "about:layout-dummy-request" ||
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
94 safeName == "about:document-onload-blocker")) {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
95 // TODO: Firebug's code mentions that about:blank causes strange
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
96 // behavior here; I don't think it should apply to our use case,
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
97 // though.
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
98 var sandbox = Cu.Sandbox(window);
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
99 sandbox.importFunction(buildRequestor(window));
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
100 sandbox.window = window.wrappedJSObject;
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
101
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
102 function setupPowerbox() {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
103 window.powerbox = {request: request};
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
104 }
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
105
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
106 Cu.evalInSandbox("(" + setupPowerbox.toString() + ")();", sandbox);
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
107 }
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
108 }
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
109 },
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
110
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
111 // Stubs for the nsIWebProgressListener interfaces which we don't use.
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
112 onProgressChange : function() { },
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
113 onLocationChange : function() { },
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
114 onStatusChange : function() { },
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
115 onSecurityChange : function() { }
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
116 };
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
117
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
118 function init(window) {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
119 var tabbrowser = window.getBrowser();
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
120
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
121 function addListener(browser) {
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
122 browser.addProgressListener(listener,
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
123 Ci.nsIWebProgress.NOTIFY_STATE_DOCUMENT);
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
124 }
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
125
4
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
126 tabbrowser.tabContainer.addEventListener(
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
127 "TabOpen",
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
128 function onTabOpen(event) { addListener(event.target.linkedBrowser); },
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
129 false
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
130 );
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
131
1c02976d8809 Changed to Firebug's progress listener, which allows us to inject our code before any scripts are executed on target pages.
Atul Varma <varmaa@toolness.com>
parents: 3
diff changeset
132 tabbrowser.browsers.forEach(function(browser) { addListener(browser); });
2
889c2fd4c9cf window.powerbox.request() is now available on every content window.
Atul Varma <varmaa@toolness.com>
parents:
diff changeset
133 }