send-after-setting-document-domain-window-helper.js (863B)
1 function assert_equals(value, expected) { 2 if (value != expected) { 3 throw "Got wrong value.\nExpected '" + expected + "',\ngot '" + value + "'"; 4 } 5 } 6 7 function assert_throws_dom(expected_exc, func) { 8 try { 9 func.call(this); 10 } catch(e) { 11 if (e.constructor.name != "DOMException") { 12 throw `Exception ${e.constructor.name || "unknown"} that was not a DOMException was thrown`; 13 } 14 var actual = e.name || e.type; 15 if (actual != expected_exc) { 16 throw "Got wrong exception.\nExpected '" + expected_exc + "',\ngot '" + actual + "'."; 17 } 18 return; 19 } 20 throw "Expected exception, but none was thrown"; 21 } 22 23 function run_test(test, name) { 24 var result = {passed: true, message: null, name: name}; 25 try { 26 test(); 27 } catch(e) { 28 result.passed = false; 29 result.message = e + ""; 30 } 31 opener.postMessage(result, "*"); 32 }