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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptController.cpp

Issue 2613893002: Remove an isContextInitialized() check from ScriptController::windowProxy() (Closed)
Patch Set: temp Created 3 years, 11 months 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are 7 * modification, are permitted provided that the following conditions are
8 * met: 8 * met:
9 * 9 *
10 * * Redistributions of source code must retain the above copyright 10 * * Redistributions of source code must retain the above copyright
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 211
212 bool ScriptController::initializeMainWorld() { 212 bool ScriptController::initializeMainWorld() {
213 if (m_windowProxyManager->mainWorldProxy()->isContextInitialized()) 213 if (m_windowProxyManager->mainWorldProxy()->isContextInitialized())
214 return false; 214 return false;
215 return windowProxy(DOMWrapperWorld::mainWorld())->isContextInitialized(); 215 return windowProxy(DOMWrapperWorld::mainWorld())->isContextInitialized();
216 } 216 }
217 217
218 WindowProxy* ScriptController::windowProxy(DOMWrapperWorld& world) { 218 WindowProxy* ScriptController::windowProxy(DOMWrapperWorld& world) {
219 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world); 219 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world);
220 if (!windowProxy->isContextInitialized()) { 220 windowProxy->initializeIfNeeded();
221 windowProxy->initializeIfNeeded();
222 if (world.isMainWorld())
223 frame()->loader().dispatchDidClearWindowObjectInMainWorld();
224 }
225 return windowProxy; 221 return windowProxy;
226 } 222 }
227 223
228 bool ScriptController::shouldBypassMainWorldCSP() { 224 bool ScriptController::shouldBypassMainWorldCSP() {
229 v8::HandleScope handleScope(isolate()); 225 v8::HandleScope handleScope(isolate());
230 v8::Local<v8::Context> context = isolate()->GetCurrentContext(); 226 v8::Local<v8::Context> context = isolate()->GetCurrentContext();
231 if (context.IsEmpty() || !toDOMWindow(context)) 227 if (context.IsEmpty() || !toDOMWindow(context))
232 return false; 228 return false;
233 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate()); 229 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate());
234 return world.isIsolatedWorld() ? world.isolatedWorldHasContentSecurityPolicy() 230 return world.isIsolatedWorld() ? world.isolatedWorldHasContentSecurityPolicy()
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 for (size_t i = 0; i < resultArray->Length(); ++i) { 485 for (size_t i = 0; i < resultArray->Length(); ++i) {
490 v8::Local<v8::Value> value; 486 v8::Local<v8::Value> value;
491 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 487 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
492 return; 488 return;
493 results->push_back(value); 489 results->push_back(value);
494 } 490 }
495 } 491 }
496 } 492 }
497 493
498 } // namespace blink 494 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/core/v8/WindowProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698