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
--- 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