mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 866264 - Intermittent devtools/styleeditor/test/browser_styleeditor_new.js | new editor shows 1 rule after modification - Got 2, expected 1; r=dcamp
This commit is contained in:
parent
289a04f4c2
commit
277e52d627
@ -25,6 +25,8 @@ let gAddedCount = 0; // to add new stylesheet after the 2 initial stylesheets
|
|||||||
let gNewEditor; // to make sure only one new stylesheet got created
|
let gNewEditor; // to make sure only one new stylesheet got created
|
||||||
let gOriginalHref;
|
let gOriginalHref;
|
||||||
|
|
||||||
|
let checksCompleted = 0;
|
||||||
|
|
||||||
function testEditorAdded(aEvent, aEditor)
|
function testEditorAdded(aEvent, aEditor)
|
||||||
{
|
{
|
||||||
gAddedCount++;
|
gAddedCount++;
|
||||||
@ -46,18 +48,29 @@ function testEditorAdded(aEvent, aEditor)
|
|||||||
is(gUI.editors.length, 3,
|
is(gUI.editors.length, 3,
|
||||||
"creating a new stylesheet added a new StyleEditor instance");
|
"creating a new stylesheet added a new StyleEditor instance");
|
||||||
|
|
||||||
aEditor.getSourceEditor().then(testEditor);
|
|
||||||
|
|
||||||
aEditor.styleSheet.once("style-applied", function() {
|
aEditor.styleSheet.once("style-applied", function() {
|
||||||
// when changes have been completely applied to live stylesheet after transisiton
|
// when changes have been completely applied to live stylesheet after transisiton
|
||||||
let summary = aEditor.summary;
|
|
||||||
let ruleCount = summary.querySelector(".stylesheet-rule-count").textContent;
|
|
||||||
is(parseInt(ruleCount), 1,
|
|
||||||
"new editor shows 1 rule after modification");
|
|
||||||
|
|
||||||
ok(!content.document.documentElement.classList.contains(TRANSITION_CLASS),
|
ok(!content.document.documentElement.classList.contains(TRANSITION_CLASS),
|
||||||
"StyleEditor's transition class has been removed from content");
|
"StyleEditor's transition class has been removed from content");
|
||||||
|
|
||||||
|
if (++checksCompleted == 3) {
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
aEditor.styleSheet.on("property-change", function(event, property) {
|
||||||
|
if (property == "ruleCount") {
|
||||||
|
let ruleCount = aEditor.summary.querySelector(".stylesheet-rule-count").textContent;
|
||||||
|
is(parseInt(ruleCount), 1,
|
||||||
|
"new editor shows 1 rule after modification");
|
||||||
|
|
||||||
|
if (++checksCompleted == 3) {
|
||||||
|
cleanup();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
aEditor.getSourceEditor().then(testEditor);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEditor(aEditor) {
|
function testEditor(aEditor) {
|
||||||
@ -116,9 +129,15 @@ function onTransitionEnd() {
|
|||||||
if (gNewEditor) {
|
if (gNewEditor) {
|
||||||
is(gNewEditor.styleSheet.href, gOriginalHref,
|
is(gNewEditor.styleSheet.href, gOriginalHref,
|
||||||
"style sheet href did not change");
|
"style sheet href did not change");
|
||||||
|
}
|
||||||
|
|
||||||
gNewEditor = null;
|
if (++checksCompleted == 3) {
|
||||||
gUI = null;
|
cleanup();
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanup() {
|
||||||
|
gNewEditor = null;
|
||||||
|
gUI = null;
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
@ -675,13 +675,14 @@ StyleSheetActor.prototype = {
|
|||||||
onUpdate: function(request) {
|
onUpdate: function(request) {
|
||||||
DOMUtils.parseStyleSheet(this.styleSheet, request.text);
|
DOMUtils.parseStyleSheet(this.styleSheet, request.text);
|
||||||
|
|
||||||
|
this._notifyPropertyChanged("ruleCount");
|
||||||
|
|
||||||
if (request.transition) {
|
if (request.transition) {
|
||||||
this._insertTransistionRule();
|
this._insertTransistionRule();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this._notifyStyleApplied();
|
this._notifyStyleApplied();
|
||||||
}
|
}
|
||||||
this._notifyPropertyChanged("ruleCount");
|
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user