problem using the word event as var
Reported by
alexgorisse@gmail.com,
Mar 27 2016
|
||||||||||||
Issue description
UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Steps to reproduce the problem:
1. declaring var event = function() {}
2. then loop it
3. performance is bad
What is the expected behavior?
The loop should be fast
What went wrong?
The loop is slow when declaring the word "event". It does not happen with firefox
Did this work before? N/A
Chrome version: 49.0.2623.87 Channel: stable
OS Version: 10.0
Flash Version: Shockwave Flash 21.0 r0
var event = function() {}
var speedEvent = Date.now();
for (var i = 0; i < 1000000; i++) {
event();
}
console.log("time :" + (Date.now() - speedEvent));
var toto = function() {}
var speedToto = Date.now();
for (var i = 0; i < 1000000; i++) {
toto();
}
console.log("time :" + (Date.now() - speedToto));
,
Mar 29 2016
console.log(window.event) // --> undefined
console.log(window.toto) // --> undefined
console.log(event) // --> undefined
console.log(toto) // --> Uncaught ReferenceError: toto is not defined
When you define window and event :
var event = function() { return "test"; }
console.log(event()); // -- > "test"
var window = function() { return "test"; }
console.log(window()); // --> Uncaught TypeError: window is not a function
event is somewhere, hidden into the abysses of js...
Image the number of dev using this word on their script right now
,
Mar 30 2016
Sounds more DOM/Bindings related.
,
Mar 31 2016
,
Aug 1 2016
peria@, yukishiino@, could you triage this? (I'm not sure this is a binding issue)
,
Aug 25 2016
,
Nov 10 2016
,
Nov 10 2017
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Nov 10 2017
,
Nov 13 2017
I think that the cause is that Window's |event| attribute is NOT [Replaceable], so even when it's overwritten by author script, Blink is always performing access to an IDL attribute. [Replaceable] should solve this issue. Note that Window.event is not yet standardized, but it will be standardized soon, and then it will be [Replaceable]. See also: https://github.com/whatwg/dom/issues/334 https://github.com/whatwg/dom/commit/e7cdac7732b756f595d95007bea23eb85ebd27e5
,
May 3 2018
,
May 7 2018
Bhagirathi implemented Window.event as [Replaceable]. https://chromium.googlesource.com/chromium/src/+/41c6e170e08b2a22b1171879865d1da493fad875 I guess that this issue was resolved? Could someone verify the fix?
,
May 25 2018
,
May 25 2018
I confirmed the fix. |
||||||||||||
►
Sign in to add a comment |
||||||||||||
Comment 1 by dtapu...@chromium.org
, Mar 28 2016