diff --git a/devtools/server/actors/moz.build b/devtools/server/actors/moz.build index 1ef774a7522d..29e5cb866edc 100644 --- a/devtools/server/actors/moz.build +++ b/devtools/server/actors/moz.build @@ -56,7 +56,6 @@ DevToolsModules( "storage.js", "string.js", "style-rule.js", - "style-sheet.js", "style-sheets.js", "target-configuration.js", "thread-configuration.js", diff --git a/devtools/server/actors/targets/window-global.js b/devtools/server/actors/targets/window-global.js index 7eeb0ea88040..64ecba4a042b 100644 --- a/devtools/server/actors/targets/window-global.js +++ b/devtools/server/actors/targets/window-global.js @@ -67,19 +67,18 @@ loader.lazyRequireGetter( const lazy = {}; ChromeUtils.defineModuleGetter(lazy, "ExtensionContent", EXTENSION_CONTENT_JSM); -loader.lazyRequireGetter( - this, - ["getSheetText"], - "resource://devtools/server/actors/style-sheet.js", - true -); - loader.lazyRequireGetter( this, "TouchSimulator", "resource://devtools/server/actors/emulation/touch-simulator.js", true ); +loader.lazyRequireGetter( + this, + ["getStyleSheetText"], + "resource://devtools/server/actors/utils/stylesheet-utils.js", + true +); function getWindowID(window) { return window.windowGlobalChild.innerWindowId; @@ -1246,7 +1245,7 @@ const windowGlobalTargetPrototype = { continue; } // Reparse the sheet so that we see the existing errors. - const onStyleSheetParsed = getSheetText(sheet) + const onStyleSheetParsed = getStyleSheetText(sheet) .then(text => { InspectorUtils.parseStyleSheet(sheet, text, /* aUpdate = */ false); }) diff --git a/devtools/server/actors/utils/moz.build b/devtools/server/actors/utils/moz.build index 4a75c4cab514..e9ad18ac7ade 100644 --- a/devtools/server/actors/utils/moz.build +++ b/devtools/server/actors/utils/moz.build @@ -23,6 +23,7 @@ DevToolsModules( "sources-manager.js", "stack.js", "style-utils.js", + "stylesheet-utils.js", "stylesheets-manager.js", "track-change-emitter.js", "walker-search.js", diff --git a/devtools/server/actors/style-sheet.js b/devtools/server/actors/utils/stylesheet-utils.js similarity index 58% rename from devtools/server/actors/style-sheet.js rename to devtools/server/actors/utils/stylesheet-utils.js index debf6aab1589..19456dae9e69 100644 --- a/devtools/server/actors/style-sheet.js +++ b/devtools/server/actors/utils/stylesheet-utils.js @@ -6,40 +6,20 @@ const { fetch } = require("resource://devtools/shared/DevToolsUtils.js"); -// If the user edits a style sheet, we stash a copy of the edited text -// here, keyed by the style sheet. This way, if the tools are closed -// and then reopened, the edited text will be available. A weak map -// is used so that navigation by the user will eventually cause the -// edited text to be collected. -const modifiedStyleSheets = new WeakMap(); - -function getSheetText(sheet) { - const cssText = modifiedStyleSheets.get(sheet); - if (cssText !== undefined) { - return Promise.resolve(cssText); - } - - if (!sheet.href) { - // this is an inline