Bug 1050049 - Tests. r=smaug
authorBobby Holley <bobbyholley@gmail.com>
Mon, 11 Aug 2014 20:06:56 -0700
changeset 198999 9648b3e555dbcca68c72588d76d42c6615525661
parent 198998 1358c1ad00b483a7d6815a5c516be07b2107cc4e
child 199000 54b5997186eb544b31bdeee97711faa726fb2ca2
push id27293
push useremorley@mozilla.com
push dateTue, 12 Aug 2014 14:29:39 +0000
treeherdermozilla-central@ee1ad12a3939 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1050049
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1050049 - Tests. r=smaug
js/xpconnect/tests/chrome/chrome.ini
js/xpconnect/tests/chrome/file_bug1050049.xml
js/xpconnect/tests/chrome/test_bug1050049.html
--- a/js/xpconnect/tests/chrome/chrome.ini
+++ b/js/xpconnect/tests/chrome/chrome.ini
@@ -1,13 +1,14 @@
 [DEFAULT]
 support-files =
   bug503926.xul
   file_bug618176.xul
   file_bug996069.html
+  file_bug1050049.xml
   file_discardSystemSource.html
   worker_discardSystemSource.js
   file_evalInSandbox.html
   file_expandosharing.jsm
   outoflinexulscript.js
   subscript.js
   utf8_subscript.js
 
@@ -59,16 +60,17 @@ skip-if = buildapp == 'mulet'
 skip-if = buildapp == 'mulet'
 [test_bug860494.xul]
 [test_bug866823.xul]
 [test_bug895340.xul]
 [test_bug932906.xul]
 [test_bug996069.xul]
 [test_bug1041626.xul]
 [test_bug1042436.xul]
+[test_bug1050049.html]
 [test_xrayToJS.xul]
 skip-if = buildapp == 'mulet'
 [test_chrometoSource.xul]
 skip-if = buildapp == 'mulet'
 [test_cloneInto.xul]
 [test_cows.xul]
 skip-if = buildapp == 'mulet'
 [test_discardSystemSource.xul]
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/tests/chrome/file_bug1050049.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<bindings id="testBindings" xmlns="http://www.mozilla.org/xbl"
+          xmlns:html="http://www.w3.org/1999/xhtml">
+  <binding id="regularChromeBinding">
+    <content><html:p>Anonymous Paragraph</html:p></content>
+  </binding>
+  <binding id="whitelistedChromeBinding" bindToUntrustedContent="true">
+    <content><html:p>Anonymous Paragraph</html:p></content>
+  </binding>
+</bindings>
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/tests/chrome/test_bug1050049.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1050049
+-->
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1050049</title>
+  <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
+  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+  <script type="application/javascript">
+
+  /** Test for Bug 1050049 **/
+  SimpleTest.waitForExplicitFinish();
+
+  var regularBindingURI = window.location.toString().replace("test_bug1050049.html", "file_bug1050049.xml") + "#regularChromeBinding";
+  var whitelistedBindingURI = window.location.toString().replace("test_bug1050049.html", "file_bug1050049.xml") + "#whitelistedChromeBinding";
+
+  function testApplyBinding(doc, bindingURI, expectBind) {
+    var d = doc.createElement('div');
+    doc.body.appendChild(d);
+    d.style.MozBinding = "url(" + bindingURI + ")";
+
+    return new Promise(function(resolve, reject) {
+      // Wait two ticks of the refresh driver for the binding to be applied.
+      function onceBindingWouldBeApplied() {
+        is(!!doc.getAnonymousNodes(d), expectBind, "Binding " + (expectBind ? "should" : "shouldn't") +
+                                                   " be applied: " + bindingURI + ", " + doc.location);
+        resolve();
+      }
+      window.requestAnimationFrame(function() { window.requestAnimationFrame(onceBindingWouldBeApplied); });
+    });
+  }
+
+  function go() {
+    testApplyBinding(document, regularBindingURI, true)
+      .then(testApplyBinding.bind(null, window[0].document, regularBindingURI, false))
+      .then(testApplyBinding.bind(null, document, whitelistedBindingURI, true))
+      .then(testApplyBinding.bind(null, window[0].document, whitelistedBindingURI, true))
+      .then(SimpleTest.finish.bind(SimpleTest));
+  }
+
+  </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1050049">Mozilla Bug 1050049</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+<iframe onload="go();" src="http://example.org/tests/js/xpconnect/tests/mochitest/file_empty.html"></iframe>
+</body>
+</html>