Note: There are a few cases of duplicates in user autocompletion which are being worked on.

The function assigned to window.ononline gets called when the online event is fired (same for window.onoffline)

RESOLVED FIXED in mozilla1.9alpha8



10 years ago
10 years ago


(Reporter: Nickolay_Ponomarev, Assigned: jst)



Windows XP
Bug Flags:
blocking1.9 +
in-testsuite ?

Firefox Tracking Flags

(Not tracked)



(2 attachments)



10 years ago
Created attachment 264723 [details]
unclean testcase; no FAIL lines indicates success

See bug 336682 comment 24 and the attached testcase.

From comment 24:
> Er, really?  Does that break pages that try to have a |var ononline| or that
> assign something like a number to a global ononline variable?  See bug 336359
> comment 12.
> If it does, is that really what we want?

The testcase here indicates that window.ononline/onoffline is treated like a handler when assigned a function, albeit with the quirkiness of bug 380538.

I don't see how this breaks pages that assign numbers/booleans to global vars named ononline/onoffline, but I could have missed something.


10 years ago
Depends on: 336682

Comment 1

10 years ago
If it doesn't break such pages (i.e. if the properties are replaceable), then I don't think we have a problem, really...  Need to figure out whether it does break them or not, basically.
Flags: blocking1.9?
If there are other ways for authors to do this, do we really want to pollute the global namespace every time we add new events?

Comment 3

10 years ago
(In reply to comment #1)
> If it doesn't break such pages (i.e. if the properties are replaceable)

Well, what I did was doing
var ononline = 1;
directly in a <script> and then checking the value later in a load handler (after the testcase triggers the events, not that it should matter). Anything else needs to be checked?

If you have a list of uses we shouldn't break with new window.on* handleres, they could be turned into a mochitest.
Jst will figure out what to do :)
Assignee: general → jst
Flags: blocking1.9? → blocking1.9+

Comment 5

10 years ago
content/events/test/test_bug336682.js has 'todo()'s because of this bug. However this bug is resolved, that test should be updated.
Flags: in-testsuite?
Setting to B1 per conversation with JST.
Target Milestone: --- → mozilla1.9beta1

Comment 7

10 years ago
Per discussion with Chris Double and Dave Camp, we'll be removing the support for window.ononline and window.onoffline in favor of the standard and more flexible window.addEventListener() method of registering listeners for these new events. Patch coming up.

Comment 8

10 years ago
Created attachment 270792 [details] [diff] [review]
Fix, remove support for window.on{on|off}line
Attachment #270792 - Flags: superreview?(jonas)
Attachment #270792 - Flags: review?(chris.double)


10 years ago
Attachment #270792 - Flags: review?(chris.double) → review+
Attachment #270792 - Flags: superreview?(jonas) → superreview+

Comment 9

10 years ago
Fix checked in.
Last Resolved: 10 years ago
Resolution: --- → FIXED

Comment 10

10 years ago
With this patch, did we stop supporting |body.ononline = function () {}| as well?  If so, is that what we want to do?
You need to log in before you can comment on or make changes to this bug.