Bug 1366823 - Use DevToolsShim to call Scratchpad APIs from SessionStore.jsm;r=mikedeboer
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 24 May 2017 20:50:23 +0200
changeset 361110 f39ea1fb1be510633bca4cfe7cf57b9506831e39
parent 361109 4d8182ea2319cc481a3d74dded1dcd02d0fc48cb
child 361111 db30ab06e9a79b72476197cc18f28d373dcabf51
push id31917
push usercbook@mozilla.com
push dateTue, 30 May 2017 09:14:52 +0000
treeherdermozilla-central@0c712d76d598 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmikedeboer
bugs1366823
milestone55.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
Bug 1366823 - Use DevToolsShim to call Scratchpad APIs from SessionStore.jsm;r=mikedeboer DevTools are moving out of mozilla-central and m-c code should only rely on the DevToolsShim that will remain available in m-c after the migration. This changeset updates SessionStore.jsm to call the DevToolsShim instead of the scratchpadmanager. The actual underlying implementation is the same when devtools are installed and no-ops when they are not. MozReview-Commit-ID: Fv22TtjJiDw
browser/components/sessionstore/SessionStore.jsm
--- a/browser/components/sessionstore/SessionStore.jsm
+++ b/browser/components/sessionstore/SessionStore.jsm
@@ -176,18 +176,18 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 XPCOMUtils.defineLazyModuleGetter(this, "AppConstants",
   "resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "GlobalState",
   "resource:///modules/sessionstore/GlobalState.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivacyFilter",
   "resource:///modules/sessionstore/PrivacyFilter.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "RunState",
   "resource:///modules/sessionstore/RunState.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ScratchpadManager",
-  "resource://devtools/client/scratchpad/scratchpad-manager.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "DevToolsShim",
+  "chrome://devtools-shim/content/DevToolsShim.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "SessionSaver",
   "resource:///modules/sessionstore/SessionSaver.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "SessionCookies",
   "resource:///modules/sessionstore/SessionCookies.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "SessionFile",
   "resource:///modules/sessionstore/SessionFile.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
   "resource://gre/modules/Timer.jsm");
@@ -2752,17 +2752,17 @@ var SessionStoreInternal = {
     // Merge closed windows from this session with ones from last session
     if (lastSessionState._closedWindows) {
       this._closedWindows = this._closedWindows.concat(lastSessionState._closedWindows);
       this._capClosedWindows();
       this._closedObjectsChanged = true;
     }
 
     if (lastSessionState.scratchpads) {
-      ScratchpadManager.restoreSession(lastSessionState.scratchpads);
+      DevToolsShim.restoreScratchpadSession(lastSessionState.scratchpads);
     }
 
     // Set data that persists between sessions
     this._recentCrashes = lastSessionState.session &&
                           lastSessionState.session.recentCrashes || 0;
 
     // Update the session start time using the restored session state.
     this._updateSessionStartTime(lastSessionState);
@@ -3120,22 +3120,19 @@ var SessionStoreInternal = {
       _closedWindows: lastClosedWindowsCopy,
       session,
       global: this._globalState.getState()
     };
 
     // Collect and store session cookies.
     state.cookies = SessionCookies.collect();
 
-    if (Cu.isModuleLoaded("resource://devtools/client/scratchpad/scratchpad-manager.jsm")) {
-      // get open Scratchpad window states too
-      let scratchpads = ScratchpadManager.getSessionState();
-      if (scratchpads && scratchpads.length) {
-        state.scratchpads = scratchpads;
-      }
+    let scratchpads = DevToolsShim.getOpenedScratchpads();
+    if (scratchpads && scratchpads.length) {
+      state.scratchpads = scratchpads;
     }
 
     // Persist the last session if we deferred restoring it
     if (LastSession.canRestore) {
       state.lastSessionState = LastSession.getState();
     }
 
     // If we were called by the SessionSaver and started with only a private
@@ -3467,17 +3464,17 @@ var SessionStoreInternal = {
           this.windowToFocus = window;
         }
       }
     }
 
     this.restoreWindow(aWindow, root.windows[0], aOptions);
 
     if (aState.scratchpads) {
-      ScratchpadManager.restoreSession(aState.scratchpads);
+      DevToolsShim.restoreScratchpadSession(aState.scratchpads);
     }
   },
 
   /**
    * Manage history restoration for a window
    * @param aWindow
    *        Window to restore the tabs into
    * @param aTabs