WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
15985
function declaration inside a statement behaves differently from Firefox, but the same as IE
https://bugs.webkit.org/show_bug.cgi?id=15985
Summary
function declaration inside a statement behaves differently from Firefox, but...
Feng Qian
Reported
2007-11-14 08:09:58 PST
In the layout test, fast/js/function-declarations-in-switch-statement.html. Function declarations in a switch statement. SpiderMonkey assigns function body to function name dynamically (only initializes the function name when the statement is executed). KJS and IE initialize the function name with the last declaration no matter the statement is executed or not. Function declaration in a statement is not part of ECMA-262. The real question is which behavior should KJS have, IE or Firefox?
Attachments
Add attachment
proposed patch, testcase, etc.
Eric Seidel (no email)
Comment 1
2007-11-19 14:54:02 PST
Generally we work hard to be compatible both, but when we have to choose: IE over firefox. The reason is generally simple market share advantage. If 80% of the web is surfing with IE, it's more likely that pages will be written to be compatible with IE than firefox. Now, I'm not certain that in this specific issue it's "correct" to follow one or the other. But if we ever were aware of this choice, we probably chose to follow IE's behavior.
Mark Rowe (bdash)
Comment 2
2007-11-19 14:55:14 PST
See
http://bugs.webkit.org/show_bug.cgi?id=8993#c9
. Without a specific real-world case for changing this, matching IE and Opera seems like the best approach for compatibility.
Eric Seidel (no email)
Comment 3
2007-11-19 14:57:22 PST
It looks like we very intentionally try to match IE's behavior here, based on the layout test you mention:
http://trac.webkit.org/projects/webkit/browser/trunk/LayoutTests/fast/js/resources/function-declarations-in-switch-statement.js
I would argue that firefox diverging from the "common behavior" is a bug on their side.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug