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

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

Issue 2601773002: WindowProxy::initialize should never return null (Closed)
Patch Set: temp Created 3 years, 12 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
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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::existingWindowProxy(DOMWrapperWorld& world) { 218 WindowProxy* ScriptController::existingWindowProxy(DOMWrapperWorld& world) {
219 return m_windowProxyManager->existingWindowProxy(world); 219 return m_windowProxyManager->existingWindowProxy(world);
220 } 220 }
221 221
222 WindowProxy* ScriptController::windowProxy(DOMWrapperWorld& world) { 222 WindowProxy* ScriptController::windowProxy(DOMWrapperWorld& world) {
223 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world); 223 WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world);
224 if (!windowProxy->isContextInitialized() && 224 if (!windowProxy->isContextInitialized()) {
225 windowProxy->initializeIfNeeded() && world.isMainWorld()) 225 windowProxy->initializeIfNeeded();
226 frame()->loader().dispatchDidClearWindowObjectInMainWorld(); 226 if (world.isMainWorld())
227 // FIXME: There are some situations where we can return an uninitialized 227 frame()->loader().dispatchDidClearWindowObjectInMainWorld();
228 // context. This is broken. 228 }
229 return windowProxy; 229 return windowProxy;
230 } 230 }
231 231
232 bool ScriptController::shouldBypassMainWorldCSP() { 232 bool ScriptController::shouldBypassMainWorldCSP() {
233 v8::HandleScope handleScope(isolate()); 233 v8::HandleScope handleScope(isolate());
234 v8::Local<v8::Context> context = isolate()->GetCurrentContext(); 234 v8::Local<v8::Context> context = isolate()->GetCurrentContext();
235 if (context.IsEmpty() || !toDOMWindow(context)) 235 if (context.IsEmpty() || !toDOMWindow(context))
236 return false; 236 return false;
237 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate()); 237 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate());
238 return world.isIsolatedWorld() ? world.isolatedWorldHasContentSecurityPolicy() 238 return world.isIsolatedWorld() ? world.isolatedWorldHasContentSecurityPolicy()
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 for (size_t i = 0; i < resultArray->Length(); ++i) { 494 for (size_t i = 0; i < resultArray->Length(); ++i) {
495 v8::Local<v8::Value> value; 495 v8::Local<v8::Value> value;
496 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value)) 496 if (!resultArray->Get(scriptState->context(), i).ToLocal(&value))
497 return; 497 return;
498 results->push_back(value); 498 results->push_back(value);
499 } 499 }
500 } 500 }
501 } 501 }
502 502
503 } // namespace blink 503 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698