mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Bug 950097 - [ruleview] Styles not being updated on some pages;r=paul
This commit is contained in:
parent
fa25d4d3d6
commit
f9ce8121d8
@ -18,7 +18,7 @@ const XUL_PRINCIPAL = Components.classes["@mozilla.org/scriptsecuritymanager;1"
|
||||
.getService(Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(XUL_URI);
|
||||
|
||||
|
||||
let inspector, ruleView;
|
||||
let {CssLogic} = devtools.require("devtools/styleinspector/css-logic");
|
||||
|
||||
function test()
|
||||
@ -41,11 +41,47 @@ function testFromHTML()
|
||||
|
||||
executeSoon(function() {
|
||||
checkSheets(target);
|
||||
openRuleView((aInspector, aRuleView) => {
|
||||
inspector = aInspector;
|
||||
ruleView = aRuleView;
|
||||
inspector.selection.setNode(target);
|
||||
inspector.once("inspector-updated", testModifyRules);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function reselectElement(target, cb)
|
||||
{
|
||||
inspector.selection.setNode(target.parentNode);
|
||||
inspector.once("inspector-updated", ()=> {
|
||||
inspector.selection.setNode(target);
|
||||
inspector.once("inspector-updated", cb);
|
||||
});
|
||||
}
|
||||
|
||||
function testModifyRules()
|
||||
{
|
||||
// Set a property on all rules, then refresh and make sure they are still
|
||||
// there (and there wasn't an error on the server side)
|
||||
for (let rule of ruleView._elementStyle.rules) {
|
||||
rule.editor.addProperty("font-weight", "bold", "");
|
||||
}
|
||||
|
||||
reselectElement(doc.querySelector("#target"), () => {
|
||||
|
||||
for (let rule of ruleView._elementStyle.rules) {
|
||||
let lastRule = rule.textProps[rule.textProps.length - 1];
|
||||
|
||||
is (lastRule.name, "font-weight", "Last rule name is font-weight");
|
||||
is (lastRule.value, "bold", "Last rule value is bold");
|
||||
}
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
openXUL();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function openXUL()
|
||||
{
|
||||
Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
|
||||
@ -96,7 +132,7 @@ function finishUp()
|
||||
info("finishing up");
|
||||
Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager)
|
||||
.addFromPrincipal(XUL_PRINCIPAL, 'allowXULXBL', Ci.nsIPermissionManager.DENY_ACTION);
|
||||
doc = null;
|
||||
doc = inspector = ruleView = null;
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
@ -666,10 +666,16 @@ var StyleRuleActor = protocol.ActorClass({
|
||||
if (this.rawNode) {
|
||||
document = this.rawNode.ownerDocument;
|
||||
} else {
|
||||
if (this.rawRule.parentStyleSheet.ownerNode instanceof Ci.nsIDOMHTMLDocument) {
|
||||
document = this.rawRule.parentStyleSheet.ownerNode;
|
||||
let parentStyleSheet = this.rawRule.parentStyleSheet;
|
||||
while (parentStyleSheet.ownerRule &&
|
||||
parentStyleSheet.ownerRule instanceof Ci.nsIDOMCSSImportRule) {
|
||||
parentStyleSheet = parentStyleSheet.ownerRule.parentStyleSheet;
|
||||
}
|
||||
|
||||
if (parentStyleSheet.ownerNode instanceof Ci.nsIDOMHTMLDocument) {
|
||||
document = parentStyleSheet.ownerNode;
|
||||
} else {
|
||||
document = this.rawRule.parentStyleSheet.ownerNode.ownerDocument;
|
||||
document = parentStyleSheet.ownerNode.ownerDocument;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user