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 28 matching lines...) Expand all Loading... | |
| 39 #include "bindings/core/v8/V8Document.h" | 39 #include "bindings/core/v8/V8Document.h" |
| 40 #include "bindings/core/v8/V8GCForContextDispose.h" | 40 #include "bindings/core/v8/V8GCForContextDispose.h" |
| 41 #include "bindings/core/v8/V8HTMLCollection.h" | 41 #include "bindings/core/v8/V8HTMLCollection.h" |
| 42 #include "bindings/core/v8/V8HTMLDocument.h" | 42 #include "bindings/core/v8/V8HTMLDocument.h" |
| 43 #include "bindings/core/v8/V8HiddenValue.h" | 43 #include "bindings/core/v8/V8HiddenValue.h" |
| 44 #include "bindings/core/v8/V8Initializer.h" | 44 #include "bindings/core/v8/V8Initializer.h" |
| 45 #include "bindings/core/v8/V8ObjectConstructor.h" | 45 #include "bindings/core/v8/V8ObjectConstructor.h" |
| 46 #include "bindings/core/v8/V8PagePopupControllerBinding.h" | 46 #include "bindings/core/v8/V8PagePopupControllerBinding.h" |
| 47 #include "bindings/core/v8/V8PrivateProperty.h" | 47 #include "bindings/core/v8/V8PrivateProperty.h" |
| 48 #include "bindings/core/v8/V8Window.h" | 48 #include "bindings/core/v8/V8Window.h" |
| 49 #include "core/dom/ModulatorImpl.h" | |
| 49 #include "core/frame/LocalFrame.h" | 50 #include "core/frame/LocalFrame.h" |
| 50 #include "core/frame/csp/ContentSecurityPolicy.h" | 51 #include "core/frame/csp/ContentSecurityPolicy.h" |
| 51 #include "core/html/DocumentNameCollection.h" | 52 #include "core/html/DocumentNameCollection.h" |
| 52 #include "core/html/HTMLCollection.h" | 53 #include "core/html/HTMLCollection.h" |
| 53 #include "core/html/HTMLIFrameElement.h" | 54 #include "core/html/HTMLIFrameElement.h" |
| 54 #include "core/inspector/InspectorInstrumentation.h" | 55 #include "core/inspector/InspectorInstrumentation.h" |
| 55 #include "core/inspector/MainThreadDebugger.h" | 56 #include "core/inspector/MainThreadDebugger.h" |
| 56 #include "core/loader/DocumentLoader.h" | 57 #include "core/loader/DocumentLoader.h" |
| 57 #include "core/loader/FrameLoader.h" | 58 #include "core/loader/FrameLoader.h" |
| 58 #include "core/loader/FrameLoaderClient.h" | 59 #include "core/loader/FrameLoaderClient.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 402 | 403 |
| 403 void WindowProxy::updateActivityLogger() { | 404 void WindowProxy::updateActivityLogger() { |
| 404 m_scriptState->perContextData()->setActivityLogger( | 405 m_scriptState->perContextData()->setActivityLogger( |
| 405 V8DOMActivityLogger::activityLogger( | 406 V8DOMActivityLogger::activityLogger( |
| 406 m_world->worldId(), | 407 m_world->worldId(), |
| 407 m_frame->isLocalFrame() && toLocalFrame(m_frame)->document() | 408 m_frame->isLocalFrame() && toLocalFrame(m_frame)->document() |
| 408 ? toLocalFrame(m_frame)->document()->baseURI() | 409 ? toLocalFrame(m_frame)->document()->baseURI() |
| 409 : KURL())); | 410 : KURL())); |
| 410 } | 411 } |
| 411 | 412 |
| 413 void WindowProxy::updateModulator() { | |
| 414 DCHECK(m_world->isMainWorld()); | |
| 415 | |
| 416 if (!RuntimeEnabledFeatures::moduleScriptsEnabled()) | |
| 417 return; | |
| 418 if (!m_frame->isLocalFrame()) | |
| 419 return; | |
| 420 if (Document* document = toLocalFrame(m_frame)->document()) { | |
| 421 Modulator* modulator = ModulatorImpl::create(m_scriptState, *document); | |
|
haraken
2017/01/11 02:31:28
How heavy would it be to create Modulator for all
kouhei (in TOK)
2017/01/17 05:26:13
Done.
| |
| 422 m_scriptState->perContextData()->setModulator(modulator); | |
| 423 } | |
| 424 } | |
| 425 | |
| 412 void WindowProxy::setSecurityToken(SecurityOrigin* origin) { | 426 void WindowProxy::setSecurityToken(SecurityOrigin* origin) { |
| 413 // If two tokens are equal, then the SecurityOrigins canAccess each other. | 427 // If two tokens are equal, then the SecurityOrigins canAccess each other. |
| 414 // If two tokens are not equal, then we have to call canAccess. | 428 // If two tokens are not equal, then we have to call canAccess. |
| 415 // Note: we can't use the HTTPOrigin if it was set from the DOM. | 429 // Note: we can't use the HTTPOrigin if it was set from the DOM. |
| 416 String token; | 430 String token; |
| 417 // There are two situations where v8 needs to do a full canAccess check, | 431 // There are two situations where v8 needs to do a full canAccess check, |
| 418 // so set an empty security token instead: | 432 // so set an empty security token instead: |
| 419 // - document.domain was modified | 433 // - document.domain was modified |
| 420 // - the frame is remote | 434 // - the frame is remote |
| 421 bool delaySet = m_frame->isRemoteFrame() || | 435 bool delaySet = m_frame->isRemoteFrame() || |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 457 // as the security token. | 471 // as the security token. |
| 458 context->SetSecurityToken(v8AtomicString(m_isolate, token)); | 472 context->SetSecurityToken(v8AtomicString(m_isolate, token)); |
| 459 } | 473 } |
| 460 | 474 |
| 461 void WindowProxy::updateDocument() { | 475 void WindowProxy::updateDocument() { |
| 462 DCHECK(m_world->isMainWorld()); | 476 DCHECK(m_world->isMainWorld()); |
| 463 if (!isContextInitialized()) | 477 if (!isContextInitialized()) |
| 464 return; | 478 return; |
| 465 | 479 |
| 466 updateActivityLogger(); | 480 updateActivityLogger(); |
| 481 updateModulator(); | |
| 467 updateDocumentProperty(); | 482 updateDocumentProperty(); |
| 468 updateSecurityOrigin(m_frame->securityContext()->getSecurityOrigin()); | 483 updateSecurityOrigin(m_frame->securityContext()->getSecurityOrigin()); |
| 469 } | 484 } |
| 470 | 485 |
| 471 static v8::Local<v8::Value> getNamedProperty( | 486 static v8::Local<v8::Value> getNamedProperty( |
| 472 HTMLDocument* htmlDocument, | 487 HTMLDocument* htmlDocument, |
| 473 const AtomicString& key, | 488 const AtomicString& key, |
| 474 v8::Local<v8::Object> creationContext, | 489 v8::Local<v8::Object> creationContext, |
| 475 v8::Isolate* isolate) { | 490 v8::Isolate* isolate) { |
| 476 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key)) | 491 if (!htmlDocument->hasNamedItem(key) && !htmlDocument->hasExtraNamedItem(key)) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 550 .ToChecked(); | 565 .ToChecked(); |
| 551 } | 566 } |
| 552 | 567 |
| 553 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { | 568 void WindowProxy::updateSecurityOrigin(SecurityOrigin* origin) { |
| 554 if (!isContextInitialized()) | 569 if (!isContextInitialized()) |
| 555 return; | 570 return; |
| 556 setSecurityToken(origin); | 571 setSecurityToken(origin); |
| 557 } | 572 } |
| 558 | 573 |
| 559 } // namespace blink | 574 } // namespace blink |
| OLD | NEW |