forked from mirrors/gecko-dev
Bug 1533424 - Don't allow InspectorUtils to mess up with our UA sheets. r=heycam
You can mess up stuff pretty badly if that happens, and we want to do this anyway for the shared UA sheet stuff, so... Differential Revision: https://phabricator.services.mozilla.com/D22554 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
1ea7130261
commit
1daca69d91
2 changed files with 13 additions and 1 deletions
|
|
@ -42,7 +42,12 @@
|
|||
|
||||
// Check that re-parsing preserves the mode.
|
||||
let mode = sheet.parsingMode;
|
||||
try {
|
||||
InspectorUtils.parseStyleSheet(sheet, "body { color: chartreuse; }");
|
||||
isnot(sheet.parsingMode, "agent", "Agent sheets cannot be reparsed");
|
||||
} catch (ex) {
|
||||
is(sheet.parsingMode, "agent", "Agent sheets cannot be reparsed");
|
||||
}
|
||||
is(sheet.parsingMode, mode,
|
||||
"check that re-parsing preserved mode " + mode);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -967,6 +967,13 @@ nsresult StyleSheet::ReparseSheet(const nsAString& aInput) {
|
|||
return NS_ERROR_DOM_INVALID_ACCESS_ERR;
|
||||
}
|
||||
|
||||
// Allowing to modify UA sheets is dangerous (in the sense that C++ code
|
||||
// relies on rules in those sheets), plus they're probably going to be shared
|
||||
// across processes in which case this is directly a no-go.
|
||||
if (GetOrigin() == OriginFlags::UserAgent) {
|
||||
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
||||
}
|
||||
|
||||
// Hold strong ref to the CSSLoader in case the document update
|
||||
// kills the document
|
||||
RefPtr<css::Loader> loader;
|
||||
|
|
|
|||
Loading…
Reference in a new issue