Closed Bug 1598752 Opened 5 years ago Closed 4 years ago

TypeError: undefined is not a constructor

Categories

(Core :: IPC, task)

task
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: surkov, Assigned: jdai)

Details

Attachments

(1 file)

There's a way to break a browser to make JS console (and terminal) errors are rather useless: no file, no line. For example,

TypeError: undefined is not a constructor

STRs:

  • make not existing export in toolkit/actors, for example:

diff --git a/toolkit/actors/AutoCompleteChild.jsm b/toolkit/actors/AutoCompleteChild.jsm
--- a/toolkit/actors/AutoCompleteChild.jsm
+++ b/toolkit/actors/AutoCompleteChild.jsm
@@ -1,14 +1,14 @@
/* -- indent-tabs-mode: nil; js-indent-level: 2 -- /
/
This Source Code Form is subject to the terms of the Mozilla Public

-var EXPORTED_SYMBOLS = ["AutoCompleteChild"];
+var EXPORTED_SYMBOLS = ["AutoCompleteChildThrowError"];

I suppose no matter what, but console should show somewhat useful information. Otherwise no idea where to look what's broken.

Edgar, is DOM: Binding a better module for this issue? Any thoughts? Thank you.

Flags: needinfo?(echen)

It is about error reporting for .jsm, it doesn't look like belonging to DOM: Binding, maybe XPConnect.
Please feel free to switch to the right component if I am wrong.

Component: General → XPConnect
Flags: needinfo?(echen)

This is coming from WindowGlobalActor::ConstructActor (https://searchfox.org/mozilla-central/rev/c7b673f443407a359cc0766fb5a4ac323a1d2628/dom/ipc/WindowGlobalActor.cpp#119). Maybe we should check for undefined and report an error before calling JS::Construct?

Component: XPConnect → IPC
Flags: needinfo?(nika)
Flags: needinfo?(jdai)

(In reply to Peter Van der Beken [:peterv] from comment #3)

This is coming from WindowGlobalActor::ConstructActor (https://searchfox.org/mozilla-central/rev/c7b673f443407a359cc0766fb5a4ac323a1d2628/dom/ipc/WindowGlobalActor.cpp#119). Maybe we should check for undefined and report an error before calling JS::Construct?

Yes, put it to my queue, I'll handle that.

Flags: needinfo?(nika)
Flags: needinfo?(jdai)
Assignee: nobody → jdai
Status: NEW → ASSIGNED
Pushed by jdai@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cf32a7162c2b
Provide useful information while constructing JSWindowActor; r=nika
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla74
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: