Closed
Bug 1192536
Opened 9 years ago
Closed 9 years ago
NodeActor.getImageData() should wait for image to finish loading before generating the preview
Categories
(DevTools :: Inspector, defect)
DevTools
Inspector
Tracking
(firefox43 fixed)
RESOLVED
FIXED
Firefox 43
Tracking | Status | |
---|---|---|
firefox43 | --- | fixed |
People
(Reporter: sjakthol, Assigned: sjakthol)
References
Details
Attachments
(2 files, 2 obsolete files)
8.77 KB,
patch
|
sjakthol
:
review+
|
Details | Diff | Splinter Review |
13.86 KB,
patch
|
pbro
:
review+
|
Details | Diff | Splinter Review |
I was poking around the inspector code and noticed that NodeActor.getImageData() does not ensure the image is loaded before the preview is generated. If the image happens to be loading when the data is requested, it could lead to intermittent bugs that are hard to reproduce and debug. IMO it'd make sense to wait for the load to complete before the preview is generated. However, there should be a timeout similar to InspectorActor.getImageDataFromURL() method after which the preview generation aborts with a clear reason to avoid blocking the actor for too long periods.
Assignee | ||
Comment 1•9 years ago
|
||
The Inspector related actors have two methods for extracting image data: InspectorActor.getImageDataFromURL() and NodeActor.getImageData(). Since they both use imageToImageData() method to generate the actual data-uri and are only users of that method this patch modifies imageToImageData to wait for the image to load before generating the data-uri. It extracts the load-detection logic from getImageDataFromURL(), cleans it up a bit and makes it work with images that have already finished loading.
Assignee: nobody → sjakthol
Attachment #8648337 -
Flags: review?(pbrosset)
Assignee | ||
Comment 2•9 years ago
|
||
Here's a few server side tests for both getImageData() and getImageDataFromURL(). Try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=171765d04a20
Attachment #8648338 -
Flags: review?(pbrosset)
Comment 3•9 years ago
|
||
Comment on attachment 8648337 [details] [diff] [review] bug-1192536-wait-for-images-to-load-1.patch Review of attachment 8648337 [details] [diff] [review]: ----------------------------------------------------------------- r+, no remarks at all, the code is simpler, and easier to read. Thanks.
Attachment #8648337 -
Flags: review?(pbrosset) → review+
Comment 4•9 years ago
|
||
Comment on attachment 8648338 [details] [diff] [review] bug-1192536-wait-for-images-to-load-2-tests.patch Review of attachment 8648338 [details] [diff] [review]: ----------------------------------------------------------------- Why choose browser mochitest over chrome mochitest here? We already have a bunch of inspector-related server tests in toolkit/devtools/server/tests/mochitest which are chrome mochitests. I like chrome test because they run in the content process (with chrome privileges) so it's easy to access content objects when needed. But I don't like them because they are in HTML pages, which makes them more verbose, harder to read. So I don't see any big reason to choose one over the other (unless maybe one is faster to run), but I would tend to keep all inspector-server tests in one test dir, rather than start creating new tests in a different directory. Apart from this, the tests look ok to me. So let's just have a discussion about where they should go and I'll R+.
Attachment #8648338 -
Flags: review?(pbrosset)
Assignee | ||
Comment 5•9 years ago
|
||
Oh, I didn't even remember that those existed. Anyway, it really does make sense to keep all the tests in the same place. I'll modify the tests!
Assignee | ||
Comment 6•9 years ago
|
||
A new patch with updated commit message.
Attachment #8648337 -
Attachment is obsolete: true
Attachment #8650280 -
Flags: review+
Assignee | ||
Comment 7•9 years ago
|
||
Here are the tests as chrome mochitests. Pending try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=32568bd37aca
Attachment #8648338 -
Attachment is obsolete: true
Attachment #8650282 -
Flags: review?(pbrosset)
Updated•9 years ago
|
Attachment #8650282 -
Flags: review?(pbrosset) → review+
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
https://hg.mozilla.org/integration/fx-team/rev/57b63992d0c2 https://hg.mozilla.org/integration/fx-team/rev/b6def4e57d9c
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/57b63992d0c2 https://hg.mozilla.org/mozilla-central/rev/b6def4e57d9c
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox43:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Updated•6 years ago
|
Product: Firefox → DevTools
You need to log in
before you can comment on or make changes to this bug.
Description
•