Use ES5 strict mode for Panorama

RESOLVED FIXED in Firefox 8

Status

Firefox Graveyard
Panorama
RESOLVED FIXED
6 years ago
a year ago

People

(Reporter: ttaubert, Assigned: ttaubert)

Tracking

Trunk
Firefox 8

Details

Attachments

(1 attachment, 1 obsolete attachment)

Comment hidden (empty)
(Assignee)

Updated

6 years ago
OS: Linux → All
Hardware: x86_64 → All
(Assignee)

Comment 1

6 years ago
Created attachment 547410 [details] [diff] [review]
patch v1
Attachment #547410 - Flags: feedback?(raymond)
Comment on attachment 547410 [details] [diff] [review]
patch v1

>--- a/browser/base/content/tabview/modules/utils.jsm
>+++ b/browser/base/content/tabview/modules/utils.jsm

>+    function tanh(x) {
>+      var e = Math.exp(x);
>+      return (e - 1/e) / (e + 1/e);
>+    }
>+
>     if (smooth) {
>       // The ease function ".5+.5*Math.tanh(4*x-2)" is a pretty
>       // little graph. It goes from near 0 at x=0 to near 1 at x=1
>       // smoothly and beautifully.
>       // http://www.wolframalpha.com/input/?i=.5+%2B+.5+*+tanh%28%284+*+x%29+-+2%29
>-      function tanh(x) {
>-        var e = Math.exp(x);
>-        return (e - 1/e) / (e + 1/e);
>-      }
>       return .5 - .5 * tanh(2 - 4 * proportion);
>     }

>--- a/browser/base/content/tabview/search.js
>+++ b/browser/base/content/tabview/search.js

>+  function dispatchTabViewSearchEnabledEvent() {
>+    let newEvent = document.createEvent("Events");
>+    newEvent.initEvent("tabviewsearchenabled", false, false);
>+    dispatchEvent(newEvent);
>+  }
>+
>   if (!isSearchEnabled()) {
>     $searchShade.show();
>     $search.show();
> 
> #ifdef XP_MACOSX
>     UI.setTitlebarColors({active: "#717171", inactive: "#EDEDED"});
> #endif
> 
>     // NOTE: when this function is called by keydown handler, next keypress
>     // event or composition events of IME will be fired on the focused editor.
>-
>-    function dispatchTabViewSearchEnabledEvent() {
>-      let newEvent = document.createEvent("Events");
>-      newEvent.initEvent("tabviewsearchenabled", false, false);
>-      dispatchEvent(newEvent);
>-    };

That's annoying. What rule enforces this?
(Assignee)

Comment 3

6 years ago
This one:

http://whereswalden.com/2011/01/24/new-es5-strict-mode-requirement-function-statements-not-at-top-level-of-a-program-or-function-are-prohibited/
Again, annoying. Does let foo = function ... work?
(Assignee)

Comment 5

6 years ago
Created attachment 547523 [details] [diff] [review]
patch v2

(In reply to comment #4)
> Again, annoying. Does let foo = function ... work?

Yep, it does.
Attachment #547410 - Attachment is obsolete: true
Attachment #547523 - Flags: feedback?(raymond)
Attachment #547410 - Flags: feedback?(raymond)
(Assignee)

Updated

6 years ago
Attachment #547523 - Flags: feedback?(raymond) → review?(dao)
Comment on attachment 547523 [details] [diff] [review]
patch v2

> function observer(subject, topic, data) {
>   switch (topic) {
>     case "domwindowopened":
>-      subject.addEventListener("load", function() {
>-        subject.removeEventListener("load", arguments.callee, false);
>+      subject.addEventListener("load", function onLoad() {
>+        subject.removeEventListener("load", onLoad, false);

I wonder where this makes onLoad available, exactly, and why this doesn't bother strict mode.
Attachment #547523 - Flags: review?(dao) → review+
(Assignee)

Comment 7

6 years ago
(In reply to comment #6)
> I wonder where this makes onLoad available, exactly, and why this doesn't
> bother strict mode.

In this case it's a function expression (not a function definition) and so the name of it is bound locally inside the function, but not outside.
(Assignee)

Comment 8

6 years ago
http://hg.mozilla.org/integration/fx-team/rev/f79f1ea87e2c
Whiteboard: [fixed-in-fx-team]
(Assignee)

Updated

6 years ago
Depends on: 673804
(Assignee)

Comment 9

6 years ago
http://hg.mozilla.org/mozilla-central/rev/f79f1ea87e2c
Status: ASSIGNED → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
(Assignee)

Updated

6 years ago
Target Milestone: --- → Firefox 8
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.