| OLD | NEW |
| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "bindings/core/v8/V8PrivateProperty.h" | 42 #include "bindings/core/v8/V8PrivateProperty.h" |
| 43 #include "bindings/core/v8/V8Window.h" | 43 #include "bindings/core/v8/V8Window.h" |
| 44 #include "core/dom/Modulator.h" | 44 #include "core/dom/Modulator.h" |
| 45 #include "core/frame/LocalFrame.h" | 45 #include "core/frame/LocalFrame.h" |
| 46 #include "core/frame/csp/ContentSecurityPolicy.h" | 46 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 47 #include "core/html/DocumentNameCollection.h" | 47 #include "core/html/DocumentNameCollection.h" |
| 48 #include "core/html/HTMLIFrameElement.h" | 48 #include "core/html/HTMLIFrameElement.h" |
| 49 #include "core/inspector/MainThreadDebugger.h" | 49 #include "core/inspector/MainThreadDebugger.h" |
| 50 #include "core/loader/FrameLoader.h" | 50 #include "core/loader/FrameLoader.h" |
| 51 #include "core/loader/FrameLoaderClient.h" | 51 #include "core/loader/FrameLoaderClient.h" |
| 52 #include "core/mojo/Mojo.h" |
| 52 #include "core/origin_trials/OriginTrialContext.h" | 53 #include "core/origin_trials/OriginTrialContext.h" |
| 53 #include "platform/Histogram.h" | 54 #include "platform/Histogram.h" |
| 54 #include "platform/RuntimeEnabledFeatures.h" | 55 #include "platform/RuntimeEnabledFeatures.h" |
| 55 #include "platform/ScriptForbiddenScope.h" | 56 #include "platform/ScriptForbiddenScope.h" |
| 56 #include "platform/heap/Handle.h" | 57 #include "platform/heap/Handle.h" |
| 57 #include "platform/instrumentation/tracing/TraceEvent.h" | 58 #include "platform/instrumentation/tracing/TraceEvent.h" |
| 58 #include "platform/weborigin/SecurityOrigin.h" | 59 #include "platform/weborigin/SecurityOrigin.h" |
| 59 #include "wtf/Assertions.h" | 60 #include "wtf/Assertions.h" |
| 60 #include <v8.h> | 61 #include <v8.h> |
| 61 | 62 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } else { | 114 } else { |
| 114 updateActivityLogger(); | 115 updateActivityLogger(); |
| 115 origin = m_world->isolatedWorldSecurityOrigin(); | 116 origin = m_world->isolatedWorldSecurityOrigin(); |
| 116 setSecurityToken(origin); | 117 setSecurityToken(origin); |
| 117 } | 118 } |
| 118 | 119 |
| 119 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), frame(), | 120 MainThreadDebugger::instance()->contextCreated(m_scriptState.get(), frame(), |
| 120 origin); | 121 origin); |
| 121 frame()->loader().client()->didCreateScriptContext(context, | 122 frame()->loader().client()->didCreateScriptContext(context, |
| 122 m_world->worldId()); | 123 m_world->worldId()); |
| 123 // If conditional features for window have been queued before the V8 context | 124 |
| 124 // was ready, then inject them into the context now | |
| 125 if (m_world->isMainWorld()) { | 125 if (m_world->isMainWorld()) { |
| 126 if (RuntimeEnabledFeatures::mojoJSEnabled()) { |
| 127 LOG(INFO) << "Installing mojo bindings"; |
| 128 v8::Local<v8::Object> global = context->Global(); |
| 129 v8::Local<v8::Value> mojo = ToV8(Mojo::create(), global, isolate()); |
| 130 global->Set(context, v8AtomicString(isolate(), "mojo"), mojo).ToChecked(); |
| 131 } |
| 132 |
| 133 // If conditional features for window have been queued before the V8 context |
| 134 // was ready, then inject them into the context now |
| 126 installPendingConditionalFeaturesOnWindow(m_scriptState.get()); | 135 installPendingConditionalFeaturesOnWindow(m_scriptState.get()); |
| 136 |
| 137 frame()->loader().dispatchDidClearWindowObjectInMainWorld(); |
| 127 } | 138 } |
| 128 | |
| 129 if (m_world->isMainWorld()) | |
| 130 frame()->loader().dispatchDidClearWindowObjectInMainWorld(); | |
| 131 } | 139 } |
| 132 | 140 |
| 133 void LocalWindowProxy::createContext() { | 141 void LocalWindowProxy::createContext() { |
| 134 // Create a new v8::Context with the window object as the global object | 142 // Create a new v8::Context with the window object as the global object |
| 135 // (aka the inner global). Reuse the global proxy object (aka the outer | 143 // (aka the inner global). Reuse the global proxy object (aka the outer |
| 136 // global) if it already exists. See the comments in | 144 // global) if it already exists. See the comments in |
| 137 // setupWindowPrototypeChain for the structure of the prototype chain of | 145 // setupWindowPrototypeChain for the structure of the prototype chain of |
| 138 // the global object. | 146 // the global object. |
| 139 v8::Local<v8::ObjectTemplate> globalTemplate = | 147 v8::Local<v8::ObjectTemplate> globalTemplate = |
| 140 V8Window::domTemplate(isolate(), *m_world)->InstanceTemplate(); | 148 V8Window::domTemplate(isolate(), *m_world)->InstanceTemplate(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 362 |
| 355 setSecurityToken(origin); | 363 setSecurityToken(origin); |
| 356 } | 364 } |
| 357 | 365 |
| 358 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, | 366 LocalWindowProxy::LocalWindowProxy(v8::Isolate* isolate, |
| 359 LocalFrame& frame, | 367 LocalFrame& frame, |
| 360 RefPtr<DOMWrapperWorld> world) | 368 RefPtr<DOMWrapperWorld> world) |
| 361 : WindowProxy(isolate, frame, std::move(world)) {} | 369 : WindowProxy(isolate, frame, std::move(world)) {} |
| 362 | 370 |
| 363 } // namespace blink | 371 } // namespace blink |
| OLD | NEW |