mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out 75c95dac7fe0 (bug 984497) and f1b0d3d13755 (bug 990475) to fix bustage on a CLOSED TREE.
--HG-- extra : rebase_source : a63315cd428faeb95464f6ad76946d1c0c6d36c3
This commit is contained in:
parent
f722793d24
commit
7741df1efa
@ -25,8 +25,8 @@ var frame = document.getElementById("i");
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function() {
|
||||
var viewer =
|
||||
SpecialPowers.wrap(frame.contentWindow)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
SpecialPowers.wrap(frame.contentWindow
|
||||
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor))
|
||||
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIDocShell)
|
||||
.contentViewer
|
||||
|
@ -1,3 +1,5 @@
|
||||
SpecialPowers.setBoolPref("media.webspeech.synth.enabled", true);
|
||||
|
||||
var gSpeechRegistry = SpecialPowers.Cc["@mozilla.org/synth-voice-registry;1"]
|
||||
.getService(SpecialPowers.Ci.nsISynthVoiceRegistry);
|
||||
|
||||
@ -168,6 +170,7 @@ function synthCleanup() {
|
||||
.getService(SpecialPowers.Ci.nsISyncMessageSender);
|
||||
mm.sendSyncMessage('test:SpeechSynthesis:ipcSynthCleanup');
|
||||
}
|
||||
SpecialPowers.clearUserPref("media.webspeech.synth.enabled");
|
||||
}
|
||||
|
||||
function synthTestQueue(aTestArgs, aEndFunc) {
|
||||
|
@ -1,84 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=525444
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 525444: Web Speech API check all classes are present</title>
|
||||
<script type="application/javascript">
|
||||
window.SimpleTest = parent.SimpleTest;
|
||||
window.is = parent.is;
|
||||
window.isnot = parent.isnot;
|
||||
window.ok = parent.ok;
|
||||
</script>
|
||||
<script type="application/javascript" src="common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 525444 **/
|
||||
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Bob Marley', 'en-JM', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Amy Winehouse', 'en-GB', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Leonard Cohen', 'en-CA', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Celine Dion', 'fr-CA', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Julieta Venegas', 'es-MX', true);
|
||||
|
||||
ok(SpeechSynthesis, "SpeechSynthesis exists in global scope");
|
||||
ok(SpeechSynthesisVoice, "SpeechSynthesisVoice exists in global scope");
|
||||
ok(SpeechSynthesisEvent, "SpeechSynthesisEvent exists in global scope");
|
||||
|
||||
// SpeechSynthesisUtterance is the only type that has a constructor
|
||||
// and writable properties
|
||||
ok(SpeechSynthesisUtterance, "SpeechSynthesisUtterance exists in global scope");
|
||||
var ssu = new SpeechSynthesisUtterance("hello world");
|
||||
is(typeof ssu, "object", "SpeechSynthesisUtterance instance is an object");
|
||||
is(ssu.text, "hello world", "SpeechSynthesisUtterance.text is correct");
|
||||
is(ssu.volume, 1, "SpeechSynthesisUtterance.volume default is correct");
|
||||
is(ssu.rate, 1, "SpeechSynthesisUtterance.rate default is correct");
|
||||
is(ssu.pitch, 1, "SpeechSynthesisUtterance.pitch default is correct");
|
||||
ssu.lang = "he-IL";
|
||||
ssu.volume = 0.5;
|
||||
ssu.rate = 2.0;
|
||||
ssu.pitch = 1.5;
|
||||
is(ssu.lang, "he-IL", "SpeechSynthesisUtterance.lang is correct");
|
||||
is(ssu.volume, 0.5, "SpeechSynthesisUtterance.volume is correct");
|
||||
is(ssu.rate, 2.0, "SpeechSynthesisUtterance.rate is correct");
|
||||
is(ssu.pitch, 1.5, "SpeechSynthesisUtterance.pitch is correct");
|
||||
|
||||
// Test for singleton instance hanging off of window.
|
||||
ok(speechSynthesis, "speechSynthesis exists in global scope");
|
||||
is(typeof speechSynthesis, "object", "speechSynthesis instance is an object");
|
||||
is(typeof speechSynthesis.speak, "function", "speechSynthesis.speak is a function");
|
||||
is(typeof speechSynthesis.cancel, "function", "speechSynthesis.cancel is a function");
|
||||
is(typeof speechSynthesis.pause, "function", "speechSynthesis.pause is a function");
|
||||
is(typeof speechSynthesis.resume, "function", "speechSynthesis.resume is a function");
|
||||
is(typeof speechSynthesis.getVoices, "function", "speechSynthesis.getVoices is a function");
|
||||
|
||||
is(typeof speechSynthesis.pending, "boolean", "speechSynthesis.pending is a boolean");
|
||||
is(typeof speechSynthesis.speaking, "boolean", "speechSynthesis.speaking is a boolean");
|
||||
is(typeof speechSynthesis.paused, "boolean", "speechSynthesis.paused is a boolean");
|
||||
|
||||
var voices1 = speechSynthesis.getVoices();
|
||||
var voices2 = speechSynthesis.getVoices();
|
||||
|
||||
ok(voices1.length == voices2.length, "Voice count matches");
|
||||
|
||||
for (var i in voices1) {
|
||||
ok(voices1[i] == voices2[i], "Voice instance matches");
|
||||
}
|
||||
|
||||
synthCleanup();
|
||||
|
||||
SimpleTest.finish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,72 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en-US">
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=525444
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 525444: Web Speech API, check speech synth queue</title>
|
||||
<script type="application/javascript">
|
||||
window.SimpleTest = parent.SimpleTest;
|
||||
window.is = parent.is;
|
||||
window.isnot = parent.isnot;
|
||||
window.ok = parent.ok;
|
||||
</script>
|
||||
<script type="application/javascript" src="common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=525444">Mozilla Bug 525444</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 525444 **/
|
||||
|
||||
var englishJamaican = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Bob Marley', 'en-JM', true);
|
||||
var englishBritish = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Amy Winehouse', 'en-GB', true);
|
||||
var englishCanadian = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Leonard Cohen', 'en-CA', true);
|
||||
var frenchCanadian = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Celine Dion', 'fr-CA', true);
|
||||
var spanishMexican = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Julieta Venegas', 'es-MX', true);
|
||||
|
||||
synthSetDefault(englishBritish, true);
|
||||
|
||||
synthTestQueue(
|
||||
[[{text: "Hello, world."},
|
||||
{ uri: englishBritish }],
|
||||
[{text: "Bonjour tout le monde .", lang: "fr", rate: 0.5, pitch: 0.75},
|
||||
{ uri: frenchCanadian, rate: 0.5, pitch: 0.75}],
|
||||
[{text: "How are you doing?", lang: "en-GB"},
|
||||
{ rate: 1, pitch: 1, uri: englishBritish}],
|
||||
[{text: "¡hasta mañana", lang: "es-ES"},
|
||||
{ uri: spanishMexican }]],
|
||||
function () {
|
||||
synthSetDefault(englishJamaican, true);
|
||||
var test_data = [[{text: "I shot the sheriff."},
|
||||
{ uri: englishJamaican }]];
|
||||
var voices = speechSynthesis.getVoices();
|
||||
for (var i in voices) {
|
||||
test_data.push([{text: "Hello world", voice: voices[i]},
|
||||
{uri: voices[i].voiceURI}]);
|
||||
}
|
||||
|
||||
synthTestQueue(test_data,
|
||||
function () {
|
||||
synthCleanup();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,56 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=650295
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 650295: Web Speech API check all classes are present</title>
|
||||
<script type="application/javascript">
|
||||
window.SimpleTest = parent.SimpleTest;
|
||||
window.info = parent.info;
|
||||
window.is = parent.is;
|
||||
window.isnot = parent.isnot;
|
||||
window.ok = parent.ok;
|
||||
</script>
|
||||
<script type="application/javascript" src="common.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 525444 **/
|
||||
|
||||
synthAddVoice('TestSpeechServiceWithAudio', 'Male 1', 'en-GB', true);
|
||||
|
||||
var gotStartEvent = false;
|
||||
var gotBoundaryEvent = false;
|
||||
var utterance = new SpeechSynthesisUtterance("Hello, world!");
|
||||
utterance.addEventListener('start', function(e) {
|
||||
ok(speechSynthesis.speaking, "speechSynthesis is speaking.");
|
||||
ok(!speechSynthesis.pending, "speechSynthesis has no other utterances queued.");
|
||||
gotStartEvent = true;
|
||||
});
|
||||
|
||||
utterance.addEventListener('end', function(e) {
|
||||
ok(!speechSynthesis.speaking, "speechSynthesis is not speaking.");
|
||||
ok(!speechSynthesis.pending, "speechSynthesis has no other utterances queued.");
|
||||
ok(gotStartEvent, "Got 'start' event.");
|
||||
info('end ' + e.elapsedTime);
|
||||
synthCleanup();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
speechSynthesis.speak(utterance);
|
||||
ok(!speechSynthesis.speaking, "speechSynthesis is not speaking yet.");
|
||||
ok(speechSynthesis.pending, "speechSynthesis has an utterance queued.");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +1,6 @@
|
||||
[DEFAULT]
|
||||
skip-if = e10s
|
||||
support-files =
|
||||
common.js
|
||||
file_setup.html
|
||||
file_speech_queue.html
|
||||
file_speech_simple.html
|
||||
support-files = common.js
|
||||
|
||||
[test_setup.html]
|
||||
[test_speech_queue.html]
|
||||
|
@ -7,12 +7,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 525444: Web Speech API check all classes are present</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="common.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=650295">Mozilla Bug 650295</a>
|
||||
<p id="display"></p>
|
||||
<iframe id="testFrame"></iframe>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
@ -21,11 +21,57 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
|
||||
|
||||
/** Test for Bug 525444 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Bob Marley', 'en-JM', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Amy Winehouse', 'en-GB', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Leonard Cohen', 'en-CA', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Celine Dion', 'fr-CA', true);
|
||||
synthAddVoice('TestSpeechServiceNoAudio', 'Julieta Venegas', 'es-MX', true);
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [['media.webspeech.synth.enabled', true]] },
|
||||
function() { document.getElementById("testFrame").src = "file_setup.html"; });
|
||||
ok(SpeechSynthesis, "SpeechSynthesis exists in global scope");
|
||||
ok(SpeechSynthesisVoice, "SpeechSynthesisVoice exists in global scope");
|
||||
ok(SpeechSynthesisEvent, "SpeechSynthesisEvent exists in global scope");
|
||||
|
||||
// SpeechSynthesisUtterance is the only type that has a constructor
|
||||
// and writable properties
|
||||
ok(SpeechSynthesisUtterance, "SpeechSynthesisUtterance exists in global scope");
|
||||
var ssu = new SpeechSynthesisUtterance("hello world");
|
||||
is(typeof ssu, "object", "SpeechSynthesisUtterance instance is an object");
|
||||
is(ssu.text, "hello world", "SpeechSynthesisUtterance.text is correct");
|
||||
is(ssu.volume, 1, "SpeechSynthesisUtterance.volume default is correct");
|
||||
is(ssu.rate, 1, "SpeechSynthesisUtterance.rate default is correct");
|
||||
is(ssu.pitch, 1, "SpeechSynthesisUtterance.pitch default is correct");
|
||||
ssu.lang = "he-IL";
|
||||
ssu.volume = 0.5;
|
||||
ssu.rate = 2.0;
|
||||
ssu.pitch = 1.5;
|
||||
is(ssu.lang, "he-IL", "SpeechSynthesisUtterance.lang is correct");
|
||||
is(ssu.volume, 0.5, "SpeechSynthesisUtterance.volume is correct");
|
||||
is(ssu.rate, 2.0, "SpeechSynthesisUtterance.rate is correct");
|
||||
is(ssu.pitch, 1.5, "SpeechSynthesisUtterance.pitch is correct");
|
||||
|
||||
// Test for singleton instance hanging off of window.
|
||||
ok(speechSynthesis, "speechSynthesis exists in global scope");
|
||||
is(typeof speechSynthesis, "object", "speechSynthesis instance is an object");
|
||||
is(typeof speechSynthesis.speak, "function", "speechSynthesis.speak is a function");
|
||||
is(typeof speechSynthesis.cancel, "function", "speechSynthesis.cancel is a function");
|
||||
is(typeof speechSynthesis.pause, "function", "speechSynthesis.pause is a function");
|
||||
is(typeof speechSynthesis.resume, "function", "speechSynthesis.resume is a function");
|
||||
is(typeof speechSynthesis.getVoices, "function", "speechSynthesis.getVoices is a function");
|
||||
|
||||
is(typeof speechSynthesis.pending, "boolean", "speechSynthesis.pending is a boolean");
|
||||
is(typeof speechSynthesis.speaking, "boolean", "speechSynthesis.speaking is a boolean");
|
||||
is(typeof speechSynthesis.paused, "boolean", "speechSynthesis.paused is a boolean");
|
||||
|
||||
var voices1 = speechSynthesis.getVoices();
|
||||
var voices2 = speechSynthesis.getVoices();
|
||||
|
||||
ok(voices1.length == voices2.length, "Voice count matches");
|
||||
|
||||
for (var i in voices1) {
|
||||
ok(voices1[i] == voices2[i], "Voice instance matches");
|
||||
}
|
||||
|
||||
synthCleanup();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
|
@ -13,7 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=525444">Mozilla Bug 525444</a>
|
||||
<p id="display"></p>
|
||||
<iframe id="testFrame"></iframe>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
@ -24,8 +23,46 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [['media.webspeech.synth.enabled', true]] },
|
||||
function() { document.getElementById("testFrame").src = "file_speech_queue.html"; });
|
||||
var englishJamaican = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Bob Marley', 'en-JM', true);
|
||||
var englishBritish = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Amy Winehouse', 'en-GB', true);
|
||||
var englishCanadian = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Leonard Cohen', 'en-CA', true);
|
||||
var frenchCanadian = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Celine Dion', 'fr-CA', true);
|
||||
var spanishMexican = synthAddVoice('TestSpeechServiceNoAudio',
|
||||
'Julieta Venegas', 'es-MX', true);
|
||||
|
||||
synthSetDefault(englishBritish, true);
|
||||
|
||||
synthTestQueue(
|
||||
[[{text: "Hello, world."},
|
||||
{ uri: englishBritish }],
|
||||
[{text: "Bonjour tout le monde .", lang: "fr", rate: 0.5, pitch: 0.75},
|
||||
{ uri: frenchCanadian, rate: 0.5, pitch: 0.75}],
|
||||
[{text: "How are you doing?", lang: "en-GB"},
|
||||
{ rate: 1, pitch: 1, uri: englishBritish}],
|
||||
[{text: "¡hasta mañana", lang: "es-ES"},
|
||||
{ uri: spanishMexican }]],
|
||||
function () {
|
||||
synthSetDefault(englishJamaican, true);
|
||||
var test_data = [[{text: "I shot the sheriff."},
|
||||
{ uri: englishJamaican }]];
|
||||
var voices = speechSynthesis.getVoices();
|
||||
for (var i in voices) {
|
||||
test_data.push([{text: "Hello world", voice: voices[i]},
|
||||
{uri: voices[i].voiceURI}]);
|
||||
}
|
||||
|
||||
synthTestQueue(test_data,
|
||||
function () {
|
||||
synthCleanup();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -13,7 +13,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=650295">Mozilla Bug 650295</a>
|
||||
<p id="display"></p>
|
||||
<iframe id="testFrame"></iframe>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
@ -24,8 +23,29 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPrefEnv({ set: [['media.webspeech.synth.enabled', true]] },
|
||||
function() { document.getElementById("testFrame").src = "file_speech_simple.html"; });
|
||||
synthAddVoice('TestSpeechServiceWithAudio', 'Male 1', 'en-GB', true);
|
||||
|
||||
var gotStartEvent = false;
|
||||
var gotBoundaryEvent = false;
|
||||
var utterance = new SpeechSynthesisUtterance("Hello, world!");
|
||||
utterance.addEventListener('start', function(e) {
|
||||
ok(speechSynthesis.speaking, "speechSynthesis is speaking.");
|
||||
ok(!speechSynthesis.pending, "speechSynthesis has no other utterances queued.");
|
||||
gotStartEvent = true;
|
||||
});
|
||||
|
||||
utterance.addEventListener('end', function(e) {
|
||||
ok(!speechSynthesis.speaking, "speechSynthesis is not speaking.");
|
||||
ok(!speechSynthesis.pending, "speechSynthesis has no other utterances queued.");
|
||||
ok(gotStartEvent, "Got 'start' event.");
|
||||
info('end ' + e.elapsedTime);
|
||||
synthCleanup();
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
speechSynthesis.speak(utterance);
|
||||
ok(!speechSynthesis.speaking, "speechSynthesis is not speaking yet.");
|
||||
ok(speechSynthesis.pending, "speechSynthesis has an utterance queued.");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -1721,7 +1721,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControllers)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArguments)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDialogArguments)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReturnValue)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNavigator)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPerformance)
|
||||
@ -1779,7 +1778,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mArguments)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDialogArguments)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mReturnValue)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPerformance)
|
||||
@ -13373,9 +13371,13 @@ nsGlobalWindow::GetMessageManager(ErrorResult& aError)
|
||||
// nsGlobalModalWindow implementation
|
||||
|
||||
// QueryInterface implementation for nsGlobalModalWindow
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsGlobalModalWindow,
|
||||
nsGlobalWindow,
|
||||
mReturnValue)
|
||||
|
||||
DOMCI_DATA(ModalContentWindow, nsGlobalModalWindow)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsGlobalModalWindow)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsGlobalModalWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMModalContentWindow)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ModalContentWindow)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsGlobalWindow)
|
||||
@ -13384,25 +13386,6 @@ NS_IMPL_ADDREF_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
|
||||
NS_IMPL_RELEASE_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
|
||||
|
||||
|
||||
JS::Value
|
||||
nsGlobalWindow::GetDialogArguments(JSContext* aCx, ErrorResult& aError)
|
||||
{
|
||||
FORWARD_TO_OUTER_OR_THROW(GetDialogArguments, (aCx, aError), aError,
|
||||
JS::UndefinedValue());
|
||||
|
||||
MOZ_ASSERT(IsModalContentWindow(),
|
||||
"This should only be called on modal windows!");
|
||||
|
||||
// This does an internal origin check, and returns undefined if the subject
|
||||
// does not subsumes the origin of the arguments.
|
||||
JSObject* wrapper = GetWrapper();
|
||||
JSAutoCompartment ac(aCx, wrapper);
|
||||
JS::Rooted<JS::Value> args(aCx);
|
||||
mDialogArguments->Get(aCx, wrapper, nsContentUtils::GetSubjectPrincipal(),
|
||||
&args, aError);
|
||||
return args;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalModalWindow::GetDialogArguments(nsIVariant **aArguments)
|
||||
{
|
||||
@ -13414,25 +13397,6 @@ nsGlobalModalWindow::GetDialogArguments(nsIVariant **aArguments)
|
||||
return mDialogArguments->Get(nsContentUtils::GetSubjectPrincipal(), aArguments);
|
||||
}
|
||||
|
||||
JS::Value
|
||||
nsGlobalWindow::GetReturnValue(JSContext* aCx, ErrorResult& aError)
|
||||
{
|
||||
FORWARD_TO_OUTER_OR_THROW(GetReturnValue, (aCx, aError), aError,
|
||||
JS::UndefinedValue());
|
||||
|
||||
MOZ_ASSERT(IsModalContentWindow(),
|
||||
"This should only be called on modal windows!");
|
||||
|
||||
JS::Rooted<JS::Value> returnValue(aCx);
|
||||
if (mReturnValue) {
|
||||
JSObject* wrapper = GetWrapper();
|
||||
JSAutoCompartment ac(aCx, wrapper);
|
||||
mReturnValue->Get(aCx, wrapper, nsContentUtils::GetSubjectPrincipal(),
|
||||
&returnValue, aError);
|
||||
}
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalModalWindow::GetReturnValue(nsIVariant **aRetVal)
|
||||
{
|
||||
@ -13447,27 +13411,6 @@ nsGlobalModalWindow::GetReturnValue(nsIVariant **aRetVal)
|
||||
return mReturnValue->Get(nsContentUtils::GetSubjectPrincipal(), aRetVal);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindow::SetReturnValue(JSContext* aCx,
|
||||
JS::Handle<JS::Value> aReturnValue,
|
||||
ErrorResult& aError)
|
||||
{
|
||||
FORWARD_TO_OUTER_OR_THROW(SetReturnValue, (aCx, aReturnValue, aError),
|
||||
aError, );
|
||||
|
||||
MOZ_ASSERT(IsModalContentWindow(),
|
||||
"This should only be called on modal windows!");
|
||||
|
||||
nsCOMPtr<nsIVariant> returnValue;
|
||||
aError =
|
||||
nsContentUtils::XPConnect()->JSToVariant(aCx, aReturnValue,
|
||||
getter_AddRefs(returnValue));
|
||||
if (!aError.Failed()) {
|
||||
mReturnValue = new DialogValueHolder(nsContentUtils::GetSubjectPrincipal(),
|
||||
returnValue);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalModalWindow::SetReturnValue(nsIVariant *aRetVal)
|
||||
{
|
||||
@ -13478,16 +13421,6 @@ nsGlobalModalWindow::SetReturnValue(nsIVariant *aRetVal)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsGlobalWindow::IsModalContentWindow(JSContext* aCx, JSObject* aGlobal)
|
||||
{
|
||||
nsGlobalWindow* win;
|
||||
UNWRAP_OBJECT(Window, aGlobal, win);
|
||||
MOZ_ASSERT(win);
|
||||
return win->IsModalContentWindow();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetConsole(JSContext* aCx,
|
||||
JS::MutableHandle<JS::Value> aConsole)
|
||||
|
@ -277,16 +277,6 @@ public:
|
||||
result.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
void Get(JSContext* aCx, JSObject* aScope, nsIPrincipal* aSubject,
|
||||
JS::MutableHandle<JS::Value> aResult, mozilla::ErrorResult& aError)
|
||||
{
|
||||
if (aSubject->Subsumes(mOrigin)) {
|
||||
aError = nsContentUtils::XPConnect()->VariantToJS(aCx, aScope,
|
||||
mValue, aResult);
|
||||
} else {
|
||||
aResult.setUndefined();
|
||||
}
|
||||
}
|
||||
virtual ~DialogValueHolder() {}
|
||||
private:
|
||||
nsCOMPtr<nsIPrincipal> mOrigin;
|
||||
@ -591,9 +581,6 @@ public:
|
||||
return mIsChrome;
|
||||
}
|
||||
|
||||
using nsPIDOMWindow::IsModalContentWindow;
|
||||
static bool IsModalContentWindow(JSContext* aCx, JSObject* aGlobal);
|
||||
|
||||
// GetScrollFrame does not flush. Callers should do it themselves as needed,
|
||||
// depending on which info they actually want off the scrollable frame.
|
||||
nsIScrollableFrame *GetScrollFrame();
|
||||
@ -995,11 +982,6 @@ public:
|
||||
mozilla::dom::Element* aPanel,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
JS::Value GetDialogArguments(JSContext* aCx, mozilla::ErrorResult& aError);
|
||||
JS::Value GetReturnValue(JSContext* aCx, mozilla::ErrorResult& aError);
|
||||
void SetReturnValue(JSContext* aCx, JS::Handle<JS::Value> aReturnValue,
|
||||
mozilla::ErrorResult& aError);
|
||||
|
||||
protected:
|
||||
// Array of idle observers that are notified of idle events.
|
||||
nsTObserverArray<IdleObserverHolder> mIdleObservers;
|
||||
@ -1458,9 +1440,6 @@ protected:
|
||||
// For |window.dialogArguments|, via |showModalDialog|.
|
||||
nsRefPtr<DialogValueHolder> mDialogArguments;
|
||||
|
||||
// Only used in the outer.
|
||||
nsRefPtr<DialogValueHolder> mReturnValue;
|
||||
|
||||
nsRefPtr<mozilla::dom::Navigator> mNavigator;
|
||||
nsRefPtr<nsScreen> mScreen;
|
||||
nsRefPtr<nsDOMWindowList> mFrames;
|
||||
@ -1660,6 +1639,12 @@ public:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMMODALCONTENTWINDOW
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalModalWindow, nsGlobalWindow)
|
||||
|
||||
protected:
|
||||
// For use by outer windows only.
|
||||
nsRefPtr<DialogValueHolder> mReturnValue;
|
||||
};
|
||||
|
||||
/* factory function */
|
||||
|
@ -16,8 +16,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=931768
|
||||
openDialog("chrome://browser/content/browser.xul");
|
||||
ok(false, "Calling openDialog from unprivileged script should throw.");
|
||||
} catch (e) {
|
||||
ok(e instanceof ReferenceError,
|
||||
"openDialog shouldn't be available to unprivileged script.");
|
||||
// FIXME e should be a ReferenceError once we switch Window to new WebIDL bindings
|
||||
ok(e.name == "SecurityError",
|
||||
"openDialog shouldn't be callable to unprivileged script.");
|
||||
todo(e instanceof ReferenceError,
|
||||
"openDialog shouldn't be available to unprivileged script.");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -13,7 +13,10 @@ var gGotNotHandlingDrop = false;
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function fireEvent(target, event) {
|
||||
SpecialPowers.DOMWindowUtils.dispatchDOMEventViaPresShell(target, event, true);
|
||||
var utils =
|
||||
window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
|
||||
getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
SpecialPowers.wrap(utils).dispatchDOMEventViaPresShell(target, event, true);
|
||||
}
|
||||
|
||||
function fireDrop(element, shouldAllowDrop, shouldAllowOnlyChromeDrop) {
|
||||
|
@ -43,7 +43,8 @@ var ConsoleObserver = {
|
||||
// Close the window.
|
||||
gBrowser.removeTab(tab, {animate: false});
|
||||
// Ensure actual window destruction is not delayed (too long).
|
||||
SpecialPowers.DOMWindowUtils.garbageCollect();
|
||||
window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils).garbageCollect();
|
||||
// Ensure "inner-window-destroyed" event is processed,
|
||||
// so the storage cache is cleared.
|
||||
executeSoon(function () {
|
||||
|
@ -135,7 +135,10 @@ function messageReceiver(evt) {
|
||||
|
||||
function handleTestEnd() {
|
||||
function gc() {
|
||||
SpecialPowers.DOMWindowUtils.garbageCollect();
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils)
|
||||
.garbageCollect();
|
||||
}
|
||||
if (numTestsSet1) {
|
||||
if (!--numTestsSet1) {
|
||||
|
@ -22,7 +22,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=397571
|
||||
/** Test for Bug 397571 **/
|
||||
|
||||
// Get the interface
|
||||
var utils = SpecialPowers.DOMWindowUtils.SpecialPowers_wrappedObject;
|
||||
var utils = window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
|
||||
getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
|
||||
// Try to call functions without privileges
|
||||
var success = false;
|
||||
|
@ -4,7 +4,7 @@
|
||||
<script>
|
||||
function go() {
|
||||
is(SpecialPowers.wrap(window).location.toString(), location.toString(), "sanity");
|
||||
ok("returnValue" in window && "dialogArguments" in window, "We are modal");
|
||||
is(SpecialPowers.Cu.getClassName(window, /* aUnwrap = */ true), "ModalContentWindow", "We are modal");
|
||||
var iwin = document.getElementById('ifr').contentWindow;
|
||||
is(SpecialPowers.Cu.getClassName(iwin, /* aUnwrap = */ true), "Window", "Descendant frames should not be modal");
|
||||
|
||||
|
@ -225,14 +225,6 @@ interface SpeechSynthesisGetter {
|
||||
Window implements SpeechSynthesisGetter;
|
||||
#endif
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/
|
||||
[NoInterfaceObject]
|
||||
interface WindowModal {
|
||||
[Throws, Func="nsGlobalWindow::IsModalContentWindow"] readonly attribute any dialogArguments;
|
||||
[Throws, Func="nsGlobalWindow::IsModalContentWindow"] attribute any returnValue;
|
||||
};
|
||||
Window implements WindowModal;
|
||||
|
||||
// Mozilla-specific stuff
|
||||
partial interface Window {
|
||||
//[NewObject, Throws] CSSStyleDeclaration getDefaultComputedStyle(Element elt, optional DOMString pseudoElt = "");
|
||||
|
@ -22,8 +22,7 @@ var iframe = document.getElementById("load-frame");
|
||||
function enableJS() allowJS(true, iframe);
|
||||
function disableJS() allowJS(false, iframe);
|
||||
function allowJS(allow, frame) {
|
||||
SpecialPowers.wrap(frame.contentWindow)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
SpecialPowers.wrap(frame.contentWindow.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor))
|
||||
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
|
||||
.QueryInterface(SpecialPowers.Ci.nsIDocShell)
|
||||
.allowJavascript = allow;
|
||||
|
@ -36,8 +36,7 @@ function editDoc() {
|
||||
function getSpellCheckSelection() {
|
||||
var Ci = SpecialPowers.Ci;
|
||||
var win = editDoc().defaultView;
|
||||
var editingSession = SpecialPowers.wrap(win)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
var editingSession = SpecialPowers.wrap(win.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession);
|
||||
|
@ -53,8 +53,7 @@ function runTest() {
|
||||
editdoc.designMode='on';
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
@ -73,8 +72,7 @@ function runTest() {
|
||||
editdoc.body.contentEditable = true;
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
@ -91,8 +89,7 @@ function runTest() {
|
||||
editdoc.designMode = "off";
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
|
@ -25,7 +25,8 @@ var layoutCSSBranch = prefService.getBranch("layout.css.");
|
||||
var oldVal = layoutCSSBranch.getCharPref("devPixelsPerPx");
|
||||
|
||||
try {
|
||||
var domWindowUtils = SpecialPowers.DOMWindowUtils;
|
||||
var domWindowUtils = window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
var devPxPerCSSPx = domWindowUtils.screenPixelsPerCSSPixel;
|
||||
|
||||
layoutCSSBranch.setCharPref("devPixelsPerPx", "2");
|
||||
|
@ -22,7 +22,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
|
||||
|
||||
<!-- test code goes here -->
|
||||
<script type="application/javascript"><![CDATA[
|
||||
const utils = SpecialPowers.DOMWindowUtils;
|
||||
const Ci = Components.interfaces;
|
||||
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
function go() {
|
||||
var wrappedWin = $('ifr').contentWindow;
|
||||
|
@ -8,7 +8,10 @@
|
||||
window.expando = document.documentElement;
|
||||
|
||||
function testme(obj) {
|
||||
const utils = SpecialPowers.DOMWindowUtils;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const Ci = Components.interfaces;
|
||||
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
|
||||
return utils.getClassName(obj) != "Proxy" &&
|
||||
typeof obj.querySelector == 'function';
|
||||
|
@ -7,8 +7,10 @@
|
||||
{
|
||||
window.setTimeout(function()
|
||||
{
|
||||
SpecialPowers.wrap(window).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
|
||||
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.goBack();
|
||||
}, 100);
|
||||
}
|
||||
|
@ -117,9 +117,9 @@ function doKey(aKey, modifier) {
|
||||
modifier = null;
|
||||
|
||||
// Window utils for sending fake sey events.
|
||||
var wutils = SpecialPowers.wrap(window).
|
||||
QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
|
||||
var wutils = window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
|
||||
getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
|
||||
wutils = SpecialPowers.wrap(wutils);
|
||||
|
||||
if (wutils.sendKeyEvent("keydown", key, 0, modifier)) {
|
||||
wutils.sendKeyEvent("keypress", key, 0, modifier);
|
||||
|
Loading…
Reference in New Issue
Block a user