зеркало из https://github.com/mozilla/gecko-dev.git
Bug 869903 - Report background color on mozbrowserfirstpaint, r=jlebar
This commit is contained in:
Родитель
e869dd6f6f
Коммит
a2975ec273
|
@ -187,7 +187,9 @@ BrowserElementChild.prototype = {
|
|||
|
||||
// Registers a MozAfterPaint handler for the very first paint.
|
||||
this._addMozAfterPaintHandler(function () {
|
||||
sendAsyncMsg('firstpaint');
|
||||
let bgColor = content.getComputedStyle(content.document.body)
|
||||
.getPropertyValue('background-color');
|
||||
sendAsyncMsg('firstpaint', {backgroundColor: bgColor});
|
||||
});
|
||||
|
||||
let self = this;
|
||||
|
|
|
@ -69,6 +69,7 @@ MOCHITEST_FILES = \
|
|||
file_browserElement_XFrameOptionsAllowFrom.html \
|
||||
file_browserElement_XFrameOptionsAllowFrom.sjs \
|
||||
browserElement_FirstPaint.js \
|
||||
file_browserElement_FirstPaint.html \
|
||||
test_browserElement_inproc_FirstPaint.html \
|
||||
browserElement_NextPaint.js \
|
||||
test_browserElement_inproc_NextPaint.html \
|
||||
|
|
|
@ -10,7 +10,9 @@ browserElementTestHelpers.addPermission();
|
|||
|
||||
function runTest() {
|
||||
var iframe = document.createElement('iframe');
|
||||
var iframe2 = document.createElement('iframe');
|
||||
SpecialPowers.wrap(iframe).mozbrowser = true;
|
||||
SpecialPowers.wrap(iframe2).mozbrowser = true;
|
||||
|
||||
var gotFirstPaint = false;
|
||||
var gotFirstLocationChange = false;
|
||||
|
@ -18,6 +20,8 @@ function runTest() {
|
|||
ok(!gotFirstPaint, "Got only one first paint.");
|
||||
gotFirstPaint = true;
|
||||
|
||||
is(e.detail.backgroundColor, "transparent", "Got the expected background color.");
|
||||
|
||||
if (gotFirstLocationChange) {
|
||||
iframe.src = browserElementTestHelpers.emptyPage1 + '?2';
|
||||
}
|
||||
|
@ -31,10 +35,16 @@ function runTest() {
|
|||
}
|
||||
}
|
||||
else if (e.detail.endsWith('?2')) {
|
||||
SimpleTest.finish();
|
||||
document.body.appendChild(iframe2);
|
||||
}
|
||||
});
|
||||
|
||||
iframe2.addEventListener('mozbrowserfirstpaint', function(e) {
|
||||
is(e.detail.backgroundColor, "rgb(0, 128, 0)", "Got the expected background color.");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
iframe2.src = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_FirstPaint.html';
|
||||
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
iframe.src = browserElementTestHelpers.emptyPage1;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<html>
|
||||
<body style="background-color:green;">
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче