JavaScript error - Notification is not defined
Categories
(Core :: DOM: Push Subscriptions, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox70 | --- | affected |
People
(Reporter: krzysztof.glebowicz, Unassigned)
Details
Attachments
(1 file)
193 bytes,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0
Steps to reproduce:
- This bug looks like Win7 specific
- Run the following code:
try
{
var pushPermission=Notification.permission;
alert(pushPermission);
}
catch (err)
{
alert(err.message);
}
Actual results:
Win10: blocked
Win7: Notification is not defined
Expected results:
I'd expect (for instance): alert(blocked) on Win7.
This bug breaks this site: https://my.xe.gr/login?from=myxe_new_landing
Comment 1•5 years ago
|
||
Hi Krzysztof,
Can you be more detailed? I imagine that the code is missing the header and footer, can you give me a complete file? (You may attach it). Also, once I have this file, all I have to do it is open it with Firefox, right?
On the other hand, I was able to access the site both with Windows 10 and Windows 7 without problems. On what step does it fail?
Thanks in advance, Flor.
Hi Florencia,
testcase is attached. It may be nessesary to set dom.webnotifications.enabled = false.
On the other hand, I was able to access the site both with Windows 10 and Windows 7 without problems. On what step does it fail?
On win7 there is an error in the Console: ReferenceError: Notification is not defined. When you enter some characters in both fields and press the button beneath, nothing is happening.
Comment 4•5 years ago
|
||
Hi Krzysztof,
Thank you very much for the details. I was able to reproduce the bug on Windows 7 64 bits using release 68.0.1 (64-bit). I've chosen a component. If you consider that there's another component that's more proper for this case you may change it.
Best regards, Flor.
Updated•5 years ago
|
Comment 5•5 years ago
|
||
Hi Krzysztof, thanks for the report! Setting dom.webnotifications.enabled
to false
hides the Notification
constructor from the page, so this is expected behavior. Unfortunately, that means sites that don't use a feature check, like if ("Notification" in window) { let p = Notification.permission; /* ... */ }
, will break. 😕
Can you repro without that pref set?
(And, if you'd like to stop sites from asking permission to show notifications, you can open about:preferences#privacy
, scroll down to "Permissions", click "Settings...", and check "Block new requests asking to allow notifications").
Thanks for explanations, Lina. It works as expected.
One more thing. This page https://my.xe.gr/login?from=myxe_new_landing works fine with dom.webnotifications.enabled = false
in the private mode. This is quite strange for me, but perhaps in this mode page doesn't ask for this permission at all.
This bug can be resolved as INVALID.
Comment 7•5 years ago
|
||
(marking invalid per comment 6)
Description
•