Backed out 3 changesets (bug 1644658, bug 1574487, bug 1644656) for causing mochitest failures on browser_staticPartition_saveAs.js CLOSED TREE
Backed out changeset ccd076f67748 (bug 1574487) Backed out changeset 2235323f0cf9 (bug 1644656) Backed out changeset 7fe2c7526246 (bug 1644658)
This commit is contained in:
@@ -931,71 +931,70 @@ function makePreview(row) {
|
||||
isBG) &&
|
||||
isProtocolAllowed
|
||||
) {
|
||||
function loadOrErrorListener() {
|
||||
newImage.removeEventListener("load", loadOrErrorListener);
|
||||
newImage.removeEventListener("error", loadOrErrorListener);
|
||||
physWidth = newImage.width || 0;
|
||||
physHeight = newImage.height || 0;
|
||||
|
||||
// "width" and "height" attributes must be set to newImage,
|
||||
// even if there is no "width" or "height attribute in item;
|
||||
// otherwise, the preview image cannot be displayed correctly.
|
||||
// Since the image might have been loaded out-of-process, we expect
|
||||
// the item to tell us its width / height dimensions. Failing that
|
||||
// the item should tell us the natural dimensions of the image. Finally
|
||||
// failing that, we'll assume that the image was never loaded in the
|
||||
// other process (this can be true for favicons, for example), and so
|
||||
// we'll assume that we can use the natural dimensions of the newImage
|
||||
// we just created. If the natural dimensions of newImage are not known
|
||||
// then the image is probably broken.
|
||||
if (!isBG) {
|
||||
newImage.width =
|
||||
("width" in item && item.width) || newImage.naturalWidth;
|
||||
newImage.height =
|
||||
("height" in item && item.height) || newImage.naturalHeight;
|
||||
} else {
|
||||
// the Width and Height of an HTML tag should not be used for its background image
|
||||
// (for example, "table" can have "width" or "height" attributes)
|
||||
newImage.width = item.naturalWidth || newImage.naturalWidth;
|
||||
newImage.height = item.naturalHeight || newImage.naturalHeight;
|
||||
}
|
||||
|
||||
if (item.SVGImageElement) {
|
||||
newImage.width = item.SVGImageElementWidth;
|
||||
newImage.height = item.SVGImageElementHeight;
|
||||
}
|
||||
|
||||
width = newImage.width;
|
||||
height = newImage.height;
|
||||
|
||||
document.getElementById("theimagecontainer").collapsed = false;
|
||||
document.getElementById("brokenimagecontainer").collapsed = true;
|
||||
|
||||
if (url) {
|
||||
if (width != physWidth || height != physHeight) {
|
||||
document.l10n.setAttributes(
|
||||
document.getElementById("imagedimensiontext"),
|
||||
"media-dimensions-scaled",
|
||||
{
|
||||
dimx: formatNumber(physWidth),
|
||||
dimy: formatNumber(physHeight),
|
||||
scaledx: formatNumber(width),
|
||||
scaledy: formatNumber(height),
|
||||
}
|
||||
);
|
||||
} else {
|
||||
document.l10n.setAttributes(
|
||||
document.getElementById("imagedimensiontext"),
|
||||
"media-dimensions",
|
||||
{ dimx: formatNumber(width), dimy: formatNumber(height) }
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We need to wait for the image to finish loading before using width & height
|
||||
newImage.addEventListener("load", loadOrErrorListener);
|
||||
newImage.addEventListener("error", loadOrErrorListener);
|
||||
newImage.addEventListener(
|
||||
"loadend",
|
||||
function() {
|
||||
physWidth = newImage.width || 0;
|
||||
physHeight = newImage.height || 0;
|
||||
|
||||
// "width" and "height" attributes must be set to newImage,
|
||||
// even if there is no "width" or "height attribute in item;
|
||||
// otherwise, the preview image cannot be displayed correctly.
|
||||
// Since the image might have been loaded out-of-process, we expect
|
||||
// the item to tell us its width / height dimensions. Failing that
|
||||
// the item should tell us the natural dimensions of the image. Finally
|
||||
// failing that, we'll assume that the image was never loaded in the
|
||||
// other process (this can be true for favicons, for example), and so
|
||||
// we'll assume that we can use the natural dimensions of the newImage
|
||||
// we just created. If the natural dimensions of newImage are not known
|
||||
// then the image is probably broken.
|
||||
if (!isBG) {
|
||||
newImage.width =
|
||||
("width" in item && item.width) || newImage.naturalWidth;
|
||||
newImage.height =
|
||||
("height" in item && item.height) || newImage.naturalHeight;
|
||||
} else {
|
||||
// the Width and Height of an HTML tag should not be used for its background image
|
||||
// (for example, "table" can have "width" or "height" attributes)
|
||||
newImage.width = item.naturalWidth || newImage.naturalWidth;
|
||||
newImage.height = item.naturalHeight || newImage.naturalHeight;
|
||||
}
|
||||
|
||||
if (item.SVGImageElement) {
|
||||
newImage.width = item.SVGImageElementWidth;
|
||||
newImage.height = item.SVGImageElementHeight;
|
||||
}
|
||||
|
||||
width = newImage.width;
|
||||
height = newImage.height;
|
||||
|
||||
document.getElementById("theimagecontainer").collapsed = false;
|
||||
document.getElementById("brokenimagecontainer").collapsed = true;
|
||||
|
||||
if (url) {
|
||||
if (width != physWidth || height != physHeight) {
|
||||
document.l10n.setAttributes(
|
||||
document.getElementById("imagedimensiontext"),
|
||||
"media-dimensions-scaled",
|
||||
{
|
||||
dimx: formatNumber(physWidth),
|
||||
dimy: formatNumber(physHeight),
|
||||
scaledx: formatNumber(width),
|
||||
scaledy: formatNumber(height),
|
||||
}
|
||||
);
|
||||
} else {
|
||||
document.l10n.setAttributes(
|
||||
document.getElementById("imagedimensiontext"),
|
||||
"media-dimensions",
|
||||
{ dimx: formatNumber(width), dimy: formatNumber(height) }
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
|
||||
newImage.setAttribute("triggeringprincipal", triggeringPrinStr);
|
||||
newImage.setAttribute("src", url);
|
||||
|
||||
@@ -20,11 +20,11 @@ async function testFirstPartyDomain(pageInfo) {
|
||||
info("preview.src=" + preview.src);
|
||||
|
||||
// For <img>, we will query imgIRequest.imagePrincipal later, so we wait
|
||||
// for load event. For <audio> and <video>, so far we only can get
|
||||
// for loadend event. For <audio> and <video>, so far we only can get
|
||||
// the triggeringprincipal attribute on the node, so we simply wait for
|
||||
// loadstart.
|
||||
if (i == 0) {
|
||||
await BrowserTestUtils.waitForEvent(preview, "load");
|
||||
await BrowserTestUtils.waitForEvent(preview, "loadend");
|
||||
} else {
|
||||
await BrowserTestUtils.waitForEvent(preview, "loadstart");
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ add_task(async function() {
|
||||
await BrowserTestUtils.waitForEvent(pageInfo, "page-info-init");
|
||||
|
||||
let pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
|
||||
await BrowserTestUtils.waitForEvent(pageInfoImg, "load");
|
||||
await BrowserTestUtils.waitForEvent(pageInfoImg, "loadend");
|
||||
Assert.equal(
|
||||
pageInfoImg.src,
|
||||
imageInfo.src,
|
||||
|
||||
@@ -94,7 +94,7 @@ async function testWindowSizePositive(width, height) {
|
||||
let reader = new FileReader();
|
||||
reader.onloadend = function() {
|
||||
let screenshot = new Image();
|
||||
screenshot.onload = function() {
|
||||
screenshot.onloadend = function() {
|
||||
is(
|
||||
screenshot.width,
|
||||
width,
|
||||
@@ -131,7 +131,7 @@ async function testGreen(url, path) {
|
||||
let reader = new FileReader();
|
||||
reader.onloadend = function() {
|
||||
let screenshot = new Image();
|
||||
screenshot.onload = function() {
|
||||
screenshot.onloadend = function() {
|
||||
resolve(screenshot);
|
||||
};
|
||||
screenshot.src = reader.result;
|
||||
|
||||
@@ -252,8 +252,15 @@ void nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest,
|
||||
// Fire the appropriate DOM event.
|
||||
if (NS_SUCCEEDED(aStatus)) {
|
||||
FireEvent(u"load"_ns);
|
||||
|
||||
// Do not fire loadend event for multipart/x-mixed-replace image streams.
|
||||
bool isMultipart;
|
||||
if (NS_FAILED(aRequest->GetMultipart(&isMultipart)) || !isMultipart) {
|
||||
FireEvent(u"loadend"_ns);
|
||||
}
|
||||
} else {
|
||||
FireEvent(u"error"_ns);
|
||||
FireEvent(u"loadend"_ns);
|
||||
}
|
||||
|
||||
SVGObserverUtils::InvalidateDirectRenderingObservers(
|
||||
@@ -980,6 +987,7 @@ nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
|
||||
if (!mCurrentRequest) aChannel->GetURI(getter_AddRefs(mCurrentURI));
|
||||
|
||||
FireEvent(u"error"_ns);
|
||||
FireEvent(u"loadend"_ns);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1055,10 +1063,14 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, bool aForce,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Fire loadstart event if required
|
||||
FireEvent(u"loadstart"_ns);
|
||||
|
||||
if (!mLoadingEnabled) {
|
||||
// XXX Why fire an error here? seems like the callers to SetLoadingEnabled
|
||||
// don't want/need it.
|
||||
FireEvent(u"error"_ns);
|
||||
FireEvent(u"loadend"_ns);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1088,6 +1100,7 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, bool aForce,
|
||||
ClearPendingRequest(NS_BINDING_ABORTED, Some(OnNonvisible::DiscardImages));
|
||||
|
||||
FireEvent(u"error"_ns);
|
||||
FireEvent(u"loadend"_ns);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -1194,6 +1207,7 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, bool aForce,
|
||||
}
|
||||
|
||||
FireEvent(u"error"_ns);
|
||||
FireEvent(u"loadend"_ns);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -356,7 +356,8 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
|
||||
/**
|
||||
* Method to fire an event once we know what's going on with the image load.
|
||||
*
|
||||
* @param aEventType "load", or "error" depending on how things went
|
||||
* @param aEventType "loadstart", "loadend", "load", or "error" depending on
|
||||
* how things went
|
||||
* @param aIsCancelable true if event is cancelable.
|
||||
*/
|
||||
nsresult FireEvent(const nsAString& aEventType, bool aIsCancelable = false);
|
||||
|
||||
@@ -1618,6 +1618,8 @@ let interfaceNamesInGlobalScope = [
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "onloadedmetadata", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "onloadend", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "onloadstart", insecureContext: true },
|
||||
// IMPORTANT: Do not change this list without review from a DOM peer!
|
||||
{ name: "onlostpointercapture", insecureContext: true },
|
||||
|
||||
@@ -62,6 +62,7 @@ interface mixin GlobalEventHandlers {
|
||||
attribute EventHandler onload;
|
||||
attribute EventHandler onloadeddata;
|
||||
attribute EventHandler onloadedmetadata;
|
||||
attribute EventHandler onloadend;
|
||||
attribute EventHandler onloadstart;
|
||||
attribute EventHandler onmousedown;
|
||||
[LegacyLenientThis] attribute EventHandler onmouseenter;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[historical-progress-event.window.html]
|
||||
[onloadend is not exposed]
|
||||
expected: FAIL
|
||||
|
||||
[<img> does not support ProgressEvent or loadstart/progress/loadend]
|
||||
expected: FAIL
|
||||
|
||||
Reference in New Issue
Block a user