summaryrefslogtreecommitdiffstats
path: root/toolkit/components/gfx/content
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/gfx/content')
-rw-r--r--toolkit/components/gfx/content/gfxFrameScript.js62
-rw-r--r--toolkit/components/gfx/content/sanityparent.html7
-rw-r--r--toolkit/components/gfx/content/sanitytest.html6
-rw-r--r--toolkit/components/gfx/content/videotest.mp4bin0 -> 1563 bytes
4 files changed, 75 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();
diff --git a/toolkit/components/gfx/content/sanityparent.html b/toolkit/components/gfx/content/sanityparent.html
new file mode 100644
index 000000000..151214e68
--- /dev/null
+++ b/toolkit/components/gfx/content/sanityparent.html
@@ -0,0 +1,7 @@
+<html>
+ <head>
+ </head>
+ <body>
+
+ </body>
+</html>
diff --git a/toolkit/components/gfx/content/sanitytest.html b/toolkit/components/gfx/content/sanitytest.html
new file mode 100644
index 000000000..d60c47923
--- /dev/null
+++ b/toolkit/components/gfx/content/sanitytest.html
@@ -0,0 +1,6 @@
+<html>
+ <body>
+ <div style="width:64px; height:64px; background-color:red;"></div>
+ <video src="videotest.mp4"></video>
+ </body>
+</html>
diff --git a/toolkit/components/gfx/content/videotest.mp4 b/toolkit/components/gfx/content/videotest.mp4
new file mode 100644
index 000000000..42cf6e1aa
--- /dev/null
+++ b/toolkit/components/gfx/content/videotest.mp4
Binary files differ