Changeset 254970 in webkit


Ignore:
Timestamp:
Jan 23, 2020 1:51:58 AM (4 years ago)
Author:
ysuzuki@apple.com
Message:

nomodule scripts are fetched in some cases (with empty cache or in new tab)
https://bugs.webkit.org/show_bug.cgi?id=194337
<rdar://problem/49700924>

Reviewed by Ryosuke Niwa.

Source/WebCore:

The preloader attempt to preload "src" of script tags. However, script tag attributed with "nomodule"
will never be executed by WebKit since it already supports modules. Avoid loading this content in
the preloader.

Test: http/wpt/preload/classic-script-with-nomodule.html

  • html/parser/HTMLPreloadScanner.cpp:

(WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
(WebCore::TokenPreloadScanner::StartTagScanner::shouldPreload):

LayoutTests:

  • http/wpt/preload/classic-script-with-nomodule-expected.txt: Added.
  • http/wpt/preload/classic-script-with-nomodule.html: Added.
  • http/wpt/preload/resources/classic.js: Added.
  • http/wpt/preload/resources/module.js: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r254966 r254970  
     12020-01-23  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        nomodule scripts are fetched in some cases (with empty cache or in new tab)
     4        https://bugs.webkit.org/show_bug.cgi?id=194337
     5        <rdar://problem/49700924>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        * http/wpt/preload/classic-script-with-nomodule-expected.txt: Added.
     10        * http/wpt/preload/classic-script-with-nomodule.html: Added.
     11        * http/wpt/preload/resources/classic.js: Added.
     12        * http/wpt/preload/resources/module.js: Added.
     13
    1142020-01-22  Lauro Moura  <lmoura@igalia.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r254965 r254970  
     12020-01-23  Yusuke Suzuki  <ysuzuki@apple.com>
     2
     3        nomodule scripts are fetched in some cases (with empty cache or in new tab)
     4        https://bugs.webkit.org/show_bug.cgi?id=194337
     5        <rdar://problem/49700924>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        The preloader attempt to preload "src" of script tags. However, script tag attributed with "nomodule"
     10        will never be executed by WebKit since it already supports modules. Avoid loading this content in
     11        the preloader.
     12
     13        Test: http/wpt/preload/classic-script-with-nomodule.html
     14
     15        * html/parser/HTMLPreloadScanner.cpp:
     16        (WebCore::TokenPreloadScanner::StartTagScanner::processAttribute):
     17        (WebCore::TokenPreloadScanner::StartTagScanner::shouldPreload):
     18
    1192020-01-22  Fujii Hironori  <Hironori.Fujii@sony.com>
    220
  • trunk/Source/WebCore/html/parser/HTMLPreloadScanner.cpp

    r251708 r254970  
    243243                m_referrerPolicy = parseReferrerPolicy(attributeValue, ReferrerPolicySource::ReferrerPolicyAttribute).valueOr(ReferrerPolicy::EmptyString);
    244244                break;
     245            } else if (match(attributeName, nomoduleAttr)) {
     246                m_scriptIsNomodule = true;
     247                break;
    245248            }
    246249            processImageAndScriptAttribute(attributeName, attributeValue);
     
    353356            return false;
    354357
     358        if (m_tagId == TagId::Script && m_moduleScript == PreloadRequest::ModuleScript::No && m_scriptIsNomodule)
     359            return false;
     360
    355361        return true;
    356362    }
     
    374380    bool m_metaIsDisabledAdaptations;
    375381    bool m_inputIsImage;
     382    bool m_scriptIsNomodule { false };
    376383    float m_deviceScaleFactor;
    377384    PreloadRequest::ModuleScript m_moduleScript { PreloadRequest::ModuleScript::No };
Note: See TracChangeset for help on using the changeset viewer.