Title: [275262] trunk/Source
Revision
275262
Author
[email protected]
Date
2021-03-30 20:01:11 -0700 (Tue, 30 Mar 2021)

Log 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/_javascript_Core:

* 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.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (275261 => 275262)


--- trunk/Source/_javascript_Core/ChangeLog	2021-03-31 02:55:38 UTC (rev 275261)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-03-31 03:01:11 UTC (rev 275262)
@@ -1,3 +1,21 @@
+2021-03-30  Devin Rousso  <[email protected]>
+
+        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).
+
+        * Scripts/make-js-file-arrays.py:
+        (main):
+        Add a `//# sourceURL=__InjectedScript_*.js` to the contents before it's encoded.
+
 2021-03-30  Sam Weinig  <[email protected]>
 
         JSGlobalObject's m_customGetterFunctionMap and m_customSetterFunctionMap should be sets, not maps, and should use both the identifier and function pointer as the key

Modified: trunk/Source/_javascript_Core/Scripts/make-js-file-arrays.py (275261 => 275262)


--- trunk/Source/_javascript_Core/Scripts/make-js-file-arrays.py	2021-03-31 02:55:38 UTC (rev 275261)
+++ trunk/Source/_javascript_Core/Scripts/make-js-file-arrays.py	2021-03-31 03:01:11 UTC (rev 275262)
@@ -70,6 +70,8 @@
     print('namespace {0:s} {{'.format(namespace), file=sourceFile)
 
     for inputFileName in inputPaths:
+        variableName = os.path.splitext(os.path.basename(inputFileName))[0]
+        sourceURLDirective = "//# sourceURL=__InjectedScript_" + variableName + ".js\n"
 
         if is_3:
             inputStream = io.open(inputFileName, encoding='utf-8')
@@ -79,9 +81,9 @@
         data = ""
 
         if not options.no_minify:
-            characters = jsmin(data)
+            characters = sourceURLDirective + jsmin(data)
         else:
-            characters = data
+            characters = sourceURLDirective + data
 
         if options.fail_if_non_ascii:
             for character in characters:
@@ -97,8 +99,6 @@
         # because UTF-8 characters may need more than one byte.
         size = len(codepoints)
 
-        variableName = os.path.splitext(os.path.basename(inputFileName))[0]
-
         print('extern const char {0:s}_javascript_[{1:d}];'.format(variableName, size), file=headerFile)
         print('const char {0:s}_javascript_[{1:d}] = {{'.format(variableName, size), file=sourceFile)
 

Modified: trunk/Source/WebCore/ChangeLog (275261 => 275262)


--- trunk/Source/WebCore/ChangeLog	2021-03-31 02:55:38 UTC (rev 275261)
+++ trunk/Source/WebCore/ChangeLog	2021-03-31 03:01:11 UTC (rev 275262)
@@ -1,3 +1,22 @@
+2021-03-30  Devin Rousso  <[email protected]>
+
+        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).
+
+        * 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.
+
 2021-03-30  Venky Dass  <[email protected]>
 
         Nullptr crash in Crash in WebCore::positionInParentBeforeNode(..) where a NULL check is missing.

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (275261 => 275262)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-03-31 02:55:38 UTC (rev 275261)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2021-03-31 03:01:11 UTC (rev 275262)
@@ -7160,13 +7160,10 @@
         if (functionValue.isCallable(vm))
             return true;
 
-        unsigned index = 0;
         for (auto& mediaControlsScript : mediaControlsScripts) {
             if (mediaControlsScript.isEmpty())
                 continue;
-            // Setting a scriptURL allows the source to be debuggable in the inspector.
-            URL scriptURL = URL({ }, makeString("__InjectedScript_mediaControlsScript"_s, ++index, ".js"));
-            scriptController.evaluateInWorldIgnoringException(ScriptSourceCode(mediaControlsScript, WTFMove(scriptURL)), world);
+            scriptController.evaluateInWorldIgnoringException(ScriptSourceCode(mediaControlsScript), world);
             if (UNLIKELY(scope.exception())) {
                 auto* exception = scope.exception();
                 scope.clearException();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to