Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3692)

Unified Diff: ceee/ie/plugin/scripting/ceee_bootstrap.js

Issue 5133002: IE CEEE: Add another layer of isolation to content scripts execution through ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ceee/ie/plugin/scripting/content_script_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ceee/ie/plugin/scripting/ceee_bootstrap.js
===================================================================
--- ceee/ie/plugin/scripting/ceee_bootstrap.js (revision 66423)
+++ ceee/ie/plugin/scripting/ceee_bootstrap.js (working copy)
@@ -114,56 +114,66 @@
};
ceee.initGlobals_ = function() {
- // We expose a subset of the Window interface defined at
+ // The window object of the page is exposed in its entirety to the script
+ // host via the 'unsafeWindow' variable similar to how greasemonkey scripts
+ // implement access to it. We expose a 'safe' window object as 'window' that
+ // only has access to a subset of the actual window's native properties.
+
+ // Create the window variable and assign it to 'this' which is the context
+ // of the global scope. Doing this will make variables defined in the global
+ // scope or defined as properties of window be one and the same.
+ window = this;
+
+ // Now expose a subset of the Window interface defined at
// http://www.w3.org/TR/html5/browsers.html#the-window-object
- // to the global namespace. We purposely skip all event handler
- // attributes (e.g. onclick).
+ // to the global namespace and to the 'safe' window object. We purposely skip
+ // all event handler attributes (e.g. onclick).
// Browsing context.
- self = window.self;
- document = window.document;
- name = window.name;
- location = window.location;
- history = window.history;
- undoManager = window.undoManager;
- locationbar = window.locationbar;
- menubar = window.menubar;
- scrollbars = window.scrollbars;
- statusbar = window.statusbar;
- toolbar = window.toolbar;
- close = window.close;
- stop = window.stop;
- focus = window.focus;
- blur = window.blur;
+ self = unsafeWindow.self;
+ document = unsafeWindow.document;
+ name = unsafeWindow.name;
+ location = unsafeWindow.location;
+ history = unsafeWindow.history;
+ undoManager = unsafeWindow.undoManager;
+ locationbar = unsafeWindow.locationbar;
+ menubar = unsafeWindow.menubar;
+ scrollbars = unsafeWindow.scrollbars;
+ statusbar = unsafeWindow.statusbar;
+ toolbar = unsafeWindow.toolbar;
+ close = unsafeWindow.close;
+ stop = unsafeWindow.stop;
+ focus = unsafeWindow.focus;
+ blur = unsafeWindow.blur;
// Other browsing contexts.
- frames = window.frames;
- length = window.length;
- top = window.top;
- opener = window.opener;
- parent = window.parent;
- frameElement = window.frameElement;
- open = window.open;
+ frames = unsafeWindow.frames;
+ length = unsafeWindow.length;
+ top = unsafeWindow.top;
+ opener = unsafeWindow.opener;
+ parent = unsafeWindow.parent;
+ frameElement = unsafeWindow.frameElement;
+ open = unsafeWindow.open;
// User agent.
- navigator = window.navigator;
- applicationCache = window.applicationCache;
+ navigator = unsafeWindow.navigator;
+ applicationCache = unsafeWindow.applicationCache;
// User prompts.
- alert = window.alert;
- confirm = window.confirm;
- prompt = window.prompt;
- print = window.print;
- showModalDialog = window.showModalDialog;
+ alert = unsafeWindow.alert;
+ confirm = unsafeWindow.confirm;
+ prompt = unsafeWindow.prompt;
+ print = unsafeWindow.print;
+ showModalDialog = unsafeWindow.showModalDialog;
// EventTarget interface.
- addEventListener = window.addEventListener;
- removeEventListener = window.removeEventListener;
- dispatchEvent = window.dispatchEvent;
+ addEventListener = unsafeWindow.addEventListener;
+ removeEventListener = unsafeWindow.removeEventListener;
+ dispatchEvent = unsafeWindow.dispatchEvent;
// Old IE event model.
- attachEvent = window.attachEvent;
- detachEvent = window.detachEvent;
+ attachEvent = unsafeWindow.attachEvent;
+ detachEvent = unsafeWindow.detachEvent;
};
console.log = console.log || function (msg) {
« no previous file with comments | « no previous file | ceee/ie/plugin/scripting/content_script_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698