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

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

Issue 2458183002: Eagerly install Origin Trial features on window (Closed)
Patch Set: Rebase before commit Created 4 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009, 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 12 matching lines...) Expand all
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "bindings/core/v8/WindowProxy.h" 31 #include "bindings/core/v8/WindowProxy.h"
32 32
33 #include "bindings/core/v8/ConditionalFeatures.h"
33 #include "bindings/core/v8/DOMWrapperWorld.h" 34 #include "bindings/core/v8/DOMWrapperWorld.h"
34 #include "bindings/core/v8/ScriptController.h" 35 #include "bindings/core/v8/ScriptController.h"
35 #include "bindings/core/v8/V8Binding.h" 36 #include "bindings/core/v8/V8Binding.h"
36 #include "bindings/core/v8/V8DOMActivityLogger.h" 37 #include "bindings/core/v8/V8DOMActivityLogger.h"
37 #include "bindings/core/v8/V8Document.h" 38 #include "bindings/core/v8/V8Document.h"
38 #include "bindings/core/v8/V8GCForContextDispose.h" 39 #include "bindings/core/v8/V8GCForContextDispose.h"
39 #include "bindings/core/v8/V8HTMLCollection.h" 40 #include "bindings/core/v8/V8HTMLCollection.h"
40 #include "bindings/core/v8/V8HTMLDocument.h" 41 #include "bindings/core/v8/V8HTMLDocument.h"
41 #include "bindings/core/v8/V8HiddenValue.h" 42 #include "bindings/core/v8/V8HiddenValue.h"
42 #include "bindings/core/v8/V8Initializer.h" 43 #include "bindings/core/v8/V8Initializer.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 context->AllowCodeGenerationFromStrings( 260 context->AllowCodeGenerationFromStrings(
260 csp->allowEval(0, ContentSecurityPolicy::SuppressReport)); 261 csp->allowEval(0, ContentSecurityPolicy::SuppressReport));
261 context->SetErrorMessageForCodeGenerationFromStrings( 262 context->SetErrorMessageForCodeGenerationFromStrings(
262 v8String(m_isolate, csp->evalDisabledErrorMessage())); 263 v8String(m_isolate, csp->evalDisabledErrorMessage()));
263 } else { 264 } else {
264 updateActivityLogger(); 265 updateActivityLogger();
265 origin = m_world->isolatedWorldSecurityOrigin(); 266 origin = m_world->isolatedWorldSecurityOrigin();
266 setSecurityToken(origin); 267 setSecurityToken(origin);
267 } 268 }
268 269
269 // All interfaces must be registered to V8PerContextData.
270 // So we explicitly call constructorForType for the global object.
271 V8PerContextData::from(context)->constructorForType(
272 &V8Window::wrapperTypeInfo);
273
274 if (m_frame->isLocalFrame()) { 270 if (m_frame->isLocalFrame()) {
275 LocalFrame* frame = toLocalFrame(m_frame); 271 LocalFrame* frame = toLocalFrame(m_frame);
276 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), frame, 272 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), frame,
277 origin); 273 origin);
278 frame->loader().client()->didCreateScriptContext( 274 frame->loader().client()->didCreateScriptContext(
279 context, m_world->extensionGroup(), m_world->worldId()); 275 context, m_world->extensionGroup(), m_world->worldId());
280 } 276 }
277 // If conditional features for window have been queued before the V8 context
278 // was ready, then inject them into the context now
279 if (m_world->isMainWorld()) {
280 installPendingConditionalFeaturesOnWindow(m_scriptState.get());
281 }
282
281 return true; 283 return true;
282 } 284 }
283 285
284 void WindowProxy::createContext() { 286 void WindowProxy::createContext() {
285 // FIXME: This should be a null check of m_frame->client(), but there are 287 // FIXME: This should be a null check of m_frame->client(), but there are
286 // still some edge cases 288 // still some edge cases
287 // that this fails to catch during frame detach. 289 // that this fails to catch during frame detach.
288 if (m_frame->isLocalFrame() && 290 if (m_frame->isLocalFrame() &&
289 !toLocalFrame(m_frame)->loader().documentLoader()) 291 !toLocalFrame(m_frame)->loader().documentLoader())
290 return; 292 return;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 v8String(m_isolate, name)); 582 v8String(m_isolate, name));
581 } 583 }
582 584
583 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { 585 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) {
584 if (!isContextInitialized()) 586 if (!isContextInitialized())
585 return; 587 return;
586 setSecurityToken(origin); 588 setSecurityToken(origin);
587 } 589 }
588 590
589 } // namespace blink 591 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698