https://bugzilla.wikimedia.org/show_bug.cgi?id=69924

--- Comment #10 from Michael M. <[email protected]> ---
As actually nobody explicitly quoted the relevant standards yet:

* ECMAScript defines FunctionDecleration and FunctionExpression.
(http://ecma-international.org/ecma-262/5.1/#sec-13)
* Firefox (and other browsers) extend the ECMAScript syntax, for Firefox there
is also FunctionStatement.
(https://developer.mozilla.org/en-US/docs/Web/JavaScript
/Reference/Functions_and_function_scope#Conditionally_defining_a_function)
* All these look similar, but behave differently.
* User scripts affected by this bug use functions defined as
FunctionDecleration.
* In ECMAScript a FunctionDecleration is not allowed inside a block.
* When such a user script is wrapped in an if-clause, Firefox therefor treats
the functions as FunctionStatement instead.
* This can cause errors, because functions defined as FunctionStatement can't
be called before they are defined, while this is possible for functions defined
as FunctionDecleration.
* Additionally FunctionStatements are not valid in strict mode. This isn't a
problem here, because even if the script declares strict mode globally, this
won't have any effect after it is wrapped in that if-clause (because the 'use
strict'; no longer is in the first line then). Nevertheless one shouldn't rely
on syntax extensions by different browsers.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to