summaryrefslogtreecommitdiffstats
path: root/ceee
diff options
context:
space:
mode:
authorericdingle@chromium.org <ericdingle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-22 21:45:21 +0000
committerericdingle@chromium.org <ericdingle@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-22 21:45:21 +0000
commit8eca9e1bcd0deef370fde0e7432deb06f12e5c0c (patch)
treebea31d999141e9eae52d571d1f819f5ed64199c2 /ceee
parent67d9e6801ab1201732fc2a1d13e95a2f330cc0f3 (diff)
downloadchromium_src-8eca9e1bcd0deef370fde0e7432deb06f12e5c0c.zip
chromium_src-8eca9e1bcd0deef370fde0e7432deb06f12e5c0c.tar.gz
chromium_src-8eca9e1bcd0deef370fde0e7432deb06f12e5c0c.tar.bz2
IE CEEE: Revert content script injection back to no isolation mode.
BUG=none TEST=none Review URL: http://codereview.chromium.org/5267001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67006 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee')
-rw-r--r--ceee/ie/plugin/scripting/ceee_bootstrap.js70
-rw-r--r--ceee/ie/plugin/scripting/content_script_manager.cc5
-rw-r--r--ceee/ie/plugin/scripting/content_script_manager_unittest.cc8
3 files changed, 3 insertions, 80 deletions
diff --git a/ceee/ie/plugin/scripting/ceee_bootstrap.js b/ceee/ie/plugin/scripting/ceee_bootstrap.js
index 1eb624a..249a031 100644
--- a/ceee/ie/plugin/scripting/ceee_bootstrap.js
+++ b/ceee/ie/plugin/scripting/ceee_bootstrap.js
@@ -113,76 +113,6 @@ ceee.endInit_ = function (nativenativeContentScriptApi, extensionId) {
delete ceee;
};
-ceee.initGlobals_ = function() {
- // 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 and to the 'safe' window object. We purposely skip
- // all event handler attributes (e.g. onclick).
-
- // Browsing context.
- 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 = unsafeWindow.frames;
- length = unsafeWindow.length;
- top = unsafeWindow.top;
- opener = unsafeWindow.opener;
- parent = unsafeWindow.parent;
- try {
- // IE will throw an Access Denied error if the parent browsing context does
- // not have the same effective script origin as the entry script. See:
- // http://www.w3.org/TR/html5/browsers.html#dom-frameelement
- // TODO(ericdingle@chromium.org): See if we can wrap this attribute with a
- // getter so that we can mimic IE's behavior when it is accessed.
- frameElement = unsafeWindow.frameElement;
- } catch (e) {}
- open = unsafeWindow.open;
-
- // User agent.
- navigator = unsafeWindow.navigator;
- applicationCache = unsafeWindow.applicationCache;
-
- // User prompts.
- alert = unsafeWindow.alert;
- confirm = unsafeWindow.confirm;
- prompt = unsafeWindow.prompt;
- print = unsafeWindow.print;
- showModalDialog = unsafeWindow.showModalDialog;
-
- // EventTarget interface.
- addEventListener = unsafeWindow.addEventListener;
- removeEventListener = unsafeWindow.removeEventListener;
- dispatchEvent = unsafeWindow.dispatchEvent;
-
- // Old IE event model.
- attachEvent = unsafeWindow.attachEvent;
- detachEvent = unsafeWindow.detachEvent;
-};
-
console.log = console.log || function (msg) {
if (nativeContentScriptApi)
nativeContentScriptApi.Log("info", msg);
diff --git a/ceee/ie/plugin/scripting/content_script_manager.cc b/ceee/ie/plugin/scripting/content_script_manager.cc
index 7dd8955..dfc450e 100644
--- a/ceee/ie/plugin/scripting/content_script_manager.cc
+++ b/ceee/ie/plugin/scripting/content_script_manager.cc
@@ -181,10 +181,7 @@ HRESULT ContentScriptManager::InitializeScriptHost(
hr = document->get_parentWindow(&window);
if (FAILED(hr))
return hr;
- hr = script_host->RegisterScriptObject(L"unsafeWindow", window, false);
- if (FAILED(hr))
- return hr;
- hr = InvokeNamedFunction(script_host, L"ceee.initGlobals_", NULL, 0);
+ hr = script_host->RegisterScriptObject(L"window", window, true);
return hr;
}
diff --git a/ceee/ie/plugin/scripting/content_script_manager_unittest.cc b/ceee/ie/plugin/scripting/content_script_manager_unittest.cc
index 338cc0e..8ab9602 100644
--- a/ceee/ie/plugin/scripting/content_script_manager_unittest.cc
+++ b/ceee/ie/plugin/scripting/content_script_manager_unittest.cc
@@ -243,17 +243,13 @@ class ContentScriptManagerTest: public testing::Test {
// Register the window object and initialize its globals.
EXPECT_CALL(*script_host_,
- RegisterScriptObject(StrEq(L"unsafeWindow"), _, false))
+ RegisterScriptObject(StrEq(L"window"), _, true))
.WillOnce(Return(S_OK));
- EXPECT_CALL(*script_host_, RunExpression(StrEq(L"ceee.initGlobals_"), _))
- .WillOnce(DoAll(
- CopyVariantToArgument<1>(CComVariant(function_keeper_)),
- Return(S_OK)));
// And expect three invocations.
// TODO(siggi@chromium.org): be more specific?
EXPECT_CALL(*function_, Invoke(_, _, _, _, _, _, _, _))
- .Times(3).WillRepeatedly(Return(S_OK));
+ .Times(2).WillRepeatedly(Return(S_OK));
}
void ExpectCreateScriptHost(TestingContentScriptManager* manager) {