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

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

Issue 2473413002: Eagerly install Origin Trial features on window. (Closed)
Patch Set: 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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 context->AllowCodeGenerationFromStrings( 258 context->AllowCodeGenerationFromStrings(
258 csp->allowEval(0, ContentSecurityPolicy::SuppressReport)); 259 csp->allowEval(0, ContentSecurityPolicy::SuppressReport));
259 context->SetErrorMessageForCodeGenerationFromStrings( 260 context->SetErrorMessageForCodeGenerationFromStrings(
260 v8String(m_isolate, csp->evalDisabledErrorMessage())); 261 v8String(m_isolate, csp->evalDisabledErrorMessage()));
261 } else { 262 } else {
262 updateActivityLogger(); 263 updateActivityLogger();
263 origin = m_world->isolatedWorldSecurityOrigin(); 264 origin = m_world->isolatedWorldSecurityOrigin();
264 setSecurityToken(origin); 265 setSecurityToken(origin);
265 } 266 }
266 267
267 // All interfaces must be registered to V8PerContextData.
268 // So we explicitly call constructorForType for the global object.
269 V8PerContextData::from(context)->constructorForType(
270 &V8Window::wrapperTypeInfo);
271
272 if (m_frame->isLocalFrame()) { 268 if (m_frame->isLocalFrame()) {
273 LocalFrame* frame = toLocalFrame(m_frame); 269 LocalFrame* frame = toLocalFrame(m_frame);
274 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), frame, 270 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), frame,
275 origin); 271 origin);
276 frame->loader().client()->didCreateScriptContext( 272 frame->loader().client()->didCreateScriptContext(
277 context, m_world->extensionGroup(), m_world->worldId()); 273 context, m_world->extensionGroup(), m_world->worldId());
278 } 274 }
275 // If conditional features for window have been queued before the V8 context
276 // was ready, then inject them into the context now
277 if (m_world->isMainWorld()) {
278 installPendingConditionalFeaturesOnWindow(m_scriptState.get());
279 }
280
279 return true; 281 return true;
280 } 282 }
281 283
282 void WindowProxy::createContext() { 284 void WindowProxy::createContext() {
283 // FIXME: This should be a null check of m_frame->client(), but there are 285 // FIXME: This should be a null check of m_frame->client(), but there are
284 // still some edge cases 286 // still some edge cases
285 // that this fails to catch during frame detach. 287 // that this fails to catch during frame detach.
286 if (m_frame->isLocalFrame() && 288 if (m_frame->isLocalFrame() &&
287 !toLocalFrame(m_frame)->loader().documentLoader()) 289 !toLocalFrame(m_frame)->loader().documentLoader())
288 return; 290 return;
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 v8String(m_isolate, name)); 579 v8String(m_isolate, name));
578 } 580 }
579 581
580 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { 582 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) {
581 if (!isContextInitialized()) 583 if (!isContextInitialized())
582 return; 584 return;
583 setSecurityToken(origin); 585 setSecurityToken(origin);
584 } 586 }
585 587
586 } // namespace blink 588 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698