Ignore:
Timestamp:
Mar 30, 2021, 8:01:11 PM (4 years ago)
Author:
Devin Rousso
Message:

REGRESSION(r274607): media controls script is visible in Web Inspector even without the engineering "Show WebKit-internal scripts" enabled
https://bugs.webkit.org/show_bug.cgi?id=223961

Reviewed by Yusuke Suzuki.

It turns out that Web Inspector will only ignore scripts that have a source URL directive
that matches __InjectedScript_*.js, not those that have a (source) URL matching that.

In addition to Web Inspector ignoring these scripts in the UI, it will also cause the
Debugger to not pause in scripts with a matching source URL directive (unless the
local build engineering only "Pause in WebKit-internal scripts" is enabled).

Source/JavaScriptCore:

  • Scripts/make-js-file-arrays.py:

(main):
Add a //# sourceURL=__InjectedScript_*.js to the contents before it's encoded.

Source/WebCore:

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript):
Change the ScriptSourceCode here to not have a URL and have make-js-file-arrays.py
add a //# sourceURL=__InjectedScript_*.js to the contents before it's encoded.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/Scripts/make-js-file-arrays.py

    r274607 r275262  
    7171
    7272    for inputFileName in inputPaths:
     73        variableName = os.path.splitext(os.path.basename(inputFileName))[0]
     74        sourceURLDirective = "//# sourceURL=__InjectedScript_" + variableName + ".js\n"
    7375
    7476        if is_3:
     
    8082
    8183        if not options.no_minify:
    82             characters = jsmin(data)
     84            characters = sourceURLDirective + jsmin(data)
    8385        else:
    84             characters = data
     86            characters = sourceURLDirective + data
    8587
    8688        if options.fail_if_non_ascii:
     
    98100        size = len(codepoints)
    99101
    100         variableName = os.path.splitext(os.path.basename(inputFileName))[0]
    101 
    102102        print('extern const char {0:s}JavaScript[{1:d}];'.format(variableName, size), file=headerFile)
    103103        print('const char {0:s}JavaScript[{1:d}] = {{'.format(variableName, size), file=sourceFile)
Note: See TracChangeset for help on using the changeset viewer.