Closed Bug 1447012 Opened 7 years ago Closed 7 years ago

Use waitForNewTab instead of progress listener in addJsonViewTab

Categories

(DevTools :: JSON Viewer, enhancement)

enhancement
Not set
normal

Tracking

(firefox61 fixed)

RESOLVED FIXED
Firefox 61
Tracking Status
firefox61 --- fixed

People

(Reporter: Oriol, Assigned: Oriol)

References

Details

Attachments

(2 files, 1 obsolete file)

addJsonViewTab uses a progress listener which is a bit ugly. BrowserTestUtils.waitForNewTab does basically the same thing but the code becomes clearer.
Attached image server-error.png
@Oriol, can you please update the patch I can't publish it from some reason. I am seeing HTTP 500 INTERNAL SERVER ERROR any time I press the review "Publish" button. Otherwise, the patch looks good. Honza
Attachment #8960183 - Attachment is obsolete: true
Attachment #8960183 - Flags: review?(odvarko)
I also thought it was strange that two mozreview-request comments appeared, and in rb the title of the patch was not shown.
Comment on attachment 8960226 [details] Bug 1447012 - Use waitForNewTab instead of progress listener in addJsonViewTab https://reviewboard.mozilla.org/r/228988/#review234706 Thanks for the patch! R+ assuming try is green Honza
Attachment #8960226 - Flags: review?(odvarko) → review+
Keywords: checkin-needed
Pushed by shindli@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/41097954197f Use waitForNewTab instead of progress listener in addJsonViewTab r=Honza
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 61
Product: Firefox → DevTools

I'm not sure I understand this change. Now we're racing two separate tab loads against each other and using whichever one happens to return back to us first? Why do we do that?

Flags: needinfo?(oriol-bugzilla)
Flags: needinfo?(odvarko)

If I remember correctly, the test browser_jsonview_content_type.js uses some invalid content types. Some of them just trigger a download instead of loading anything, and then one of these promises didn't resolve. And the other promise also had some problems in other cases, like resolving too late or something. So I decided to use them both.

Flags: needinfo?(oriol-bugzilla)

OK, then this code should probably document exactly what it's doing and why, since it's doing two very different loads with different conditions on resolving and then just using whichever of them resolves first, as if it did not matter what the conditions are, etc...

@Oriol: can you please file a follow up and provide detailed comment that explains the logic, thanks!

Honza

Flags: needinfo?(odvarko) → needinfo?(oriol-bugzilla)
See Also: → 1603962
Flags: needinfo?(oriol-bugzilla)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: