Merge mozilla-central to mozilla-inbound
authorIris Hsiao <ihsiao@mozilla.com>
Wed, 22 Feb 2017 16:18:56 +0800
changeset 344211 13a54cc4d8be58afabb3078c6ba5f4241dd396f4
parent 344210 12302127707b1b30a86969e9db2b99d0820dafb5 (current diff)
parent 344096 9a9db410f20781076424307265decbc5de1e94cc (diff)
child 344212 94e98e7e32276f5e55c452d93e09e8a82101b601
push id31402
push usercbook@mozilla.com
push dateWed, 22 Feb 2017 13:33:50 +0000
treeherdermozilla-central@f5372cb6c3c7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone54.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 mozilla-central to mozilla-inbound
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -826,17 +826,16 @@ def compiler(language, host_or_target, c
 c_compiler = compiler('C', target)
 cxx_compiler = compiler('C++', target, c_compiler=c_compiler)
 host_c_compiler = compiler('C', host, other_compiler=c_compiler)
 host_cxx_compiler = compiler('C++', host, c_compiler=host_c_compiler,
                              other_compiler=cxx_compiler,
                              other_c_compiler=c_compiler)
 
 # Generic compiler-based conditions.
-building_with_msvc = depends(c_compiler)(lambda info: info.type == 'msvc')
 non_msvc_compiler = depends(c_compiler)(lambda info: info.type != 'msvc')
 building_with_gcc = depends(c_compiler)(lambda info: info.type == 'gcc')
 
 include('compile-checks.configure')
 
 @depends(have_64_bit,
          try_compile(body='static_assert(sizeof(void *) == 8, "")',
                      check_msg='for 64-bit OS'))
@@ -963,43 +962,13 @@ def wrap_system_includes(target, visibil
 
 set_define('HAVE_VISIBILITY_HIDDEN_ATTRIBUTE',
            depends(visibility_flags)(lambda v: bool(v) or None))
 set_define('HAVE_VISIBILITY_ATTRIBUTE',
            depends(visibility_flags)(lambda v: bool(v) or None))
 set_config('WRAP_SYSTEM_INCLUDES', wrap_system_includes)
 set_config('VISIBILITY_FLAGS', visibility_flags)
 
-@depends(c_compiler, using_sccache)
-def depend_cflags(c_compiler, using_sccache):
-    if c_compiler.type in ('gcc', 'clang'):
-        return '-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
-    elif c_compiler.type == 'msvc' and using_sccache:
-        # sccache supports a special flag to create depfiles
-        # by parsing MSVC's -showIncludes output.
-        return '-deps$(MDDEPDIR)/$(@F).pp'
-
-set_config('_DEPEND_CFLAGS', depend_cflags)
-
-@depends(c_compiler, when=building_with_msvc)
-@imports(_from='re', _import='compile', _as='re_compile')
-def msvc_showincludes_prefix(c_compiler):
-    pattern = re_compile(r'^([^:]*:.*[ :] )(.*\\stdio.h)$')
-    output = try_invoke_compiler([c_compiler.compiler], 'C', '#include <stdio.h>\n',
-                                 ['-nologo', '-c', '-Fonul', '-showIncludes'])
-    for line in output.splitlines():
-        if line.endswith('\\stdio.h'):
-            m = pattern.match(line)
-            if m:
-                if not m.group(2):
-                    die("Unable to parse cl -showIncludes prefix. " +
-                        "This compiler's locale has an unsupported formatting.")
-                return m.group(1)
-    # We should have found the prefix and returned earlier
-    die('Cannot find cl -showIncludes prefix.')
-
-set_config('CL_INCLUDES_PREFIX', msvc_showincludes_prefix)
-
 @depends(target)
 def is_windows(target):
     return target.kernel == 'WINNT'
 
 include('windows.configure', when=is_windows)
--- a/build/mozconfig.cache
+++ b/build/mozconfig.cache
@@ -108,16 +108,36 @@ if test -z "$bucket"; then
         ac_add_options --with-ccache
     esac
 else
     if ! test -e $topsrcdir/sccache2/sccache${suffix}; then
         echo "sccache2 missing in the tooltool manifest" >&2
         exit 1
     fi
     mk_add_options "export SCCACHE_BUCKET=$bucket"
+    case "$master" in
+    *us[ew][12].mozilla.com*|*euc1.mozilla.com*)
+        mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
+        ;;
+    esac
     ac_add_options "--with-ccache=$topsrcdir/sccache2/sccache${suffix}"
     export SCCACHE_VERBOSE_STATS=1
     mk_add_options MOZ_PREFLIGHT_ALL+=build/sccache.mk
     mk_add_options MOZ_POSTFLIGHT_ALL+=build/sccache.mk
     mk_add_options "UPLOAD_EXTRA_FILES+=sccache.log.gz"
+    case "$platform" in
+    win*)
+        # sccache supports a special flag to create depfiles.
+        #TODO: bug 1318370 - move this all into toolchain.configure
+        export _DEPEND_CFLAGS='-deps$(MDDEPDIR)/$(@F).pp'
+        # Windows builds have a default wrapper that needs to be overridden
+        mk_add_options "export CC_WRAPPER="
+        mk_add_options "export CXX_WRAPPER="
+        # For now, sccache doesn't support separate PDBs so force debug info to be
+        # in object files.
+        mk_add_options "export COMPILE_PDB_FLAG="
+        mk_add_options "export HOST_PDB_FLAG="
+        mk_add_options "export MOZ_DEBUG_FLAGS=-Z7"
+        ;;
+    esac
 fi
 
 fi
--- a/config/config.mk
+++ b/config/config.mk
@@ -115,20 +115,18 @@ else
   win_srcdir := $(srcdir)
   BUILD_TOOLS = $(MOZILLA_DIR)/build/unix
 endif
 
 CONFIG_TOOLS	= $(MOZ_BUILD_ROOT)/config
 AUTOCONF_TOOLS	= $(MOZILLA_DIR)/build/autoconf
 
 ifdef _MSC_VER
-ifndef MOZ_USING_SCCACHE
 CC_WRAPPER ?= $(call py_action,cl)
 CXX_WRAPPER ?= $(call py_action,cl)
-endif
 endif # _MSC_VER
 
 CC := $(CC_WRAPPER) $(CC)
 CXX := $(CXX_WRAPPER) $(CXX)
 MKDIR ?= mkdir
 SLEEP ?= sleep
 TOUCH ?= touch
 
@@ -620,8 +618,12 @@ ifdef GNU_CC
 OBJ_SUFFIX := i_o
 endif
 endif
 endif
 
 PLY_INCLUDE = -I$(MOZILLA_DIR)/other-licenses/ply
 
 export CL_INCLUDES_PREFIX
+# Make sure that the build system can handle non-ASCII characters
+# in environment variables to prevent it from breking silently on
+# non-English systems.
+export NONASCII
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -151,20 +151,16 @@ endif # FORCE_SHARED_LIB
 endif # LIBRARY
 
 ifeq ($(OS_ARCH),WINNT)
 ifndef GNU_CC
 
 COMPILE_PDB_FLAG ?= -Fd$(basename $(@F)).pdb
 COMPILE_CFLAGS += $(COMPILE_PDB_FLAG)
 COMPILE_CXXFLAGS += $(COMPILE_PDB_FLAG)
-ifdef MOZ_USING_SCCACHE
-# We remove the PDB file before compilation so that sccache knows it's safe to cache.
-RM_PDB_FILE = -$(RM) $(basename $(@F)).pdb
-endif
 
 LINK_PDBFILE ?= $(basename $(@F)).pdb
 ifdef MOZ_DEBUG
 CODFILE=$(basename $(@F)).cod
 endif
 
 ifdef DEFFILE
 OS_LDFLAGS += -DEF:$(call normalizepath,$(DEFFILE))
@@ -849,38 +845,33 @@ crate_src_libdep = $(call mk_global_crat
 $(foreach f,$(RSSRCS),$(eval $(call src_libdep,$(f))))
 $(foreach f,$(RS_STATICLIB_CRATE_SRC),$(eval $(call crate_src_libdep,$(f))))
 
 $(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
 
 # Rules for building native targets must come first because of the host_ prefix
 $(HOST_COBJS):
 	$(REPORT_BUILD_VERBOSE)
-	$(RM_PDB_FILE)
 	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CPPOBJS):
 	$(REPORT_BUILD_VERBOSE)
 	$(call BUILDSTATUS,OBJECT_FILE $@)
-	$(RM_PDB_FILE)
 	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CMOBJS):
 	$(REPORT_BUILD_VERBOSE)
-	$(RM_PDB_FILE)
 	$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(HOST_CMMOBJS):
 	$(REPORT_BUILD_VERBOSE)
-	$(RM_PDB_FILE)
 	$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CPPFLAGS) $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
 
 $(COBJS):
 	$(REPORT_BUILD_VERBOSE)
-	$(RM_PDB_FILE)
 	$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
 
 # DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs:
 # 'moc' only knows about #defines it gets on the command line (-D...), not in
 # included headers like mozilla-config.h
 $(filter moc_%.cpp,$(CPPSRCS)): moc_%.cpp: %.h
 	$(REPORT_BUILD_VERBOSE)
 	$(ELOG) $(MOC) $(DEFINES) $(ACDEFINES) $< $(OUTOPTION)$@
@@ -1002,27 +993,24 @@ endif # MOZ_RUST
 
 $(SOBJS):
 	$(REPORT_BUILD)
 	$(AS) -o $@ $(DEFINES) $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) -c $<
 
 $(CPPOBJS):
 	$(REPORT_BUILD_VERBOSE)
 	$(call BUILDSTATUS,OBJECT_FILE $@)
-	$(RM_PDB_FILE)
 	$(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
 
 $(CMMOBJS):
 	$(REPORT_BUILD_VERBOSE)
-	$(RM_PDB_FILE)
 	$(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
 
 $(CMOBJS):
 	$(REPORT_BUILD_VERBOSE)
-	$(RM_PDB_FILE)
 	$(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
 
 $(filter %.s,$(CPPSRCS:%.cpp=%.s)): %.s: %.cpp $(call mkdir_deps,$(MDDEPDIR))
 	$(REPORT_BUILD_VERBOSE)
 	$(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(_VPATH_SRCS)
 
 $(filter %.s,$(CPPSRCS:%.cc=%.s)): %.s: %.cc $(call mkdir_deps,$(MDDEPDIR))
 	$(REPORT_BUILD_VERBOSE)
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1873,16 +1873,56 @@ fi
 fi # ! SKIP_COMPILER_CHECKS
 
 AC_DEFINE(CPP_THROW_NEW, [throw()])
 AC_LANG_C
 
 MOZ_EXPAND_LIBS
 
 dnl ========================================================
+dnl =
+dnl = Build depencency options
+dnl =
+dnl ========================================================
+MOZ_ARG_HEADER(Build dependencies)
+
+if test "$GNU_CC" -a "$GNU_CXX"; then
+  _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
+else
+  dnl Don't override this for MSVC
+  if test -z "$_WIN32_MSVC"; then
+    _USE_CPP_INCLUDE_FLAG=
+    _DEFINES_CFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
+    _DEFINES_CXXFLAGS='$(ACDEFINES) -D_JS_CONFDEFS_H_ -DMOZILLA_CLIENT'
+  else
+    echo '#include <stdio.h>' > dummy-hello.c
+    changequote(,)
+    dnl This output is localized, split at the first double space or colon and space.
+    _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
+    CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
+    _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
+    changequote([,])
+    if ! test -e "$_CL_STDIO_PATH"; then
+        AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
+    fi
+    if test -z "$CL_INCLUDES_PREFIX"; then
+        AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
+    fi
+    AC_SUBST(CL_INCLUDES_PREFIX)
+    rm -f dummy-hello.c
+
+    dnl Make sure that the build system can handle non-ASCII characters
+    dnl in environment variables to prevent it from breaking silently on
+    dnl non-English systems.
+    NONASCII=$'\241\241'
+    AC_SUBST(NONASCII)
+  fi
+fi
+
+dnl ========================================================
 dnl = Link js shell to system readline
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(readline,
 [  --enable-readline       Link js shell to system readline library],
     JS_WANT_READLINE=1,
     JS_WANT_READLINE= )
 
 JS_BUNDLED_EDITLINE=
@@ -2009,16 +2049,17 @@ COMPILE_CXXFLAGS=`echo \
     $COMPILE_CXXFLAGS`
 
 HOST_CFLAGS=`echo \
     $HOST_CFLAGS`
 
 HOST_CXXFLAGS=`echo \
     $HOST_CXXFLAGS`
 
+AC_SUBST(_DEPEND_CFLAGS)
 AC_SUBST(MOZ_SYSTEM_NSPR)
 
 OS_CFLAGS="$CFLAGS"
 OS_CXXFLAGS="$CXXFLAGS"
 OS_CPPFLAGS="$CPPFLAGS"
 OS_COMPILE_CFLAGS="$COMPILE_CFLAGS"
 OS_COMPILE_CXXFLAGS="$COMPILE_CXXFLAGS"
 OS_LDFLAGS="$LDFLAGS"
--- a/mobile/android/chrome/content/browser.js
+++ b/mobile/android/chrome/content/browser.js
@@ -3429,16 +3429,20 @@ nsBrowserAccess.prototype = {
 
 
 function Tab(aURL, aParams) {
   this.filter = null;
   this.browser = null;
   this.id = 0;
   this._parentId = -1;
   this.lastTouchedAt = Date.now();
+  this._zoom = 1.0;
+  this._drawZoom = 1.0;
+  this._restoreZoom = false;
+  this.userScrollPos = { x: 0, y: 0 };
   this.contentDocumentIsDisplayed = true;
   this.pluginDoorhangerTimeout = null;
   this.shouldShowPluginDoorhanger = true;
   this.clickToPlayPluginsActivated = false;
   this.desktopMode = false;
   this.originalURI = null;
   this.hasTouchListener = false;
   this.playingAudio = false;
@@ -4504,47 +4508,76 @@ Tab.prototype = {
     // notifications using nsBrowserStatusFilter.
   },
 
   onStatusChange: function(aBrowser, aWebProgress, aRequest, aStatus, aMessage) {
     // Note: aWebProgess and aRequest will be NULL since we are filtering webprogress
     // notifications using nsBrowserStatusFilter.
   },
 
-  OnHistoryNewEntry: function(newURI, oldIndex) {
-    Services.obs.notifyObservers(this.browser, "Content:HistoryChange", null);
-  },
-
-  OnHistoryGoBack: function(backURI) {
-    Services.obs.notifyObservers(this.browser, "Content:HistoryChange", null);
-    return true;
-  },
-
-  OnHistoryGoForward: function(forwardURI) {
-    Services.obs.notifyObservers(this.browser, "Content:HistoryChange", null);
+  _getGeckoZoom: function() {
+    let res = {};
+    let cwu = this.browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
+    cwu.getResolution(res);
+    let zoom = res.value * window.devicePixelRatio;
+    return zoom;
+  },
+
+  saveSessionZoom: function(aZoom) {
+    let cwu = this.browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
+    cwu.setResolutionAndScaleTo(aZoom / window.devicePixelRatio);
+  },
+
+  restoredSessionZoom: function() {
+    let cwu = this.browser.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
+
+    if (this._restoreZoom && cwu.isResolutionSet) {
+      return this._getGeckoZoom();
+    }
+    return null;
+  },
+
+  _updateZoomFromHistoryEvent: function(aHistoryEventName) {
+    // Restore zoom only when moving in session history, not for new page loads.
+    this._restoreZoom = aHistoryEventName !== "New";
+  },
+
+  OnHistoryNewEntry: function(aUri) {
+    this._updateZoomFromHistoryEvent("New");
+  },
+
+  OnHistoryGoBack: function(aUri) {
+    this._updateZoomFromHistoryEvent("Back");
     return true;
   },
 
-  OnHistoryReload: function(reloadURI, reloadFlags) {
-    Services.obs.notifyObservers(this.browser, "Content:HistoryChange", null);
+  OnHistoryGoForward: function(aUri) {
+    this._updateZoomFromHistoryEvent("Forward");
     return true;
   },
 
-  OnHistoryGotoIndex: function(index, gotoURI) {
-    Services.obs.notifyObservers(this.browser, "Content:HistoryChange", null);
+  OnHistoryReload: function(aUri, aFlags) {
+    // we don't do anything with this, so don't propagate it
+    // for now anyway
     return true;
   },
 
-  OnHistoryPurge: function(numEntries) {
-    Services.obs.notifyObservers(this.browser, "Content:HistoryChange", null);
+  OnHistoryGotoIndex: function(aIndex, aUri) {
+    this._updateZoomFromHistoryEvent("Goto");
     return true;
   },
 
-  OnHistoryReplaceEntry: function(index) {
-    Services.obs.notifyObservers(this.browser, "Content:HistoryChange", null);
+  OnHistoryPurge: function(aNumEntries) {
+    this._updateZoomFromHistoryEvent("Purge");
+    return true;
+  },
+
+  OnHistoryReplaceEntry: function(aIndex) {
+    // we don't do anything with this, so don't propogate it
+    // for now anyway.
   },
 
   ShouldNotifyMediaPlaybackChange: function(inactive) {
     // We don't want to show the media control interface for the short sound
     // which duration is smaller than the threshold. The basic unit is second.
     // Note : the streaming format's duration is infinite.
     const mediaDurationThreshold = 1.0;
 
@@ -4616,16 +4649,20 @@ Tab.prototype = {
 
   // nsIBrowserTab
   get window() {
     if (!this.browser)
       return null;
     return this.browser.contentWindow;
   },
 
+  get scale() {
+    return this._zoom;
+  },
+
   QueryInterface: XPCOMUtils.generateQI([
     Ci.nsIWebProgressListener,
     Ci.nsISHistoryListener,
     Ci.nsIObserver,
     Ci.nsISupportsWeakReference,
     Ci.nsIBrowserTab
   ])
 };
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -178,17 +178,16 @@ SessionStore.prototype = {
         observerService.addObserver(this, "domwindowclosed", true);
         observerService.addObserver(this, "browser:purge-session-history", true);
         observerService.addObserver(this, "browser:purge-session-tabs", true);
         observerService.addObserver(this, "quit-application-requested", true);
         observerService.addObserver(this, "quit-application-proceeding", true);
         observerService.addObserver(this, "quit-application", true);
         observerService.addObserver(this, "Session:Restore", true);
         observerService.addObserver(this, "Session:NotifyLocationChange", true);
-        observerService.addObserver(this, "Content:HistoryChange", true);
         observerService.addObserver(this, "Tab:KeepZombified", true);
         observerService.addObserver(this, "application-background", true);
         observerService.addObserver(this, "application-foreground", true);
         observerService.addObserver(this, "ClosedTabs:StartNotifications", true);
         observerService.addObserver(this, "ClosedTabs:StopNotifications", true);
         observerService.addObserver(this, "last-pb-context-exited", true);
         observerService.addObserver(this, "Session:RestoreRecentTabs", true);
         observerService.addObserver(this, "Tabs:OpenMultiple", true);
@@ -309,37 +308,16 @@ SessionStore.prototype = {
         }
 
         if (browser.__SS_restoreDataOnLocationChange) {
           delete browser.__SS_restoreDataOnLocationChange;
           this._restoreZoom(browser.__SS_data.scrolldata, browser);
         }
         break;
       }
-      case "Content:HistoryChange": {
-        let browser = aSubject;
-        let window = browser.ownerGlobal;
-        log("Content:HistoryChange for tab " + window.BrowserApp.getTabForBrowser(browser).id);
-        // We want to ignore history changes which we caused ourselves when
-        // restoring the history of a delay-loaded tab.
-        if (!browser.__SS_restore && !browser.__SS_restoreReloadPending) {
-          // The OnHistory... notifications are called *before* the history changes
-          // are persisted. We therefore need to make our onTabLoad call async,
-          // so it can actually capture the new session history state.
-          if (browser.__SS_historyChange) {
-            window.clearTimeout(browser.__SS_historyChange);
-          }
-          browser.__SS_historyChange =
-            window.setTimeout(() => {
-              delete browser.__SS_historyChange;
-              this.onTabLoad(window, browser);
-            }, 0);
-        }
-        break;
-      }
       case "Tabs:OpenMultiple": {
         let data = JSON.parse(aData);
 
         this._openTabs(data);
 
         if (data.shouldNotifyTabsOpenedToJava) {
           let window = Services.wm.getMostRecentWindow("navigator:browser");
           window.WindowEventDispatcher.sendRequest({
@@ -636,21 +614,16 @@ SessionStore.prototype = {
     aBrowser.removeEventListener("pageshow", this, true);
     aBrowser.removeEventListener("AboutReaderContentReady", this, true);
     aBrowser.removeEventListener("change", this, true);
     aBrowser.removeEventListener("input", this, true);
     aBrowser.removeEventListener("DOMAutoComplete", this, true);
     aBrowser.removeEventListener("scroll", this, true);
     aBrowser.removeEventListener("resize", this, true);
 
-    if (aBrowser.__SS_historyChange) {
-      aWindow.clearTimeout(aBrowser.__SS_historyChange);
-      delete aBrowser.__SS_historyChange;
-    }
-
     delete aBrowser.__SS_data;
 
     log("onTabRemove() ran for tab " + aWindow.BrowserApp.getTabForBrowser(aBrowser).id +
         ", aNoNotification = " + aNoNotification);
     if (!aNoNotification) {
       this.saveStateDelayed();
     }
   },
@@ -1661,22 +1634,22 @@ SessionStore.prototype = {
       if (parentId > -1) {
         tab.parentId = parentId;
       }
 
       tab.browser.__SS_data = tabData;
       tab.browser.__SS_extdata = tabData.extData;
 
       if (window.BrowserApp.selectedTab == tab) {
-        // After we're done restoring, we can lift the general ban on tab data
-        // capturing, but we still need to protect the foreground tab until we're
+        this._restoreTab(tabData, tab.browser);
+
+        // We can now lift the general ban on tab data capturing,
+        // but we still need to protect the foreground tab until we're
         // sure it's actually reloading after history restoring has finished.
         tab.browser.__SS_restoreReloadPending = true;
-
-        this._restoreTab(tabData, tab.browser);
         this._startupRestoreFinished = true;
         log("startupRestoreFinished = true");
 
         delete tab.browser.__SS_restore;
         tab.browser.removeAttribute("pending");
       } else {
         // Mark the browser for delay loading
         tab.browser.__SS_restore = true;
--- a/mobile/android/tests/browser/chrome/test_session_form_data.html
+++ b/mobile/android/tests/browser/chrome/test_session_form_data.html
@@ -220,21 +220,17 @@ add_task(function* test_formdata_navigat
       // Visit a different page.
       gBrowserApp.loadURI(otherURL, browser);
       yield promiseBrowserEvent(browser, "DOMContentLoaded");
       is(browser.currentURI.spec, otherURL, "navigated to a different page");
 
       // Go back.
       is(browser.canGoBack, true, "can go back");
       browser.goBack();
-
-      let titleChange = promiseTabEvent(browser, "DOMTitleChanged");
-      let tabDataUpdate = promiseTabEvent(browser, "SSTabDataUpdated");
-      yield titleChange;
-      yield tabDataUpdate;
+      yield promiseTabEvent(browser, "SSTabDataUpdated");
       is(browser.currentURI.spec, URL, "navigated back to form data page");
 
       // Make sure form data is still present.
       is(getInputValue(browser, {id: "txt"}), OUTER_VALUE, "outer value present after navigation");
       is(getInputValue(browser, {id: "txt", frame: 0}), INNER_VALUE, "inner value present after navigation");
 
       // Remove the tab.
       gBrowserApp.closeTab(tab);
--- a/old-configure.in
+++ b/old-configure.in
@@ -4685,16 +4685,56 @@ AC_DEFINE(CPP_THROW_NEW, [throw()])
 AC_LANG_C
 
 if test "$COMPILE_ENVIRONMENT"; then
 MOZ_EXPAND_LIBS
 fi # COMPILE_ENVIRONMENT
 
 dnl ========================================================
 dnl =
+dnl = Build depencency options
+dnl =
+dnl ========================================================
+MOZ_ARG_HEADER(Build dependencies)
+
+if test "$GNU_CC" -a "$GNU_CXX"; then
+  _DEPEND_CFLAGS='-MD -MP -MF $(MDDEPDIR)/$(@F).pp'
+else
+  dnl Don't override this for MSVC
+  if test -z "$_WIN32_MSVC"; then
+    _USE_CPP_INCLUDE_FLAG=
+    _DEFINES_CFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
+    _DEFINES_CXXFLAGS='$(ACDEFINES) -D_MOZILLA_CONFIG_H_ -DMOZILLA_CLIENT'
+  else
+    echo '#include <stdio.h>' > dummy-hello.c
+    changequote(,)
+    dnl This output is localized, split at the first double space or colon and space.
+    _CL_PREFIX_REGEX="^\([^:]*:.*[ :] \)\(.*\\\stdio.h\)$"
+    CL_INCLUDES_PREFIX=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\1/p'`
+    _CL_STDIO_PATH=`${CC} -showIncludes -c -Fonul dummy-hello.c 2>&1 | sed -ne 's/'"$_CL_PREFIX_REGEX"'/\2/p'`
+    changequote([,])
+    if ! test -e "$_CL_STDIO_PATH"; then
+        AC_MSG_ERROR([Unable to parse cl -showIncludes prefix. This compiler's locale has an unsupported formatting.])
+    fi
+    if test -z "$CL_INCLUDES_PREFIX"; then
+        AC_MSG_ERROR([Cannot find cl -showIncludes prefix.])
+    fi
+    AC_SUBST(CL_INCLUDES_PREFIX)
+    rm -f dummy-hello.c
+
+    dnl Make sure that the build system can handle non-ASCII characters
+    dnl in environment variables to prevent it from breaking silently on
+    dnl non-English systems.
+    NONASCII=$'\241\241'
+    AC_SUBST(NONASCII)
+  fi
+fi
+
+dnl ========================================================
+dnl =
 dnl = Static Build Options
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(Static build options)
 
 if test -z "$MOZ_SYSTEM_ZLIB"; then
 if test -n "$JS_SHARED_LIBRARY"; then
   ZLIB_IN_MOZGLUE=1
@@ -5301,16 +5341,17 @@ COMPILE_CXXFLAGS=`echo \
     $COMPILE_CXXFLAGS`
 
 HOST_CFLAGS=`echo \
     $HOST_CFLAGS`
 
 HOST_CXXFLAGS=`echo \
     $HOST_CXXFLAGS`
 
+AC_SUBST(_DEPEND_CFLAGS)
 AC_SUBST(MOZ_SYSTEM_JPEG)
 AC_SUBST(MOZ_SYSTEM_PNG)
 AC_SUBST(MOZ_SYSTEM_BZ2)
 
 AC_SUBST_LIST(MOZ_JPEG_CFLAGS)
 AC_SUBST_LIST(MOZ_JPEG_LIBS)
 AC_SUBST_LIST(MOZ_BZ2_CFLAGS)
 AC_SUBST_LIST(MOZ_BZ2_LIBS)
--- a/widget/android/nsIAndroidBridge.idl
+++ b/widget/android/nsIAndroidBridge.idl
@@ -4,16 +4,17 @@
 
 #include "nsISupports.idl"
 
 interface mozIDOMWindowProxy;
 
 [scriptable, uuid(e8420a7b-659b-4325-968b-a114a6a067aa)]
 interface nsIBrowserTab : nsISupports {
   readonly attribute mozIDOMWindowProxy window;
+  readonly attribute float scale;
 };
 
 [scriptable, uuid(08426a73-e70b-4680-9282-630932e2b2bb)]
 interface nsIUITelemetryObserver : nsISupports {
   void startSession(in wstring name,
                     in long long timestamp);
   void stopSession(in wstring name,
                    in wstring reason,