Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 } | 99 } |
| 100 | 100 |
| 101 void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior) | 101 void WindowProxy::disposeContext(GlobalDetachmentBehavior behavior) |
| 102 { | 102 { |
| 103 if (!isContextInitialized()) | 103 if (!isContextInitialized()) |
| 104 return; | 104 return; |
| 105 | 105 |
| 106 v8::HandleScope handleScope(m_isolate); | 106 v8::HandleScope handleScope(m_isolate); |
| 107 v8::Handle<v8::Context> context = m_scriptState->context(); | 107 v8::Handle<v8::Context> context = m_scriptState->context(); |
| 108 m_frame->loader().client()->willReleaseScriptContext(context, m_world->world Id()); | 108 m_frame->loader().client()->willReleaseScriptContext(context, m_world->world Id()); |
| 109 InspectorInstrumentation::willReleaseScriptContext(m_frame, m_scriptState.ge t()); | |
|
dcheng
2014/12/04 18:58:56
I'm changing WindowProxy to hold a Frame, not a Lo
eustas
2014/12/05 10:01:36
OK, but let's do it in separate patch.
| |
| 109 | 110 |
| 110 if (behavior == DetachGlobal) | 111 if (behavior == DetachGlobal) |
| 111 m_scriptState->detachGlobalObject(); | 112 m_scriptState->detachGlobalObject(); |
| 112 | 113 |
| 113 m_scriptState->disposePerContextData(); | 114 m_scriptState->disposePerContextData(); |
| 114 | 115 |
| 115 // It's likely that disposing the context has created a lot of | 116 // It's likely that disposing the context has created a lot of |
| 116 // garbage. Notify V8 about this so it'll have a chance of cleaning | 117 // garbage. Notify V8 about this so it'll have a chance of cleaning |
| 117 // it up when idle. | 118 // it up when idle. |
| 118 V8GCForContextDispose::instance().notifyContextDisposed(m_frame->isMainFrame ()); | 119 V8GCForContextDispose::instance().notifyContextDisposed(m_frame->isMainFrame ()); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 disposeContext(DoNotDetachGlobal); | 216 disposeContext(DoNotDetachGlobal); |
| 216 return false; | 217 return false; |
| 217 } | 218 } |
| 218 } | 219 } |
| 219 | 220 |
| 220 if (!installDOMWindow()) { | 221 if (!installDOMWindow()) { |
| 221 disposeContext(DoNotDetachGlobal); | 222 disposeContext(DoNotDetachGlobal); |
| 222 return false; | 223 return false; |
| 223 } | 224 } |
| 224 | 225 |
| 226 SecurityOrigin* origin = 0; | |
| 225 if (m_world->isMainWorld()) { | 227 if (m_world->isMainWorld()) { |
| 226 // ActivityLogger for main world is updated within updateDocument(). | 228 // ActivityLogger for main world is updated within updateDocument(). |
| 227 updateDocument(); | 229 updateDocument(); |
| 228 if (m_frame->document()) { | 230 if (m_frame->document()) { |
| 229 setSecurityToken(m_frame->document()->securityOrigin()); | 231 origin = m_frame->document()->securityOrigin(); |
| 232 setSecurityToken(origin); | |
|
dcheng
2014/12/04 18:58:55
Please note I've removed this call to setSecurityT
eustas
2014/12/05 10:01:36
I've updated this place.
setSecurityToken doesn't
| |
| 230 ContentSecurityPolicy* csp = m_frame->document()->contentSecurityPol icy(); | 233 ContentSecurityPolicy* csp = m_frame->document()->contentSecurityPol icy(); |
| 231 context->AllowCodeGenerationFromStrings(csp->allowEval(0, ContentSec urityPolicy::SuppressReport)); | 234 context->AllowCodeGenerationFromStrings(csp->allowEval(0, ContentSec urityPolicy::SuppressReport)); |
| 232 context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_isol ate, csp->evalDisabledErrorMessage())); | 235 context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_isol ate, csp->evalDisabledErrorMessage())); |
| 233 } | 236 } |
| 234 } else { | 237 } else { |
| 235 updateActivityLogger(); | 238 updateActivityLogger(); |
| 236 SecurityOrigin* origin = m_world->isolatedWorldSecurityOrigin(); | 239 origin = m_world->isolatedWorldSecurityOrigin(); |
| 237 setSecurityToken(origin); | 240 setSecurityToken(origin); |
| 238 if (origin && InspectorInstrumentation::hasFrontends()) { | |
| 239 InspectorInstrumentation::didCreateIsolatedContext(m_frame, m_script State.get(), origin); | |
| 240 } | |
| 241 } | 241 } |
| 242 if (origin) | |
| 243 InspectorInstrumentation::didCreateScriptContext(m_frame, m_scriptState. get(), origin, m_world->isMainWorld()); | |
| 242 m_frame->loader().client()->didCreateScriptContext(context, m_world->extensi onGroup(), m_world->worldId()); | 244 m_frame->loader().client()->didCreateScriptContext(context, m_world->extensi onGroup(), m_world->worldId()); |
| 243 return true; | 245 return true; |
| 244 } | 246 } |
| 245 | 247 |
| 246 void WindowProxy::createContext() | 248 void WindowProxy::createContext() |
| 247 { | 249 { |
| 248 // The documentLoader pointer could be 0 during frame shutdown. | 250 // The documentLoader pointer could be 0 during frame shutdown. |
| 249 // FIXME: Can we remove this check? | 251 // FIXME: Can we remove this check? |
| 250 if (!m_frame->loader().documentLoader()) | 252 if (!m_frame->loader().documentLoader()) |
| 251 return; | 253 return; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 | 490 |
| 489 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 491 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
| 490 { | 492 { |
| 491 ASSERT(m_world->isMainWorld()); | 493 ASSERT(m_world->isMainWorld()); |
| 492 if (!isContextInitialized()) | 494 if (!isContextInitialized()) |
| 493 return; | 495 return; |
| 494 setSecurityToken(origin); | 496 setSecurityToken(origin); |
| 495 } | 497 } |
| 496 | 498 |
| 497 } // namespace blink | 499 } // namespace blink |
| OLD | NEW |