зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1470035: Don't reparse cssom sheets, and warn about the reparse being lossy. r=jryans
MozReview-Commit-ID: 7j7Tyej0oYn --HG-- extra : rebase_source : dd5966a2a9779175f88ae7448aa337155fe65dcd
This commit is contained in:
Родитель
2fea1fc725
Коммит
cf10dc032e
|
@ -35,6 +35,10 @@ const InspectorUtils = require("InspectorUtils");
|
|||
|
||||
const EXTENSION_CONTENT_JSM = "resource://gre/modules/ExtensionContent.jsm";
|
||||
|
||||
const { LocalizationHelper } = require("devtools/shared/l10n");
|
||||
const STRINGS_URI = "devtools/shared/locales/browsing-context.properties";
|
||||
const L10N = new LocalizationHelper(STRINGS_URI);
|
||||
|
||||
const { ActorClassWithSpec, Actor } = require("devtools/shared/protocol");
|
||||
const { browsingContextTargetSpec } = require("devtools/shared/specs/targets/browsing-context");
|
||||
|
||||
|
@ -1055,11 +1059,24 @@ const browsingContextTargetPrototype = {
|
|||
// Shadow DOM / XBL.
|
||||
const sheets =
|
||||
InspectorUtils.getAllStyleSheets(docShell.document, /* documentOnly = */ true);
|
||||
const promises = [];
|
||||
for (const sheet of sheets) {
|
||||
getSheetText(sheet, this._consoleActor).then(text => {
|
||||
InspectorUtils.parseStyleSheet(sheet, text, /* aUpdate = */ false);
|
||||
});
|
||||
if (InspectorUtils.hasRulesModifiedByCSSOM(sheet)) {
|
||||
continue;
|
||||
}
|
||||
// Reparse the sheet so that we see the existing errors.
|
||||
promises.push(getSheetText(sheet, this._consoleActor).then(text => {
|
||||
InspectorUtils.parseStyleSheet(sheet, text, /* aUpdate = */ false);
|
||||
}));
|
||||
}
|
||||
|
||||
Promise.all(promises).then(() => {
|
||||
this.logInPage({
|
||||
text: L10N.getStr("cssSheetsReparsedWarning"),
|
||||
category: "CSS Parser",
|
||||
flags: Ci.nsIScriptError.warningFlag,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {};
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
# LOCALIZATION NOTE (cssSheetsReparsedWarning): The warning
|
||||
# to show after the CSS message filter has been toggled on.
|
||||
cssSheetsReparsedWarning=Stylesheets without CSSOM changes reparsed to check for errors. Refresh the page to also see errors from stylesheets changed from CSSOM and from style attributes.
|
Загрузка…
Ссылка в новой задаче