Closed Bug 341364 Opened 19 years ago Closed 19 years ago

Regression: "Are you sure you want to navigate away from this page?" dialog at Gmail

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: ria.klaassen, Assigned: mrbkap)

References

Details

(Keywords: regression, testcase)

Attachments

(2 files, 1 obsolete file)

Since a few hours I see this message pop up everytime when I want to leave Gmail, even when it is only temporary. Steps to reproduce: - Load Gmail - Load a bookmark over it or close window or tab - Alert pops up Regression between 1.9a1_2006061216 and 1.9a1_2006061220. http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=2006-06-12+15%3A00&maxdate=2006-06-12+21%3A00 Maybe I blame the wrong bug, but bug 255942 seems the most likely to me.
Could also still be Bug 243277.
No longer blocks: dom-agnostic
Keywords: regression
Summary: Are you sure you want to navigate away from this page? :/ → Regression: "Are you sure you want to navigate away from this page?" dialog at Gmail
I've created two test builds from today, one without bug 255942 and one without both bug 255942 and bug 176182. Could you test these and see if either of them works? http://gavinsharp.com/ff/firefox-3.0a1-2006-06-13-07-no255942.zip http://gavinsharp.com/ff/firefox-3.0a1-2006-06-13-07-no255942-no176182.zip
Thank you Gavin. No problem (no alert) with the first build. So the dependency to bug 255942 can be added back again.
Blocks: dom-agnostic
Not just gmail: http://weblogs.mozillazine.org/asa/ is showing it for me, too, along with a few other sites.
On asa's blog it depends on the basicstats.js file being loaded. Further testcasing coming.
data:text/html,<script>window.onbeforeunload = function(){};</script> Minimal testcase.
Also happens in a clean profile.
Keywords: testcase
So the issue here is that nsJSEventListener::HandleEvent calls PreventDefault on any onbeforeunload event whose handler returns something not void. Or at least that's how it _used_ to work. Now we're checking for nsIDataType::VTYPE_VOID, but stuffing JSVAL_VOID into an XPCVariant makes it VTYPE_EMPTY (see XPCVariant::InitializeData). So we alert on any page that has an onbeforeunload handler. Now we could check for VTYPE_EMPTY, but then we'd treat JSVAL_NULL the same way as JSVAL_VOID. Is that desirable? What does IE do on something like: data:text/html,<body onbeforeunload="return null;"> ? I've tested, and Opera and KHTML don't seem to support onbeforeunload, so IE compat is the only issue here.
Component: JavaScript Engine → DOM: Events
Keywords: testcase
Keywords: testcase
In IE <body onbeforeunload="return null;"> will bring up a dialog on exit asking if you are sure you want to leave with the message 'null'. <body onbeforeunload="return;"> Will not pop up a dialog.
OK. So if we're going to keep IE compat here we need a way to differentiate between JSVAL_VOID and JSVAL_NULL in the variant we're using here. So either change XPCVariant, or use a different variant impl, or something.
Assignee: general → events
OS: Windows XP → All
QA Contact: general → ian
Hardware: PC → All
Attached patch Something like this (obsolete) — Splinter Review
This patch makes us distinguish between null and void in xpcvariant.
Assignee: events → mrbkap
Status: NEW → ASSIGNED
Attachment #225533 - Flags: superreview?(shaver)
Attachment #225533 - Flags: review?(bzbarsky)
Attachment #225533 - Attachment is obsolete: true
Attachment #225535 - Flags: superreview?(shaver)
Attachment #225535 - Flags: review?(bzbarsky)
Attachment #225533 - Flags: superreview?(shaver)
Attachment #225533 - Flags: review?(bzbarsky)
Comment on attachment 225535 [details] [diff] [review] Right patch, though Assuming you looked at all current consumers of TYPE_EMPTY and TYPE_VOID (do we have any?) and they're chill with this, r=bzbarsky
Attachment #225535 - Flags: review?(bzbarsky) → review+
FWIW, my lxr search shows that all consumers treat VTYPE_VOID and VTYPE_EMPTY the same. I believe an alternative change would be to have nsJSEnvironment::CallEventHandler check JSVAL_IS_VOID before calling XPConnect()->JSToVariant, but I think changing xpconnect to make the distinction is better.
Comment on attachment 225535 [details] [diff] [review] Right patch, though sr=shaver
Attachment #225535 - Flags: superreview?(shaver) → superreview+
Fix checked into trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Thanks for fixing this.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: