Closed Bug 1297707 Opened 3 years ago Closed 3 years ago

TypeError prevents alert dialog to display icon


(Firefox :: General, defect)

Not set



Firefox 51
Tracking Status
firefox51 --- verified


(Reporter: spohl, Assigned: spohl)



(1 file, 1 obsolete file)

Run this code in the browser console:

> setTimeout(() => Services.prompt.alert(window, "Hi", null), 5000);

An alert dialog appears with a yellow triangle and exclamation point as icon.

No icon is displayed in the dialog and the following error is printed in the browser console:
TypeError: this.args.text is null[Learn More]CommonDialog.jsm:132:13

CommonDialog.prototype.onLoadresource://gre/modules/CommonDialog.jsm:132:13commonDialogOnLoadchrome://global/content/commonDialog.js:52:5<anonymous>chrome://global/content/commonDialog.xul:27:7openModalWindowfile:///Users/Stephen/Documents/objdir-ff-release/dist/<anonymous>debugger eval code
Assignee: nobody → spohl.mozilla.bugs
Attached patch PatchSplinter Review
Felipe, I see you've reviewed some code in this file but please feel free to forward the review if needed. Thank you!
Attachment #8784371 - Flags: review?(felipc)
Attached patch Patch (obsolete) — Splinter Review
Cleaned this up a bit.
Attachment #8784371 - Attachment is obsolete: true
Attachment #8784371 - Flags: review?(felipc)
Attachment #8784374 - Flags: review?(felipc)
Comment on attachment 8784371 [details] [diff] [review]

Review of attachment 8784371 [details] [diff] [review]:

Looks good, but I prefer this first version. This way the text node will always be created and the DOM structure will be the same.

Is this just clean-up, or is there any motivation for it? When would someone call a prompt without text?
Attachment #8784371 - Flags: review+
Attachment #8784371 - Attachment is obsolete: false
Attachment #8784374 - Flags: review?(felipc)
So, the following code (from comment 0) actually triggers this, and we then fail to show the icon:

> setTimeout(() => Services.prompt.alert(window, "Hi", null), 5000);

I thought "Hi" was the text in question here, but it doesn't appear to be or we wouldn't hit this.
Flags: needinfo?(felipc)
Oh, by looking at
the text is the third parameter. "Hi" is the title. They appear visually similar :)
Flags: needinfo?(felipc)
Good point, thanks for clearing that up! :-) I also went ahead and confirmed that we don't run into this same issue if the title is null but the text is a valid string; we already handle that situation properly.
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 51
Attachment #8784374 - Attachment is obsolete: true
I have reproduced this bug with Nightly 51.0a1 (2016-08-24)on Windows 8.1 (64 Bit!).

This bug's fix is verified on Latest Nightly 51.0a1.
Build ID : 20160831030224
User Agent : Mozilla/5.0 (Windows NT 6.3; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0

Thank you!
You need to log in before you can comment on or make changes to this bug.