Title: [275915] trunk/Source/WebKit
- Revision
- 275915
- Author
- [email protected]
- Date
- 2021-04-13 15:42:33 -0700 (Tue, 13 Apr 2021)
Log Message
REGRESSION(r275262) [WebDriver] Make automation JS code aware of injected script headers
https://bugs.webkit.org/show_bug.cgi?id=224422
Reviewed by BJ Burg.
r275262 introduced "//# sourceURL..." prefixes to injected scripts and
this broke Automation JS evaluation, as the code evaluated is wrapped
with "(async " + CODE + ")". This results in "Unexpected keyword 'function'.
Expected ')' to end a compound _expression_." errors.
Covered by existing tests.
* WebProcess/Automation/WebAutomationSessionProxy.js:
(let.AutomationSessionProxy.prototype._execute): Move initial lines
with leading comments before the async _expression_.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (275914 => 275915)
--- trunk/Source/WebKit/ChangeLog 2021-04-13 21:54:35 UTC (rev 275914)
+++ trunk/Source/WebKit/ChangeLog 2021-04-13 22:42:33 UTC (rev 275915)
@@ -1,3 +1,21 @@
+2021-04-13 Lauro Moura <[email protected]>
+
+ REGRESSION(r275262) [WebDriver] Make automation JS code aware of injected script headers
+ https://bugs.webkit.org/show_bug.cgi?id=224422
+
+ Reviewed by BJ Burg.
+
+ r275262 introduced "//# sourceURL..." prefixes to injected scripts and
+ this broke Automation JS evaluation, as the code evaluated is wrapped
+ with "(async " + CODE + ")". This results in "Unexpected keyword 'function'.
+ Expected ')' to end a compound _expression_." errors.
+
+ Covered by existing tests.
+
+ * WebProcess/Automation/WebAutomationSessionProxy.js:
+ (let.AutomationSessionProxy.prototype._execute): Move initial lines
+ with leading comments before the async _expression_.
+
2021-04-13 Aditya Keerthi <[email protected]>
[iOS][FCR] Color picker sheet should use default height
Modified: trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js (275914 => 275915)
--- trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2021-04-13 21:54:35 UTC (rev 275914)
+++ trunk/Source/WebKit/WebProcess/Automation/WebAutomationSessionProxy.js 2021-04-13 22:42:33 UTC (rev 275915)
@@ -71,8 +71,20 @@
}
let promise = new Promise((resolve, reject) => {
+ // Split initial line comments like "//# __injectedScript" source map that would break the async _expression_ below.
+ let lines = functionString.split("\n");
+ let prefixLines = [];
+ while (lines && lines[0].startsWith("//")) {
+ prefixLines.push(lines.shift());
+ }
+ functionString = lines.join("\n");
+
+ let prefix = prefixLines.join("\n")
+ if (prefix)
+ prefix += "\n";
+
// The script is expected to be a function declaration. Evaluate it inside parenthesis to get the function value.
- let functionValue = evaluate("(async " + functionString + ")");
+ let functionValue = evaluate(prefix + "(async " + functionString + ")");
if (typeof functionValue !== "function")
reject(new TypeError("Script did not evaluate to a function."));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes