| 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()); |
| 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 ASSERT(m_frame->document()); | 228 ASSERT(m_frame->document()); |
| 227 | 229 |
| 228 // ActivityLogger for main world is updated within updateDocument(). | 230 // ActivityLogger for main world is updated within updateDocument(). |
| 229 updateDocument(); | 231 updateDocument(); |
| 232 origin = m_frame->securityContext()->securityOrigin(); |
| 230 ContentSecurityPolicy* csp = m_frame->document()->contentSecurityPolicy(
); | 233 ContentSecurityPolicy* csp = m_frame->document()->contentSecurityPolicy(
); |
| 231 context->AllowCodeGenerationFromStrings(csp->allowEval(0, ContentSecurit
yPolicy::SuppressReport)); | 234 context->AllowCodeGenerationFromStrings(csp->allowEval(0, ContentSecurit
yPolicy::SuppressReport)); |
| 232 context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_isolate,
csp->evalDisabledErrorMessage())); | 235 context->SetErrorMessageForCodeGenerationFromStrings(v8String(m_isolate,
csp->evalDisabledErrorMessage())); |
| 233 } else { | 236 } else { |
| 234 updateActivityLogger(); | 237 updateActivityLogger(); |
| 235 SecurityOrigin* origin = m_world->isolatedWorldSecurityOrigin(); | 238 origin = m_world->isolatedWorldSecurityOrigin(); |
| 236 setSecurityToken(origin); | 239 setSecurityToken(origin); |
| 237 InspectorInstrumentation::didCreateIsolatedContext(m_frame, m_scriptStat
e.get(), origin); | |
| 238 } | 240 } |
| 241 InspectorInstrumentation::didCreateScriptContext(m_frame, m_scriptState.get(
), origin, m_world->isMainWorld()); |
| 239 m_frame->loader().client()->didCreateScriptContext(context, m_world->extensi
onGroup(), m_world->worldId()); | 242 m_frame->loader().client()->didCreateScriptContext(context, m_world->extensi
onGroup(), m_world->worldId()); |
| 240 return true; | 243 return true; |
| 241 } | 244 } |
| 242 | 245 |
| 243 void WindowProxy::createContext() | 246 void WindowProxy::createContext() |
| 244 { | 247 { |
| 245 // The documentLoader pointer could be 0 during frame shutdown. | 248 // The documentLoader pointer could be 0 during frame shutdown. |
| 246 // FIXME: Can we remove this check? | 249 // FIXME: Can we remove this check? |
| 247 if (!m_frame->loader().documentLoader()) | 250 if (!m_frame->loader().documentLoader()) |
| 248 return; | 251 return; |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 488 |
| 486 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) | 489 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) |
| 487 { | 490 { |
| 488 ASSERT(m_world->isMainWorld()); | 491 ASSERT(m_world->isMainWorld()); |
| 489 if (!isContextInitialized()) | 492 if (!isContextInitialized()) |
| 490 return; | 493 return; |
| 491 setSecurityToken(origin); | 494 setSecurityToken(origin); |
| 492 } | 495 } |
| 493 | 496 |
| 494 } // namespace blink | 497 } // namespace blink |
| OLD | NEW |