The default bug view has changed. See this FAQ.

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

VERIFIED FIXED in Firefox 11

Status

()

Core
XPConnect
VERIFIED FIXED
5 years ago
5 years ago

People

(Reporter: mao, Assigned: Ms2ger)

Tracking

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

11 Branch
mozilla12
addon-compat, dev-doc-complete
Points:
---

Firefox Tracking Flags

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

Details

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

Attachments

(1 attachment)

(Reporter)

Description

5 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.
(Reporter)

Updated

5 years ago
Blocks: 708330
(Assignee)

Comment 1

5 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)
(Assignee)

Updated

5 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
(Assignee)

Comment 3

5 years ago
https://hg.mozilla.org/mozilla-central/rev/834bfdd83f70
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
(Assignee)

Comment 4

5 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?
(Assignee)

Updated

5 years ago
Keywords: dev-doc-needed

Comment 5

5 years ago
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+

Updated

5 years ago
Keywords: addon-compat
(Assignee)

Comment 6

5 years ago
https://hg.mozilla.org/releases/mozilla-aurora/rev/bf34343622f4
status-firefox11: affected → fixed
status-firefox12: affected → fixed

Updated

5 years ago
tracking-firefox11: ? → +
Is there something QA can do to verify this fix? possibly involving NoScript?
Whiteboard: [qa?]
(Assignee)

Comment 8

5 years ago
I believe NoScript already works around this bug.
(Reporter)

Comment 9

5 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: RESOLVED → VERIFIED
status-firefox12: fixed → verified
Whiteboard: [qa+] [testday-20120203] [qa!:11] → [qa!] [testday-20120203]
Documentation updated:

https://developer.mozilla.org/en/Components.utils.getWeakReference

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.