Components.utils.getWeakReference(null) should fail silently (as it used to do)

VERIFIED FIXED in Firefox 11



7 years ago
7 years ago


(Reporter: mao, Assigned: Ms2ger)


({addon-compat, dev-doc-complete})

11 Branch
addon-compat, dev-doc-complete

Firefox Tracking Flags

(firefox8 unaffected, firefox9 unaffected, firefox10 unaffected, firefox11+ verified, firefox12 verified)


(Whiteboard: [qa!] [testday-20120203])


(1 attachment)



7 years ago
In 11 and above Components.utils.getWeakReference(null) throws NS_ERROR_FAILURE.
It used to fail silently instead, so it's probably breaking some clients (NoScript, for instance).
Also, since the value held by a weak reference will eventually be null anyway, allowing clients pass null may be seen as more consistent.


7 years ago
Blocks: 708330

Comment 1

7 years ago
Created attachment 583499 [details] [diff] [review]
Components.utils.getWeakReference(null) should fail silently;

I think it makes sense to allow this, but we should probably keep propagating other exceptions.
Attachment #583499 - Flags: review?(bobbyholley+bmo)


7 years ago
Assignee: nobody → Ms2ger
Target Milestone: --- → mozilla11
Comment on attachment 583499 [details] [diff] [review]
Components.utils.getWeakReference(null) should fail silently;

Looks good. r=bholley

We should get this in for 11 too, otherwise it sounds like we'll break extensions.
Attachment #583499 - Flags: review?(bobbyholley+bmo) → review+
status-firefox10: --- → unaffected
status-firefox11: --- → affected
status-firefox12: --- → affected
status-firefox8: --- → unaffected
status-firefox9: --- → unaffected
tracking-firefox11: --- → ?
Target Milestone: mozilla11 → ---
Version: Trunk → 11 Branch

Comment 3

7 years ago
Last Resolved: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12

Comment 4

7 years ago
Comment on attachment 583499 [details] [diff] [review]
Components.utils.getWeakReference(null) should fail silently;

This is a regression from bug 708330, which broke NoScript. The patch should be safe.
Attachment #583499 - Flags: approval-mozilla-aurora?


7 years ago
Keywords: dev-doc-needed
Comment on attachment 583499 [details] [diff] [review]
Components.utils.getWeakReference(null) should fail silently;

[Triage Comment]
Approved for Aurora given the risk of regressing add-ons.
Attachment #583499 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Keywords: addon-compat

Comment 6

7 years ago
status-firefox11: affected → fixed
status-firefox12: affected → fixed
tracking-firefox11: ? → +
Is there something QA can do to verify this fix? possibly involving NoScript?
Whiteboard: [qa?]

Comment 8

7 years ago
I believe NoScript already works around this bug.

Comment 9

7 years ago
(In reply to Ms2ger from comment #8)
> I believe NoScript already works around this bug.

Yes it does.

You can verify by running the following in the Error Console or in a chrome-scoped scratchpad:

try { alert("OK (" + Components.utils.getWeakReference(null) + ")") } catch(e) { alert("FAIL") }
Whiteboard: [qa?] → [qa+]
Mozilla/5.0 (Windows NT 5.1; rv:11.0) Gecko/20100101 Firefox/11.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11.0) Gecko/20100101 Firefox/11.0
Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20100101 Firefox/11.0

Verified using guideline in comment 9 on Ubuntu 11.10, Mac OS 10.6, Windows XP (Firefox 11 beta 1). No failures.
All resulted in the following message in the Error Console:
"OK ([xpconnect wrapped xpcIJSWeakReference])"
status-firefox11: fixed → verified
Whiteboard: [qa+] → [qa+] [testday-20120203] [qa!:11]
Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20100101 Firefox/12.0
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:12.0) Gecko/20100101 Firefox/12.0
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0

Marking verified after checking on Firefox 12 beta 3 with the same guidelines from comment 9. 
Result: "OK ([xpconnect wrapped xpcIJSWeakReference])"
status-firefox12: fixed → verified
Whiteboard: [qa+] [testday-20120203] [qa!:11] → [qa!] [testday-20120203]
Documentation updated:

Listed on Firefox 12 for developers.
Keywords: dev-doc-needed → dev-doc-complete
You need to log in before you can comment on or make changes to this bug.