* SUMMARY FormatterWorker fails to find "External/Esprima.js" in Production builds. This affects Safari Technology Preview Release 3 and Nightlies. * STEPS TO REPRODUCE 1. Open Inspector on this page 2. Try to open any Script with minified contents => Infinite loading indicator * ERROR [Error] Failed to load resource: The requested URL was not found on this server. (esprima.js, line 0) URL in this case being: file:///Applications/Safari%20Technology%20Preview.app/Contents/Frameworks/WebInspectorUI.framework/Resources/External/Esprima/esprima.js Bad path: WebInspectorUI.framework/Resources/External/Esprima.js The actual path ends up be: WebInspectorUI.framework/Resources/Esprima.js * NOTES Source/WebInspectorUI/UserInterface/Workers/Formatter/FormatterWorker.js does: > importScripts(...[ > "../../External/Esprima/esprima.js", > "FormatterUtilities.js", > "FormatterContentBuilder.js", > "ESTreeWalker.js", > "EsprimaFormatter.js", > ]); So apparently our optimization pass doesn't keep the External directory.
<rdar://problem/25996556>
Created attachment 277670 [details] [PATCH] Proposed Fix
Here is an example of the script producing a warning and working correctly. It modifies the files in place, so you can test on the UserInterface directory. # Comment out the line that does the replace. shell> perl ./Scripts/fix-worker-imports-for-optimized-builds.pl --input-directory ./UserInterface/Workers ERROR: Workers/Formatter/FormatterWorker.js: Unhandled External importScript in Worker script on line 27: "../../External/Esprima/esprima.js", shell> echo $? 1 # Revert the script back to expected shell> perl ./Scripts/fix-worker-imports-for-optimized-builds.pl --input-directory ./UserInterface/Workers shell> echo $? 0 shell> git diff . diff --git a/Source/WebInspectorUI/UserInterface/Workers/Formatter/FormatterWorker.js b/Source/WebInspectorUI/UserInterface/Workers/Formatter/FormatterWorker.js index 4f9067b..5811361 100644 --- a/Source/WebInspectorUI/UserInterface/Workers/Formatter/FormatterWorker.js +++ b/Source/WebInspectorUI/UserInterface/Workers/Formatter/FormatterWorker.js @@ -24,7 +24,7 @@ */ importScripts(...[ - "../../External/Esprima/esprima.js", + "../../Esprima.js", "FormatterUtilities.js", "FormatterContentBuilder.js", "ESTreeWalker.js",
Comment on attachment 277670 [details] [PATCH] Proposed Fix View in context: https://bugs.webkit.org/attachment.cgi?id=277670&action=review > Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl:250 > + system(File::Spec->catfile($scriptsRoot, 'fix-worker-imports-for-optimized-builds.pl'), '--input-directory', $workersDir); This should: and die "Reason"; so that `make` itself fails the build if fix-worker-imports returns with a bad exit code
Created attachment 277671 [details] [PATCH] Proposed Fix
With the "and die" the build will actually fail now if this script fails. PhaseScriptExecution Copy\ User\ Interface\ Resources /Build/WebInspectorUI.build/Release/WebInspectorUI.build/Script-1C60FF1214E6D9AF006CD77D.sh cd /Code/safari/OpenSource/Source/WebInspectorUI export ACTION=build export ALTERNATE_GROUP=staff .... /bin/sh -c /Build/WebInspectorUI.build/Release/WebInspectorUI.build/Script-1C60FF1214E6D9AF006CD77D.sh ERROR: Workers/Formatter/FormatterWorker.js: Unhandled External importScript in Worker script on line 27: "../../External/Esprima/esprima.js", Failed to update Worker imports for optimized builds. at /Code/safari/OpenSource/Source/WebInspectorUI/Scripts/copy-user-interface-resources.pl line 250. Command /bin/sh failed with exit code 1 That is important, otherwise these issues could go unnoticed!
Comment on attachment 277671 [details] [PATCH] Proposed Fix Clearing flags on attachment: 277671 Committed r200229: <http://trac.webkit.org/changeset/200229>
All reviewed patches have been landed. Closing bug.
*** Bug 157223 has been marked as a duplicate of this bug. ***
*** Bug 157343 has been marked as a duplicate of this bug. ***