mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 22:07:41 +00:00
Backed out changeset e65c1bcb013f (bug 1601475) for causing build bustage. On a CLOSED TREE
This commit is contained in:
parent
31ae0a85ac
commit
6e13799734
@ -30,6 +30,7 @@ const SWAPPED_BROWSER_STATE = [
|
||||
"_contentTitle",
|
||||
"_characterSet",
|
||||
"_contentPrincipal",
|
||||
"_imageDocument",
|
||||
"_isSyntheticDocument",
|
||||
"_innerWindowID",
|
||||
];
|
||||
@ -103,6 +104,7 @@ function tunnelToInnerBrowser(outer, inner) {
|
||||
inner._contentTitle = outer._contentTitle;
|
||||
inner._characterSet = outer._characterSet;
|
||||
inner._contentPrincipal = outer._contentPrincipal;
|
||||
inner._imageDocument = outer._imageDocument;
|
||||
inner._isSyntheticDocument = outer._isSyntheticDocument;
|
||||
inner._innerWindowID = outer._innerWindowID;
|
||||
inner._remoteWebNavigation._currentURI =
|
||||
@ -457,6 +459,7 @@ MessageManagerTunnel.prototype = {
|
||||
"PageStyle:StyleSheets",
|
||||
// Messages sent to browser.js
|
||||
"DOMTitleChanged",
|
||||
"ImageDocumentLoaded",
|
||||
"InPermitUnload",
|
||||
"PermitUnload",
|
||||
// Messages sent to SessionStore.jsm
|
||||
|
@ -126,6 +126,15 @@ ImageListener::OnStartRequest(nsIRequest* request) {
|
||||
return MediaDocumentStreamListener::OnStartRequest(request);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ImageListener::OnStopRequest(nsIRequest* aRequest, nsresult aStatus) {
|
||||
ImageDocument* imgDoc = static_cast<ImageDocument*>(mDocument.get());
|
||||
nsContentUtils::DispatchChromeEvent(imgDoc, ToSupports(imgDoc),
|
||||
NS_LITERAL_STRING("ImageContentLoaded"),
|
||||
CanBubble::eYes, Cancelable::eYes);
|
||||
return MediaDocumentStreamListener::OnStopRequest(aRequest, aStatus);
|
||||
}
|
||||
|
||||
ImageDocument::ImageDocument()
|
||||
: MediaDocument(),
|
||||
mVisibleWidth(0.0),
|
||||
|
@ -137,6 +137,7 @@ skip-if = verify
|
||||
[test_drawDiscardedImage.html]
|
||||
[test_error_events.html]
|
||||
[test_image_crossorigin_data_url.html]
|
||||
[test_ImageContentLoaded.html]
|
||||
[test_has_transparency.html]
|
||||
[test_net_failedtoprocess.html]
|
||||
skip-if = verify
|
||||
|
28
image/test/mochitest/test_ImageContentLoaded.html
Normal file
28
image/test/mochitest/test_ImageContentLoaded.html
Normal file
@ -0,0 +1,28 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=691610
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 691610</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish()
|
||||
|
||||
SpecialPowers.addChromeEventListener("ImageContentLoaded", function () {
|
||||
ok(true, "chrome listener was invoked");
|
||||
SimpleTest.finish();
|
||||
}, true);
|
||||
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "damon.jpg"
|
||||
document.body.appendChild(iframe);
|
||||
iframe.contentDocument.defaultView.addEventListener("ImageContentLoaded", function () {
|
||||
ok(false, "should not invoke event");
|
||||
}, true);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -52,6 +52,23 @@ addEventListener(
|
||||
false
|
||||
);
|
||||
|
||||
addEventListener(
|
||||
"ImageContentLoaded",
|
||||
function(aEvent) {
|
||||
if (content.document instanceof Ci.nsIImageDocument) {
|
||||
let req = content.document.imageRequest;
|
||||
if (!req.image) {
|
||||
return;
|
||||
}
|
||||
sendAsyncMessage("ImageDocumentLoaded", {
|
||||
width: req.image.width,
|
||||
height: req.image.height,
|
||||
});
|
||||
}
|
||||
},
|
||||
false
|
||||
);
|
||||
|
||||
// This is here for now until we find a better way of forcing an about:blank load
|
||||
// with a particular principal that doesn't involve the message manager. We can't
|
||||
// do this with JS Window Actors for now because JS Window Actors are tied to the
|
||||
|
@ -291,6 +291,8 @@
|
||||
|
||||
this._loadContext = null;
|
||||
|
||||
this._imageDocument = null;
|
||||
|
||||
this._webBrowserFind = null;
|
||||
|
||||
this._finder = null;
|
||||
@ -565,6 +567,24 @@
|
||||
return this.docShellIsActive;
|
||||
}
|
||||
|
||||
get imageDocument() {
|
||||
if (this.isRemoteBrowser) {
|
||||
return this._imageDocument;
|
||||
}
|
||||
var document = this.contentDocument;
|
||||
if (!document || !(document instanceof Ci.nsIImageDocument)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return {
|
||||
width: document.imageRequest.image.width,
|
||||
height: document.imageRequest.image.height,
|
||||
};
|
||||
} catch (e) {}
|
||||
return null;
|
||||
}
|
||||
|
||||
get isRemoteBrowser() {
|
||||
return this.getAttribute("remote") == "true";
|
||||
}
|
||||
@ -1243,6 +1263,7 @@
|
||||
|
||||
this.messageManager.addMessageListener("Browser:Init", this);
|
||||
this.messageManager.addMessageListener("DOMTitleChanged", this);
|
||||
this.messageManager.addMessageListener("ImageDocumentLoaded", this);
|
||||
|
||||
let jsm = "resource://gre/modules/RemoteWebProgress.jsm";
|
||||
let { RemoteWebProgressManager } = ChromeUtils.import(jsm, {});
|
||||
@ -1475,6 +1496,12 @@
|
||||
case "DOMTitleChanged":
|
||||
this._contentTitle = data.title;
|
||||
break;
|
||||
case "ImageDocumentLoaded":
|
||||
this._imageDocument = {
|
||||
width: data.width,
|
||||
height: data.height,
|
||||
};
|
||||
break;
|
||||
default:
|
||||
return this._receiveMessage(aMessage);
|
||||
}
|
||||
@ -1574,6 +1601,7 @@
|
||||
this._remoteWebNavigation._currentURI = aLocation;
|
||||
this._documentURI = aDocumentURI;
|
||||
this._contentTitle = aTitle;
|
||||
this._imageDocument = null;
|
||||
this._contentPrincipal = aContentPrincipal;
|
||||
this._contentStoragePrincipal = aContentStoragePrincipal;
|
||||
this._contentBlockingAllowListPrincipal = aContentBlockingAllowListPrincipal;
|
||||
@ -1923,6 +1951,7 @@
|
||||
"_contentPrincipal",
|
||||
"_contentStoragePrincipal",
|
||||
"_contentBlockingAllowListPrincipal",
|
||||
"_imageDocument",
|
||||
"_fullZoom",
|
||||
"_textZoom",
|
||||
"_isSyntheticDocument",
|
||||
|
@ -1913,6 +1913,7 @@ STATIC_ATOMS = [
|
||||
Atom("onFullZoomChange", "onFullZoomChange"),
|
||||
Atom("onGloballyAutoplayBlocked", "onGloballyAutoplayBlocked"),
|
||||
Atom("onHiddenPlugin", "onHiddenPlugin"),
|
||||
Atom("onImageContentLoaded", "onImageContentLoaded"),
|
||||
Atom("onMozApplicationManifest", "onMozApplicationManifest"),
|
||||
Atom("onMozDOMFullscreen_Entered", "onMozDOMFullscreen:Entered"),
|
||||
Atom("onMozDOMFullscreen_Exit", "onMozDOMFullscreen:Exit"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user