mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
9f03f90fb7
find /files/mozilla/build/d/_tests/testing/mochitest/tests/ | egrep "\.(xhtml|html|xml|js)$" | grep -v SimpleTest | grep -vi mochikit | grep -v simpleThread | grep -v test_ipc_messagemanager_blob.html | grep -v "indexedDB/test" | xargs grep -l Components | xargs grep -L enablePrivilege | perl -pe 's#.*mochitest/tests/##' | xargs perl -p -i.bakkk -e 's/Components\.interfaces(\s|;|\.|\[)/SpecialPowers\.Ci$1/g, s/SpecialPowers\.wrap\(Components\)\.(.)(lasses|tils|nterfaces|esults)/SpecialPowers.C$1/g, s/(?<![\.a-zA-Z])Components/SpecialPowers\.Components/g, s/window\.Components/window\.SpecialPowers\.Components/g'
81 lines
2.5 KiB
HTML
81 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=534149
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 534149</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=534149">Mozilla Bug 534149</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 534149 **/
|
|
function getIDs(iframe) {
|
|
var win = iframe.contentWindow;
|
|
// Force inner creation
|
|
win.document;
|
|
|
|
var util = SpecialPowers.getDOMWindowUtils(win);
|
|
return [util.outerWindowID, util.currentInnerWindowID];
|
|
}
|
|
|
|
var i1 = document.createElement("iframe");
|
|
var i2 = document.createElement("iframe");
|
|
|
|
document.body.appendChild(i1);
|
|
var [i1outer, i1inner] = getIDs(i1);
|
|
|
|
document.body.appendChild(i2);
|
|
var [i2outer, i2inner] = getIDs(i2);
|
|
|
|
is(i1inner, i1outer + 1, "For frame 1, inner should come right after outer");
|
|
is(i2inner, i2outer + 1, "For frame 2, inner should come right after outer");
|
|
is(i2outer, i1inner + 1, "Frame 2 comes right after frame 1");
|
|
|
|
var innerWindowDestroyID;
|
|
var outerWindowDestroyID;
|
|
|
|
function outerObserver(id) {
|
|
outerWindowDestroyID =
|
|
SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
|
|
}
|
|
function innerObserver(id) {
|
|
innerWindowDestroyID =
|
|
SpecialPowers.wrap(id).QueryInterface(SpecialPowers.Ci.nsISupportsPRUint64).data;
|
|
}
|
|
|
|
function removeFrame(iframe) {
|
|
var obsSvc = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
|
.getService(SpecialPowers.Ci.nsIObserverService);
|
|
obsSvc.addObserver(outerObserver, "outer-window-destroyed", false);
|
|
obsSvc.addObserver(innerObserver, "inner-window-destroyed", false);
|
|
|
|
iframe.parentNode.removeChild(iframe);
|
|
}
|
|
|
|
removeFrame(i1);
|
|
SimpleTest.waitForExplicitFinish();
|
|
SimpleTest.executeSoon(function() {
|
|
is(innerWindowDestroyID, i1inner, "inner window of frame 1 should be destroyed");
|
|
is(outerWindowDestroyID, i1outer, "outer window of frame 1 should be destroyed");
|
|
var obsSvc = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
|
|
.getService(SpecialPowers.Ci.nsIObserverService);
|
|
obsSvc.removeObserver(outerObserver, "outer-window-destroyed");
|
|
obsSvc.removeObserver(innerObserver, "inner-window-destroyed");
|
|
SimpleTest.finish();
|
|
});
|
|
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|