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

Side by Side Diff: ceee/ie/plugin/scripting/content_script_manager.cc

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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // @file 5 // @file
6 // Content script manager implementation. 6 // Content script manager implementation.
7 #include "ceee/ie/plugin/scripting/content_script_manager.h" 7 #include "ceee/ie/plugin/scripting/content_script_manager.h"
8 8
9 #include "ceee/ie/common/ceee_module_util.h" 9 #include "ceee/ie/common/ceee_module_util.h"
10 #include "ceee/ie/plugin/bho/dom_utils.h" 10 #include "ceee/ie/plugin/bho/dom_utils.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 std::wstring extension_id; 167 std::wstring extension_id;
168 host_->GetExtensionId(&extension_id); 168 host_->GetExtensionId(&extension_id);
169 DCHECK(extension_id.size()) << 169 DCHECK(extension_id.size()) <<
170 "Need to revisit async loading of enabled extension list."; 170 "Need to revisit async loading of enabled extension list.";
171 171
172 // Execute the bootstrap scripts. 172 // Execute the bootstrap scripts.
173 hr = BootstrapScriptHost(script_host, native_api_, extension_id.c_str()); 173 hr = BootstrapScriptHost(script_host, native_api_, extension_id.c_str());
174 if (FAILED(hr)) 174 if (FAILED(hr))
175 return hr; 175 return hr;
176 176
177 // Register the window object and manually make its members global. 177 // Register the window object and initialize the global namespace of the
178 // script host.
178 CComPtr<IHTMLWindow2> window; 179 CComPtr<IHTMLWindow2> window;
179 hr = document->get_parentWindow(&window); 180 hr = document->get_parentWindow(&window);
180 if (FAILED(hr)) 181 if (FAILED(hr))
181 return hr; 182 return hr;
182 hr = script_host->RegisterScriptObject(L"window", window, false); 183 hr = script_host->RegisterScriptObject(L"unsafeWindow", window, false);
183 if (FAILED(hr)) 184 if (FAILED(hr))
184 return hr; 185 return hr;
185 hr = InvokeNamedFunction(script_host, L"ceee.initGlobals_", NULL, 0); 186 hr = InvokeNamedFunction(script_host, L"ceee.initGlobals_", NULL, 0);
186 187
187 return hr; 188 return hr;
188 } 189 }
189 190
190 HRESULT ContentScriptManager::BootstrapScriptHost(IScriptHost* script_host, 191 HRESULT ContentScriptManager::BootstrapScriptHost(IScriptHost* script_host,
191 IDispatch* native_api, 192 IDispatch* native_api,
192 const wchar_t* extension_id) { 193 const wchar_t* extension_id) {
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 hr = script_host_with_site->SetSite(NULL); 382 hr = script_host_with_site->SetSite(NULL);
382 DCHECK(SUCCEEDED(hr)); 383 DCHECK(SUCCEEDED(hr));
383 } 384 }
384 385
385 // TODO(siggi@chromium.org): Kill off open extension ports. 386 // TODO(siggi@chromium.org): Kill off open extension ports.
386 387
387 script_host_.Release(); 388 script_host_.Release();
388 389
389 return hr; 390 return hr;
390 } 391 }
OLDNEW
« no previous file with comments | « ceee/ie/plugin/scripting/ceee_bootstrap.js ('k') | ceee/ie/plugin/scripting/content_script_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698