Bug 1544170 Part 3 - Inspector changes to fetch style sheets from replaying process, r=pbro.

Differential Revision: https://phabricator.services.mozilla.com/D27410

--HG--
extra : rebase_source : a70fc90d042f7b9d0fdec65aadff911c90f8edf7
This commit is contained in:
Brian Hackett 2019-04-12 16:36:12 -10:00
Родитель a151fd40c6
Коммит ee403cec34
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -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);
}