Last Comment Bug 673104 - Use ES5 strict mode for Panorama
: Use ES5 strict mode for Panorama
Status: RESOLVED FIXED
:
Product: Firefox Graveyard
Classification: Graveyard
Component: Panorama (show other bugs)
: Trunk
: All All
-- normal
: Firefox 8
Assigned To: Tim Taubert [:ttaubert]
:
:
Mentors:
Depends on: 673804
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-21 06:27 PDT by Tim Taubert [:ttaubert]
Modified: 2016-04-12 14:00 PDT (History)
1 user (show)
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch v1 (16.19 KB, patch)
2011-07-21 09:05 PDT, Tim Taubert [:ttaubert]
no flags Details | Diff | Splinter Review
patch v2 (15.56 KB, patch)
2011-07-21 14:40 PDT, Tim Taubert [:ttaubert]
dao+bmo: review+
Details | Diff | Splinter Review

Description User image Tim Taubert [:ttaubert] 2011-07-21 06:27:40 PDT

    
Comment 1 User image Tim Taubert [:ttaubert] 2011-07-21 09:05:48 PDT
Created attachment 547410 [details] [diff] [review]
patch v1
Comment 2 User image Dão Gottwald [:dao] 2011-07-21 09:08:56 PDT
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?
Comment 4 User image Dão Gottwald [:dao] 2011-07-21 09:24:39 PDT
Again, annoying. Does let foo = function ... work?
Comment 5 User image Tim Taubert [:ttaubert] 2011-07-21 14:40:43 PDT
Created attachment 547523 [details] [diff] [review]
patch v2

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

Yep, it does.
Comment 6 User image Dão Gottwald [:dao] 2011-07-23 07:47:56 PDT
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.
Comment 7 User image Tim Taubert [:ttaubert] 2011-07-23 07:55:51 PDT
(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.
Comment 8 User image Tim Taubert [:ttaubert] 2011-07-23 08:11:29 PDT
http://hg.mozilla.org/integration/fx-team/rev/f79f1ea87e2c
Comment 9 User image Tim Taubert [:ttaubert] 2011-07-25 06:47:07 PDT
http://hg.mozilla.org/mozilla-central/rev/f79f1ea87e2c

Note You need to log in before you can comment on or make changes to this bug.