Summary: | Web Inspector: sourceMappingURL not loaded in generated script | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | eelco | ||||||||||
Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> | ||||||||||
Status: | RESOLVED FIXED | ||||||||||||
Severity: | Normal | CC: | bburg, commit-queue, ggaren, graouts, joepeck, keith_miller, mark.lam, mattbaker, msaboff, nvasilyev, saam, timothy, webkit-bug-importer | ||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||
Version: | WebKit Nightly Build | ||||||||||||
Hardware: | Mac | ||||||||||||
OS: | OS X 10.11 | ||||||||||||
Bug Depends on: | 156863 | ||||||||||||
Bug Blocks: | |||||||||||||
Attachments: |
|
Description
eelco
2016-03-30 05:22:16 PDT
This is another great reduction! Even after fixing bug 156021, this exposes another issue. We aren't reliably detecting the sourceURL within functions created via `Function`. * TEST <script> console.log(Function("\n//# sourceURL=test.js\nreturn 1+1")()); </script> I'd expect this to always create a Extra Script named "test.js" however it only does it rarely (once or twice) and then never again. Hmm, the so issue here is the sourceURL/sourceMappingURL do not get added when we skip re-parsing via the CodeCache: When constructing the executable for `Function(str)` we go through: frame #0: JSC::CodeCache::getFunctionExecutableFromGlobalCode frame #1: JSC::UnlinkedFunctionExecutable::fromGlobalCode frame #2: JSC::FunctionExecutable::fromGlobalCode frame #3: JSC::constructFunctionSkippingEvalEnabledCheck frame #4: JSC::constructFunction frame #5: JSC::constructFunction frame #6: JSC::callFunctionConstructor At which point if we do not have it in the CodeCache we parse it. If we do have this in the code cache, we return the cached unlinked function executable skipping parsing. By skipping parsing we don't update the SourceProvider with the sourceURL/sourceMappingURL, because we normally do that under JSC::Parser<>::parse. Fixing the CodeCache issue then revealed a few more issues. 1. Using CodeCache and skipping loses source directives (Function constructor) 2. Frontend didn't properly handle a top level sourceMappingURL being a dataURL 3. Exceptions thrown in non-resource scripts would not have resource links in the console, because we couldn't map them back to a resource. (no url) Fixing all of these gets this working. I'm going to first fix the CodeCache issue separately, because I think the JavaScriptCore folks may have some input on that. Created attachment 276973 [details]
[PATCH] Proposed Fix
Created attachment 276974 [details]
[IMAGE] After - Test Case
Created attachment 276975 [details]
[IMAGE] After - Eval Code console messages with/without sourceURL name
Attachment 276973 [details] did not pass style-queue:
ERROR: Source/JavaScriptCore/inspector/ScriptCallFrame.h:44: The parameter name "sourceID" adds no information, so it should be removed. [readability/parameter_name] [5]
Total errors found: 1 in 22 files
If any of these errors are false positives, please file a bug against check-webkit-style.
Comment on attachment 276973 [details]
[PATCH] Proposed Fix
r=me
Comment on attachment 276973 [details] [PATCH] Proposed Fix Clearing flags on attachment: 276973 Committed r199852: <http://trac.webkit.org/changeset/199852> All reviewed patches have been landed. Closing bug. |