Closed Bug 993435 Opened 10 years ago Closed 10 years ago

Crash getting 'navigator.connection' from closed window

Categories

(Core :: DOM: Core & HTML, defect)

x86_64
macOS
defect
Not set
critical

Tracking

()

VERIFIED FIXED
mozilla31
Tracking Status
firefox31 - ---

People

(Reporter: jruderman, Assigned: johnshih.bugs)

References

Details

(Keywords: crash, testcase)

Crash Data

Attachments

(4 files)

      No description provided.
Attachment #8403330 - Attachment description: testcase (crashes Firefox when loaded) → testcase (requires popups) (crashes Firefox when loaded)
Attached file manual testcase
Attached file stack
bp-1ebe5cd6-3690-404e-a0d0-787532140408
Crash Signature: [@ mozilla::dom::WrapNewBindingObjectHelper<nsRefPtr<mozilla::dom::network::Connection>, true>::Wrap(JSContext*, JS::Handle<JSObject*>, nsRefPtr<mozilla::dom::network::Connection> const&, JS::MutableHandle<JS::Value>) ]
This is a regression from bug 960426.  In particular, this change:

    1.16 -  readonly attribute MozConnection? mozConnection;
    1.18 +  readonly attribute NetworkInformation connection;

but the actual getter can in fact return null, no?

     NS_ENSURE_TRUE(mWindow->GetDocShell(), nullptr);
Flags: needinfo?(jshih)
Blocks: 960426
(In reply to Boris Zbarsky [:bz] from comment #4)
> This is a regression from bug 960426.  In particular, this change:
> 
>     1.16 -  readonly attribute MozConnection? mozConnection;
>     1.18 +  readonly attribute NetworkInformation connection;
> 
> but the actual getter can in fact return null, no?
> 
>      NS_ENSURE_TRUE(mWindow->GetDocShell(), nullptr);

It's a bug, I'll fix it.
Assignee: nobody → jshih
Flags: needinfo?(jshih)
I think we should make this [Throws] and throw an exception in the error condition.
(In reply to :Ehsan Akhgari (lagging on bugmail, needinfo? me!) from comment #6)
> I think we should make this [Throws] and throw an exception in the error
> condition.

Yeah, I think we already do that. The bug is due to I didn't remove "NS_ENSURE_TRUE(mWindow->GetDocShell(), nullptr);" as Boris pointed out when change the API to non-nullable.
I've verified the crash isn't reproducible after applying the patch.
Attachment #8403728 - Flags: review?(bzbarsky)
Can you have a double check? Thanks very much!
Flags: needinfo?(jruderman)
Comment on attachment 8403728 [details] [diff] [review]
Bug 993435 - Not return null for navigator.connection. r=bz

r=me as long as the Connection object doesn't depend on there being a docshell.
Attachment #8403728 - Flags: review?(bzbarsky) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/fc31b43ccafe
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Since this is not a regression and has been resolved not going to track this
LGTM
Status: RESOLVED → VERIFIED
Flags: needinfo?(jruderman)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: