New issue
Advanced search Search tips

Issue 598217 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner: ----
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocked on:
issue 611632



Sign in to add a comment

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));
 
event_var.png
7.1 KB View Download
Components: -Blink Blink>JavaScript
Does this have something to do with the window.event property being a custom field?

I can confirm this on a Pixel.
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
Cc: haraken@chromium.org jochen@chromium.org
Components: -Blink>JavaScript Blink>DOM
Sounds more DOM/Bindings related.

Comment 4 by tkent@chromium.org, Mar 31 2016

Components: -Blink>DOM Blink>Bindings

Comment 5 by bashi@chromium.org, Aug 1 2016

Cc: peria@chromium.org yukishiino@chromium.org
Status: Untriaged (was: Unconfirmed)
peria@, yukishiino@, could you triage this? (I'm not sure this is a binding issue)

Comment 6 by peria@chromium.org, Aug 25 2016

Owner: peria@chromium.org
Status: Available (was: Untriaged)

Comment 7 by peria@chromium.org, Nov 10 2016

Blockedon: 611632
Labels: -OS-Windows OS-All
Project Member

Comment 8 by sheriffbot@chromium.org, Nov 10 2017

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
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

Comment 9 by peria@chromium.org, Nov 10 2017

Status: Available (was: Untriaged)
Status: Assigned (was: Available)
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

Blockedon: 839389
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?

Comment 13 by peria@chromium.org, May 25 2018

Blockedon: -839389
Labels: Hotlist-Bindings-IDLCompiler
Owner: ----
Status: Fixed (was: Assigned)
I confirmed the fix.

Sign in to add a comment