mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
4c2163b0ec
--HG-- extra : rebase_source : 393c45bdb8d1eaa55be46dc5a6428b20d44cb013
83 lines
2.5 KiB
HTML
83 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=720157
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 720157</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="application/javascript" src="browserFrameHelpers.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=720157">Mozilla Bug 720157</a>
|
|
|
|
<!--
|
|
Test that the onmozbrowsertitlechange event works.
|
|
-->
|
|
|
|
<script type="application/javascript;version=1.7">
|
|
"use strict";
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
function runTest() {
|
|
browserFrameHelpers.setEnabledPref(true);
|
|
browserFrameHelpers.addToWhitelist();
|
|
|
|
var iframe1 = document.createElement('iframe');
|
|
iframe1.mozbrowser = true;
|
|
document.body.appendChild(iframe1);
|
|
|
|
// iframe2 is a red herring; we modify its title but don't listen for
|
|
// titlechanges; we want to make sure that its titlechange events aren't
|
|
// picked up by the listener on iframe1.
|
|
var iframe2 = document.createElement('iframe');
|
|
iframe2.mozbrowser = true;
|
|
document.body.appendChild(iframe2);
|
|
|
|
// iframe3 is another red herring. It's not a mozbrowser, so we shouldn't
|
|
// get any titlechange events on it.
|
|
var iframe3 = document.createElement('iframe');
|
|
document.body.appendChild(iframe3);
|
|
|
|
var numTitleChanges = 0;
|
|
|
|
iframe1.addEventListener('mozbrowsertitlechange', function(e) {
|
|
numTitleChanges++;
|
|
|
|
if (numTitleChanges == 1) {
|
|
is(e.detail, 'Title');
|
|
iframe1.contentDocument.title = 'New title';
|
|
iframe2.contentDocument.title = 'BAD TITLE 2';
|
|
}
|
|
else if (numTitleChanges == 2) {
|
|
is(e.detail, 'New title');
|
|
iframe1.src = 'data:text/html,<html><head><title>Title 3</title></head><body></body></html>';
|
|
}
|
|
else if (numTitleChanges == 3) {
|
|
is(e.detail, 'Title 3');
|
|
SimpleTest.finish();
|
|
}
|
|
else {
|
|
ok(false, 'Too many titlechange events.');
|
|
}
|
|
});
|
|
|
|
iframe3.addEventListener('mozbrowsertitlechange', function(e) {
|
|
ok(false, 'Should not get a titlechange event for iframe3.');
|
|
});
|
|
|
|
iframe1.src = 'data:text/html,<html><head><title>Title</title></head><body></body></html>';
|
|
iframe2.src = 'data:text/html,<html><head><title>BAD TITLE</title></head><body></body></html>';
|
|
iframe3.src = 'data:text/html,<html><head><title>SHOULD NOT GET EVENT</title></head><body></body></html>';
|
|
}
|
|
|
|
addEventListener('load', function() { SimpleTest.executeSoon(runTest); });
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|