Merge f-t to m-c
authorPhil Ringnalda <philringnalda@gmail.com>
Sat, 15 Feb 2014 18:28:12 -0800
changeset 169049 ed8c916743a2dff35c7446e6ad9d1596f071dca4
parent 169044 3a37d3be57fa1b014c8ed72ac2cdcb84f9c02f1e (current diff)
parent 169048 494ca694e7686c31db24633c63ee1c2a3903667a (diff)
child 169062 252a41942fc746a9e48d24d00dc2320146b4db13
push id26227
push userphilringnalda@gmail.com
push dateSun, 16 Feb 2014 02:28:22 +0000
treeherdermozilla-central@ed8c916743a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge f-t to m-c
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -812,17 +812,17 @@ pref("browser.snippets.updateInterval", 
 
 // URL used to check for user's country code
 pref("browser.snippets.geoUrl", "https://geo.mozilla.org/country.json");
 
 // URL used to ping metrics with stats about which snippets have been shown
 pref("browser.snippets.statsUrl", "https://snippets-stats.mozilla.org/mobile");
 
 // These prefs require a restart to take effect.
-pref("browser.snippets.enabled", false);
+pref("browser.snippets.enabled", true);
 pref("browser.snippets.syncPromo.enabled", false);
 
 #ifdef MOZ_ANDROID_SYNTHAPKS
 // The URL of the APK factory from which we obtain APKs for webapps.
 // This currently points to the development server.
 pref("browser.webapps.apkFactoryUrl", "http://dapk.net/application.apk");
 
 // How frequently to check for webapp updates, in seconds (86400 is daily).
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -2975,36 +2975,21 @@ Tab.prototype = {
     }
 
     // Only reload the page for http/https schemes
     let currentURI = this.browser.currentURI;
     if (!currentURI.schemeIs("http") && !currentURI.schemeIs("https"))
       return;
 
     let url = currentURI.spec;
-    let flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE;
+    let flags = Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE |
+                Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
     if (this.originalURI && !this.originalURI.equals(currentURI)) {
       // We were redirected; reload the original URL
       url = this.originalURI.spec;
-      flags |= Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
-    } else {
-      // Many sites use mobile-specific URLs, such as:
-      //   http://m.yahoo.com
-      //   http://www.google.com/m
-      // If the user clicks "Request Desktop Site" while on a mobile site, it
-      // will appear to do nothing since the mobile URL is still being
-      // requested. To address this, we do the following:
-      //   1) Remove the path from the URL (http://www.google.com/m?q=query -> http://www.google.com)
-      //   2) If a host subdomain is "m", remove it (http://en.m.wikipedia.org -> http://en.wikipedia.org)
-      // This means the user is sent to site's home page, but this is better
-      // than the setting having no effect at all.
-      if (aDesktopMode)
-        url = currentURI.prePath.replace(/([\/\.])m\./g, "$1");
-      else
-        flags |= Ci.nsIWebNavigation.LOAD_FLAGS_REPLACE_HISTORY;
     }
 
     this.browser.docShell.loadURI(url, flags, null, null, null);
   },
 
   destroy: function() {
     if (!this.browser)
       return;
--- a/mobile/android/components/Snippets.js
+++ b/mobile/android/components/Snippets.js
@@ -317,16 +317,20 @@ function Snippets() {}
 
 Snippets.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsITimerCallback]),
   classID: Components.ID("{a78d7e59-b558-4321-a3d6-dffe2f1e76dd}"),
 
   observe: function(subject, topic, data) {
     switch(topic) {
       case "profile-after-change":
+        Services.obs.addObserver(this, "browser-delayed-startup-finished", false);
+        break;
+      case "browser-delayed-startup-finished":
+        Services.obs.removeObserver(this, "browser-delayed-startup-finished", false);
         if (Services.prefs.getBoolPref("browser.snippets.syncPromo.enabled")) {
           loadSyncPromoBanner();
         }
 
         if (Services.prefs.getBoolPref("browser.snippets.enabled")) {
           loadSnippetsFromCache();
         }
         break;
--- a/toolkit/devtools/pretty-fast/pretty-fast.js
+++ b/toolkit/devtools/pretty-fast/pretty-fast.js
@@ -189,17 +189,17 @@
     "(": true
   };
 
   /**
    * Determines if Automatic Semicolon Insertion (ASI) occurs between these
    * tokens.
    *
    * @param Object token
-   *        The token we want to determine if it is an array literal.
+   *        The current token.
    * @param Object lastToken
    *        The last token we added to the pretty printed results.
    *
    * @returns Boolean
    *          True if we believe ASI occurs.
    */
   function isASI(token, lastToken) {
     if (!lastToken) {
@@ -213,16 +213,40 @@
     }
     if (PREVENT_ASI_BEFORE_TOKENS[token.type.type || token.type.keyword]) {
       return false;
     }
     return true;
   }
 
   /**
+   * Determine if we have encountered a getter or setter.
+   *
+   * @param Object token
+   *        The current token. If this is a getter or setter, it would be the
+   *        property name.
+   * @param Object lastToken
+   *        The last token we added to the pretty printed results. If this is a
+   *        getter or setter, it would be the `get` or `set` keyword
+   *        respectively.
+   * @param Array stack
+   *        The stack of open parens/curlies/brackets/etc.
+   *
+   * @returns Boolean
+   *          True if this is a getter or setter.
+   */
+  function isGetterOrSetter(token, lastToken, stack) {
+    return stack[stack.length - 1] == "{"
+      && lastToken
+      && lastToken.type.type == "name"
+      && (lastToken.value == "get" || lastToken.value == "set")
+      && token.type.type == "name";
+  }
+
+  /**
    * Determine if we should add a newline after the given token.
    *
    * @param Object token
    *        The token we are looking at.
    * @param Array stack
    *        The stack of open parens/curlies/brackets/etc.
    *
    * @returns Boolean
@@ -354,22 +378,23 @@
    * @param Array stack
    *        The stack of open curlies, brackets, etc.
    */
   function prependWhiteSpace(token, lastToken, addedNewline, write, options,
                              indentLevel, stack) {
     var ttk = token.type.keyword;
     var ttt = token.type.type;
     var newlineAdded = addedNewline;
+    var ltt = lastToken ? lastToken.type.type : null;
 
     // Handle whitespace and newlines after "}" here instead of in
     // `isLineDelimiter` because it is only a line delimiter some of the
     // time. For example, we don't want to put "else if" on a new line after
     // the first if's block.
-    if (lastToken && lastToken.type.type == "}") {
+    if (lastToken && ltt == "}") {
       if (ttk == "while" && stack[stack.length - 1] == "do") {
         write(" ",
               lastToken.startLoc.line,
               lastToken.startLoc.column);
       } else if (ttk == "else" ||
                  ttk == "catch" ||
                  ttk == "finally") {
         write(" ",
@@ -382,23 +407,29 @@
                  ttt != ".") {
         write("\n",
               lastToken.startLoc.line,
               lastToken.startLoc.column);
         newlineAdded = true;
       }
     }
 
+    if (isGetterOrSetter(token, lastToken, stack)) {
+      write(" ",
+            lastToken.startLoc.line,
+            lastToken.startLoc.column);
+    }
+
     if (ttt == ":" && stack[stack.length - 1] == "?") {
       write(" ",
             lastToken.startLoc.line,
             lastToken.startLoc.column);
     }
 
-    if (lastToken && lastToken.type.type != "}" && ttk == "else") {
+    if (lastToken && ltt != "}" && ttk == "else") {
       write(" ",
             lastToken.startLoc.line,
             lastToken.startLoc.column);
     }
 
     function ensureNewline() {
       if (!newlineAdded) {
         write("\n",
--- a/toolkit/devtools/pretty-fast/tests/unit/test.js
+++ b/toolkit/devtools/pretty-fast/tests/unit/test.js
@@ -1,16 +1,17 @@
 /*
  * Copyright 2013 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.md or:
  * http://opensource.org/licenses/BSD-2-Clause
  */
 var prettyFast = this.prettyFast || require("./pretty-fast");
 
 var testCases = [
+
   {
     name: "Simple function",
     input: "function foo() { bar(); }",
     output: "function foo() {\n" +
             "  bar();\n" +
             "}\n",
     mappings: [
       // function foo() {
@@ -426,16 +427,29 @@ var testCases = [
 
   {
     name: "Non-ASI new",
     input: "new\n" +
            "F()",
     output: "new F()\n"
   },
 
+  {
+    name: "Getter and setter literals",
+    input: "var obj={get foo(){return this._foo},set foo(v){this._foo=v}}",
+    output: "var obj = {\n" +
+            "  get foo() {\n" +
+            "    return this._foo\n" +
+            "  },\n" +
+            "  set foo(v) {\n" +
+            "    this._foo = v\n" +
+            "  }\n" +
+            "}\n"
+  },
+
 ];
 
 var sourceMap = this.sourceMap || require("source-map");
 
 function run_test() {
   testCases.forEach(function (test) {
     console.log(test.name);
 
@@ -463,11 +477,12 @@ function run_test() {
     }
   });
   console.log("✓ All tests pass!");
 }
 
 // Only run the tests if this is node and we are running this file
 // directly. (Firefox's test runner will import this test file, and then call
 // run_test itself.)
-if (typeof exports == "object") {
+if (typeof require == "function" && typeof module == "object"
+    && require.main === module) {
   run_test();
 }