Changeset 211314 in webkit


Ignore:
Timestamp:
Jan 27, 2017 4:49:01 PM (7 years ago)
Author:
Yusuke Suzuki
Message:

setTimeout / setInterval's string execution should inherit SourceOrigin correctly
https://bugs.webkit.org/show_bug.cgi?id=167097

Reviewed by Darin Adler.

Source/WebCore:

Tests: js/dom/modules/import-from-set-interval.html

js/dom/modules/import-from-set-timeout.html

  • bindings/js/ScriptController.cpp:

(WebCore::ScriptController::executeScriptInWorld):

LayoutTests:

We set the default SourceOrigin for the ScriptController::executeScriptInWorld.
The default SourceOrigin has the document baseURL and CachedScriptFetcher.

setTimeout and setInterval use this interface. And it uses the default SourceOrigin
for the document (Realm of the setTimeout / setInterval). This is the expected
behavior in the dynamic import proposal.

  • js/dom/modules/import-from-set-interval-expected.txt: Added.
  • js/dom/modules/import-from-set-interval.html: Added.
  • js/dom/modules/import-from-set-timeout-expected.txt: Added.
  • js/dom/modules/import-from-set-timeout.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r211307 r211314  
     12017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        setTimeout / setInterval's string execution should inherit SourceOrigin correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=167097
     5
     6        Reviewed by Darin Adler.
     7
     8        We set the default SourceOrigin for the ScriptController::executeScriptInWorld.
     9        The default SourceOrigin has the document baseURL and CachedScriptFetcher.
     10
     11        setTimeout and setInterval use this interface. And it uses the default SourceOrigin
     12        for the document (Realm of the setTimeout / setInterval). This is the expected
     13        behavior in the dynamic import proposal.
     14
     15        * js/dom/modules/import-from-set-interval-expected.txt: Added.
     16        * js/dom/modules/import-from-set-interval.html: Added.
     17        * js/dom/modules/import-from-set-timeout-expected.txt: Added.
     18        * js/dom/modules/import-from-set-timeout.html: Added.
     19
    1202017-01-27  Simon Fraser  <simon.fraser@apple.com>
    221
  • trunk/Source/WebCore/ChangeLog

    r211313 r211314  
     12017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        setTimeout / setInterval's string execution should inherit SourceOrigin correctly
     4        https://bugs.webkit.org/show_bug.cgi?id=167097
     5
     6        Reviewed by Darin Adler.
     7
     8        Tests: js/dom/modules/import-from-set-interval.html
     9               js/dom/modules/import-from-set-timeout.html
     10
     11        * bindings/js/ScriptController.cpp:
     12        (WebCore::ScriptController::executeScriptInWorld):
     13
    1142017-01-27  Yusuke Suzuki  <utatane.tea@gmail.com>
    215
  • trunk/Source/WebCore/bindings/js/ScriptController.cpp

    r211313 r211314  
    650650{
    651651    UserGestureIndicator gestureIndicator(forceUserGesture ? std::optional<ProcessingUserGestureState>(ProcessingUserGesture) : std::nullopt);
    652     ScriptSourceCode sourceCode(script, m_frame.document()->url());
     652    ScriptSourceCode sourceCode(script, m_frame.document()->url(), TextPosition(), JSC::SourceProviderSourceType::Program, CachedScriptFetcher::create(m_frame.document()->charset()));
    653653
    654654    if (!canExecuteScripts(AboutToExecuteScript) || isPaused())
Note: See TracChangeset for help on using the changeset viewer.