diff --git a/devtools/server/actors/stylesheets.js b/devtools/server/actors/stylesheets.js index 56f1673d6125..96bbd3da4535 100644 --- a/devtools/server/actors/stylesheets.js +++ b/devtools/server/actors/stylesheets.js @@ -19,6 +19,10 @@ loader.lazyRequireGetter(this, "addPseudoClassLock", loader.lazyRequireGetter(this, "removePseudoClassLock", "devtools/server/actors/highlighters/utils/markup", true); loader.lazyRequireGetter(this, "loadSheet", "devtools/shared/layout/utils", true); +loader.lazyRequireGetter(this, "ReplayDebugger", + "devtools/server/actors/replay/debugger"); +loader.lazyRequireGetter(this, "ReplayInspector", + "devtools/server/actors/replay/inspector"); var TRANSITION_PSEUDO_CLASS = ":-moz-styleeditor-transitioning"; var TRANSITION_DURATION_MS = 500; @@ -178,6 +182,13 @@ async function fetchStylesheet(sheet, consoleActor) { } } + // When replaying, fetch the stylesheets from the replaying process, so that + // we get the same sheets which were used when recording. + if (isReplaying) { + const dbg = new ReplayDebugger(); + return dbg.replayingContent(href); + } + const options = { loadFromCache: true, policy: Ci.nsIContentPolicy.TYPE_INTERNAL_STYLESHEET, @@ -227,7 +238,7 @@ var StyleSheetActor = protocol.ActorClassWithSpec(styleSheetSpec, { * Window of target */ get window() { - return this.parentActor.window; + return isReplaying ? ReplayInspector.window : this.parentActor.window; }, /** @@ -669,7 +680,8 @@ var StyleSheetsActor = protocol.ActorClassWithSpec(styleSheetsSpec, { async getStyleSheets() { let actors = []; - for (const win of this.parentActor.windows) { + const windows = isReplaying ? [ReplayInspector.window] : this.parentActor.windows; + for (const win of windows) { const sheets = await this._addStyleSheets(win); actors = actors.concat(sheets); }