This repository was archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 746
More advanced original source scopes mapping. #4521
Merged
jasonLaster
merged 2 commits into
firefox-devtools:master
from
yurydelendik:advanced-scopes
Nov 17, 2017
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| /* Any copyright is dedicated to the Public Domain. | ||
| * http://creativecommons.org/publicdomain/zero/1.0/ */ | ||
|
|
||
| // Tests loading sourcemapped sources, setting breakpoints, and | ||
| // inspecting restored scopes. | ||
|
|
||
| function toggleNode(dbg, index) { | ||
| clickElement(dbg, "scopeNode", index); | ||
| } | ||
|
|
||
| function getLabel(dbg, index) { | ||
| return findElement(dbg, "scopeNode", index).innerText; | ||
| } | ||
|
|
||
| function hasScopeNode(dbg, index) { | ||
| return !!findElement(dbg, "scopeNode", index); | ||
| } | ||
|
|
||
| async function waitForScopeNode(dbg, index) { | ||
| const selector = getSelector("scopeNode", index); | ||
| return waitForElement(dbg, selector); | ||
| } | ||
|
|
||
| // This source map does not have source contents, so it's fetched separately | ||
| add_task(async function() { | ||
| // NOTE: the CORS call makes the test run times inconsistent | ||
| requestLongerTimeout(2); | ||
|
|
||
| const dbg = await initDebugger("doc-sourcemaps3.html"); | ||
| const { selectors: { getBreakpoint, getBreakpoints }, getState } = dbg; | ||
|
|
||
| toggleScopes(dbg); | ||
|
|
||
| await waitForSources(dbg, "bundle.js", "sorted.js", "test.js"); | ||
|
|
||
| ok(true, "Original sources exist"); | ||
| const sortedSrc = findSource(dbg, "sorted.js"); | ||
|
|
||
| await selectSource(dbg, sortedSrc); | ||
|
|
||
| // Test that breakpoint is not off by a line. | ||
| await addBreakpoint(dbg, sortedSrc, 9); | ||
| is(getBreakpoints(getState()).size, 1, "One breakpoint exists"); | ||
| ok( | ||
| getBreakpoint(getState(), { sourceId: sortedSrc.id, line: 9, column: 4 }), | ||
| "Breakpoint has correct line" | ||
| ); | ||
|
|
||
| invokeInTab("test"); | ||
|
|
||
| await waitForPaused(dbg); | ||
| assertPausedLocation(dbg); | ||
|
|
||
| await waitForDispatch(dbg, "MAP_SCOPES"); | ||
|
|
||
| is(getLabel(dbg, 1), "Block"); | ||
| is(getLabel(dbg, 2), "<this>"); | ||
| is(getLabel(dbg, 3), "na"); | ||
| is(getLabel(dbg, 4), "nb"); | ||
|
|
||
| is(getLabel(dbg, 5), "Block"); | ||
| is( | ||
| hasScopeNode(dbg, 8) && !hasScopeNode(dbg, 9), | ||
| true, | ||
| "scope count before expand" | ||
| ); | ||
| toggleNode(dbg, 5); | ||
|
|
||
| await waitForScopeNode(dbg, 9); | ||
|
|
||
| is(getLabel(dbg, 6), "ma"); | ||
| is(getLabel(dbg, 7), "mb"); | ||
|
|
||
| is( | ||
| hasScopeNode(dbg, 10) && !hasScopeNode(dbg, 11), | ||
| true, | ||
| "scope count before expand" | ||
| ); | ||
| toggleNode(dbg, 8); | ||
|
|
||
| await waitForScopeNode(dbg, 11); | ||
|
|
||
| is(getLabel(dbg, 9), "a"); | ||
| is(getLabel(dbg, 10), "arguments"); | ||
| is(getLabel(dbg, 11), "b"); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| </head> | ||
|
|
||
| <body> | ||
|
|
||
| <script type="text/javascript" src="sourcemaps3/bundle.js"></script> | ||
| <button onclick="test()">Test</button> | ||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| { "presets": [ "es2015" ] } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| node_modules/ | ||
| package-lock.json |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we move this down below add_scopes. can we move this to a different PR? b/c wasm is different and scary for some :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#4637