Extract information out of the source map worker to be stored into the Debugger store.
Renamed SourceMapLoader getOriginalURLs to loadSourceMap to better translate the heavy process involved in this method.
While doing that, also inline the transfer of source map ignore list in this call (instead of always having another worker message right after).
This will be used and tested in the next changeset.
Differential Revision: https://phabricator.services.mozilla.com/D188585
The main goal here is to re-throw the exception so that the debugger can start displaying source map errors.
Note that the previous changeset tweaked the StyleEditor code to handle exceptions.
The Debugger will be handled in the next changeset.
Differential Revision: https://phabricator.services.mozilla.com/D187576
Extract information out of the source map worker to be stored into the Debugger store.
Renamed SourceMapLoader getOriginalURLs to loadSourceMap to better translate the heavy process involved in this method.
While doing that, also inline the transfer of source map ignore list in this call (instead of always having another worker message right after).
This will be used and tested in the next changeset.
Differential Revision: https://phabricator.services.mozilla.com/D188585
The main goal here is to re-throw the exception so that the debugger can start displaying source map errors.
Note that the previous changeset tweaked the StyleEditor code to handle exceptions.
The Debugger will be handled in the next changeset.
Differential Revision: https://phabricator.services.mozilla.com/D187576
For now, we were only showing the related bundle file,
so that we can easily navigate from original file to bundle file.
But we could also show the related original file for a location.
This is slightly more complex because the mapped location can now be different
depending on the precise location in the selected file.
Also, there is no synchronous API to compute this mapped location.
We have to involve an asynchronous action to compute this data for bundles.
Tweak Source Map Loader in order to do a loose bundle to original mapping
in case we aren't in a cursor location that has a perfect match.
Try mapping the first column of the same line and then all first column of
the next 10 following lines.
Differential Revision: https://phabricator.services.mozilla.com/D187573
We can avoid the creation of an handful of object creations by passing
the "breakpoint positions" objects directly to the Source Map Loader.
(avoid convertToList)
We can also tune `SourceMapLoader.getOriginalLocations` output to better
fit the requirements of the main thread.
Differential Revision: https://phabricator.services.mozilla.com/D189950
This helps the callsite in the main thread to distinguish between being mapped
or lack of mappings.
Doing this prevent returning back the exact same location and could spare some cycles.
Differential Revision: https://phabricator.services.mozilla.com/D178389
We used to get the mappings array from the pretty fast worker to the prettyPrint
action, and then pass this array to the sourceMap service (also a worker).
As the mapping can be quite large, and given it has a complex shape, passing it
to and from workers (via `postMessage`) was costly.
So here, instead of passing only the mapping, we directly generate the sourceMap
from the pretty fast worker, and pass it to the action which forwards it to
the sourceMap service.
This helps reduce the overhead we were seeing when not buffering the lines in
the pretty print worker, in the previous patch of this stack.
Differential Revision: https://phabricator.services.mozilla.com/D168384
This complexify the existing tests a bit, but will make the management from the Toolbox more obvious.
The metrics test highlights that we allow to prevent loading the sourcemap modules
unless it is strictly necessary!
(Also I forgot to remove the source-map-loader from the list of browser loader module...)
Differential Revision: https://phabricator.services.mozilla.com/D164694
Because of this, we have to now pass the worker URL via WorkerDispatcher constructor.
Doing this should help then extend WorkerDispatcher instead of manually instantiating it.
About browser_jsterm_hide_when_devtools_chrome_enabled_false.js, as the SourceMapLoader
is now started lazily, the worker is no longer started during this test
and so we no longer have to wait for it.
And browser_jsterm_await_paused.js was failing because we resumed too quickly.
I added some code to better wait for awaitExpression full evaluation.
Differential Revision: https://phabricator.services.mozilla.com/D164547
This complexify the existing tests a bit, but will make the management from the Toolbox more obvious.
The metrics test highlights that we allow to prevent loading the sourcemap modules
unless it is strictly necessary!
(Also I forgot to remove the source-map-loader from the list of browser loader module...)
Differential Revision: https://phabricator.services.mozilla.com/D164694
Because of this, we have to now pass the worker URL via WorkerDispatcher constructor.
Doing this should help then extend WorkerDispatcher instead of manually instantiating it.
About browser_jsterm_hide_when_devtools_chrome_enabled_false.js, as the SourceMapLoader
is now started lazily, the worker is no longer started during this test
and so we no longer have to wait for it.
And browser_jsterm_await_paused.js was failing because we resumed too quickly.
I added some code to better wait for awaitExpression full evaluation.
Differential Revision: https://phabricator.services.mozilla.com/D164547
Now that source-map-loader uses ChromeLoader, it doesn't need to be loaded
via the Browser Loader. It was mostly used to be able to access window.Worker symbol.
It was also exposing `fetch` global symbol. DevTools Loader wasn't exposing it.
I fixed that as this symbol is available in JSM/ESM.
Differential Revision: https://phabricator.services.mozilla.com/D162966
WorkerDispatcher.invoke will instantiate a new "Task" method on each call.
Ideally, we should only use WorkerDispatch.task(), unless the related method is called once.
Differential Revision: https://phabricator.services.mozilla.com/D162564
This used to be a node package. Let's make it become regular commonjs devtools modules.
This will make it trivial to migrate this to ES Modules.
Also possibly make this code become the unique layer in m-c on top of the source-map package.
We no longer use webpack to build the two bundles (index.js and worker.js),
instead, we are using the toolkit worker loader (require.js) in order to load
all this code without any build step.
As this is no longer a node package, I removed node-specific modules (assertRoot/wasmAsset)
and simplify the definition of wasm file URIs as they are now fixed.
Also moving the debugger to load internal "devtools/client/shared/source-map/source-map.js"
module in jest as running the Web Worker instantiated by source-map/index.js is too complex.
Differential Revision: https://phabricator.services.mozilla.com/D159115