Closed Bug 1230990 Opened 4 years ago Closed 3 years ago

Intermittent browser_toolbox_view_source_01.js | The correct line is highlighted in the debugger's source editor. - Got 1, expected 2

Categories

(DevTools :: General, defect)

defect
Not set

Tracking

(firefox45 affected, firefox49 fixed)

RESOLVED FIXED
Firefox 49
Tracking Status
firefox45 --- affected
firefox49 --- fixed

People

(Reporter: philor, Assigned: sjakthol)

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

Currently viewSourceInDebugger() only waits for a source to be shown if it is
not the selected one. If the requested source is selected by default, it might
already be selected when the isLoading check is made. However, the actual
source text might still be loading since it is loaded asynchronously.

In this case the method does not wait for the source to be shown meaning the
method resolves before the source is ready in the debugger. This causes
browser_toolbox_view_source_01.js to fail intermittently with wrong
line number since it looks at the focused line BEFORE the source text has
loaded and the correct line is selected.

This changeset modifies the behavior of viewSourceInDebugger() to also wait for
source shown event if the source is already selected but still loading.

Review commit: https://reviewboard.mozilla.org/r/55664/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/55664/
Attachment #8757121 - Flags: review?(jryans)
Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=0a97e950f320
Assignee: nobody → sjakthol
Status: NEW → ASSIGNED
Comment on attachment 8757121 [details]
MozReview Request: Bug 1230990 - Wait for the source text to finish loading before signaling that source has been shown in the debugger. r?ochameau

:ochameau has been working on Debugger tests recently, I think he is a better reviewer for this.
Attachment #8757121 - Flags: review?(jryans) → review?(poirot.alex)
Comment on attachment 8757121 [details]
MozReview Request: Bug 1230990 - Wait for the source text to finish loading before signaling that source has been shown in the debugger. r?ochameau

https://reviewboard.mozilla.org/r/55664/#review52854

Makes sense, thanks for figuring this out!

I just have a small code tweak to suggest...

::: devtools/client/shared/view-source.js:86
(Diff revision 1)
> +    const selected = state.sources.selectedSource;
> +    const isSelected = selected === actor;
> +
> +    // (2) Has the source text finished loading?
> +    const sourceTextInfo = getSourceText(state, selected);
> +    const isLoading = sourceTextInfo && sourceTextInfo.loading;

Shouldn't you only compute isLoading and sourceTextInfo if isSelected is true?
Otherwise you are going to compute useless things for another source.
Attachment #8757121 - Flags: review?(poirot.alex) → review+
Comment on attachment 8757121 [details]
MozReview Request: Bug 1230990 - Wait for the source text to finish loading before signaling that source has been shown in the debugger. r?ochameau

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/55664/diff/1-2/
Attachment #8757121 - Attachment description: MozReview Request: Bug 1230990 - Wait for the source text to finish loading before signaling that source has been shown in the debugger. r?jryans → MozReview Request: Bug 1230990 - Wait for the source text to finish loading before signaling that source has been shown in the debugger. r?ochameau
Wrapped the second check to an if-clause. Let's see how that went: https://treeherder.mozilla.org/#/jobs?repo=try&revision=e3b44d9bb79f
Hmm... Bugzilla says r+, reviewboard r?. Could you take a look at the changes?
Flags: needinfo?(poirot.alex)
Flags: needinfo?(poirot.alex)
Looks good.

FYI, see bug 1276073 where I apply similar fix to all debugger tests.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/fx-team/rev/b30ef0b6848b
Wait for the source text to finish loading before signaling that source has been shown in the debugger. r=ochameau
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/b30ef0b6848b
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 49
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.