diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /toolkit/components/gfx/content/gfxFrameScript.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'toolkit/components/gfx/content/gfxFrameScript.js')
-rw-r--r-- | toolkit/components/gfx/content/gfxFrameScript.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/toolkit/components/gfx/content/gfxFrameScript.js b/toolkit/components/gfx/content/gfxFrameScript.js new file mode 100644 index 000000000..d7f25d2ef --- /dev/null +++ b/toolkit/components/gfx/content/gfxFrameScript.js @@ -0,0 +1,62 @@ +var { classes: Cc, interfaces: Ci, utils: Cu } = Components; + +const gfxFrameScript = { + domUtils: null, + + init: function() { + let webNav = docShell.QueryInterface(Ci.nsIWebNavigation); + let webProgress = docShell.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIWebProgress); + webProgress.addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_WINDOW); + + this.domUtils = content.QueryInterface(Ci.nsIInterfaceRequestor) + .getInterface(Ci.nsIDOMWindowUtils); + + webNav.loadURI("chrome://gfxsanity/content/sanitytest.html", + Ci.nsIWebNavigation.LOAD_FLAGS_NONE, + null, null, null); + + }, + + handleEvent: function(aEvent) { + switch (aEvent.type) { + case "MozAfterPaint": + sendAsyncMessage('gfxSanity:ContentLoaded'); + removeEventListener("MozAfterPaint", this); + break; + } + }, + + isSanityTest: function(aUri) { + if (!aUri) { + return false; + } + + return aUri.endsWith("/sanitytest.html"); + }, + + onStateChange: function (webProgress, req, flags, status) { + if (webProgress.isTopLevel && + (flags & Ci.nsIWebProgressListener.STATE_STOP) && + this.isSanityTest(req.name)) { + + webProgress.removeProgressListener(this); + + // If no paint is pending, then the test already painted + if (this.domUtils.isMozAfterPaintPending) { + addEventListener("MozAfterPaint", this); + } else { + sendAsyncMessage('gfxSanity:ContentLoaded'); + } + } + }, + + // Needed to support web progress listener + QueryInterface: XPCOMUtils.generateQI([ + Ci.nsIWebProgressListener, + Ci.nsISupportsWeakReference, + Ci.nsIObserver, + ]), +}; + +gfxFrameScript.init(); |