Closed Bug 517176 Opened 15 years ago Closed 15 years ago

Switching away from the Get Add-ons pane while it is loading thumbnails causes multiple getElementById errors

Categories

(Toolkit :: Add-ons Manager, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1
Tracking Status
status1.9.2 --- beta1-fixed

People

(Reporter: mossop, Assigned: mossop)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch rev 1 (obsolete) — Splinter Review
The Get Add-ons pane does some background loading of thumbnails for the results so it knows how big to size them in the UI. If you switch away from the pane before the load is complete then the listener monitoring it throws some errors like:

Error: document.getElementById(id) is null
Source File: chrome://mozapps/content/extensions/extensions.xml
Line: 415

Patch is pretty simple, just check the element is still in the document.
Attachment #401179 - Flags: review?(robert.bugzilla)
Comment on attachment 401179 [details] [diff] [review]
patch rev 1

>diff --git a/toolkit/mozapps/extensions/content/extensions.xml b/toolkit/mozapps/extensions/content/extensions.xml
>--- a/toolkit/mozapps/extensions/content/extensions.xml
>+++ b/toolkit/mozapps/extensions/content/extensions.xml
>@@ -451,20 +451,26 @@
>         if (this.hasAttribute("thumbwidth")) {
>           this._displayImage();
>           return;
>         }
> 
>         var image = new Image();
>         var id = this.id;
>         image.onload = function() {
>-          document.getElementById(id)._imageLoaded(image);
>+          var self = document.getElementById(id);
>+          // This element might have gone away in the meantime
>+          if (self)
>+            self._imageLoaded(image);
>         };
>         image.onerror = function() {
>-          document.getElementById(id)._hideImage();
>+          var self = document.getElementById(id);
>+          // This element might have gone away in the meantime
>+          if (self)
>+            self.._hideImage();
Should probably fix this ^
Attachment #401179 - Flags: review?(robert.bugzilla) → review-
Attached patch patch rev 2Splinter Review
Yeah let's try that again.
Attachment #401179 - Attachment is obsolete: true
Attachment #401195 - Flags: review?(robert.bugzilla)
Attachment #401195 - Flags: review?(robert.bugzilla) → review+
http://hg.mozilla.org/mozilla-central/rev/42a5cbc5c289
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
Whiteboard: [needs baking]
Comment on attachment 401195 [details] [diff] [review]
patch rev 2

This is a simple patch that cleans up a few errors in the error console, no risk.
Attachment #401195 - Flags: approval1.9.2?
Whiteboard: [needs baking]
Attachment #401195 - Flags: approval1.9.2? → approval1.9.2+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: