Bug 984497 - Use SpecialPowers more and change SpecialPower usage to deal with Window on WebIDL bindings. r=bz.

--HG--
rename : content/media/webspeech/synth/test/test_setup.html => content/media/webspeech/synth/test/file_setup.html
rename : content/media/webspeech/synth/test/test_speech_queue.html => content/media/webspeech/synth/test/file_speech_queue.html
rename : content/media/webspeech/synth/test/test_speech_simple.html => content/media/webspeech/synth/test/file_speech_simple.html
extra : rebase_source : 3662ae8b0f35fefb250c9cd048e848d662863855
This commit is contained in:
Peter Van der Beken 2014-02-15 22:12:34 +01:00
parent 6a2ebb41fe
commit 3d1f466234
21 changed files with 250 additions and 151 deletions

View File

@ -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

View File

@ -1,5 +1,3 @@
SpecialPowers.setBoolPref("media.webspeech.synth.enabled", true);
var gSpeechRegistry = SpecialPowers.Cc["@mozilla.org/synth-voice-registry;1"]
.getService(SpecialPowers.Ci.nsISynthVoiceRegistry);
@ -170,7 +168,6 @@ function synthCleanup() {
.getService(SpecialPowers.Ci.nsISyncMessageSender);
mm.sendSyncMessage('test:SpeechSynthesis:ipcSynthCleanup');
}
SpecialPowers.clearUserPref("media.webspeech.synth.enabled");
}
function synthTestQueue(aTestArgs, aEndFunc) {

View File

@ -0,0 +1,84 @@
<!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>

View File

@ -0,0 +1,72 @@
<!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>

View File

@ -0,0 +1,56 @@
<!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>

View File

@ -1,6 +1,10 @@
[DEFAULT]
skip-if = e10s
support-files = common.js
support-files =
common.js
file_setup.html
file_speech_queue.html
file_speech_simple.html
[test_setup.html]
[test_speech_queue.html]

View File

@ -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,57 +21,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
/** 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);
SimpleTest.waitForExplicitFinish();
ok(SpeechSynthesis, "SpeechSynthesis exists in global scope");
ok(SpeechSynthesisVoice, "SpeechSynthesisVoice exists in global scope");
ok(SpeechSynthesisEvent, "SpeechSynthesisEvent exists in global scope");
SpecialPowers.pushPrefEnv({ set: [['media.webspeech.synth.enabled', true]] },
function() { document.getElementById("testFrame").src = "file_setup.html"; });
// 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>

View File

@ -13,6 +13,7 @@ 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>
@ -23,46 +24,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=525444
SimpleTest.waitForExplicitFinish();
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();
});
});
SpecialPowers.pushPrefEnv({ set: [['media.webspeech.synth.enabled', true]] },
function() { document.getElementById("testFrame").src = "file_speech_queue.html"; });
</script>
</pre>

View File

@ -13,6 +13,7 @@ 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>
@ -23,29 +24,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650295
SimpleTest.waitForExplicitFinish();
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.");
SpecialPowers.pushPrefEnv({ set: [['media.webspeech.synth.enabled', true]] },
function() { document.getElementById("testFrame").src = "file_speech_simple.html"; });
</script>
</pre>

View File

@ -13,10 +13,7 @@ var gGotNotHandlingDrop = false;
SimpleTest.waitForExplicitFinish();
function fireEvent(target, event) {
var utils =
window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
SpecialPowers.wrap(utils).dispatchDOMEventViaPresShell(target, event, true);
SpecialPowers.DOMWindowUtils.dispatchDOMEventViaPresShell(target, event, true);
}
function fireDrop(element, shouldAllowDrop, shouldAllowOnlyChromeDrop) {

View File

@ -43,8 +43,7 @@ var ConsoleObserver = {
// Close the window.
gBrowser.removeTab(tab, {animate: false});
// Ensure actual window destruction is not delayed (too long).
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils).garbageCollect();
SpecialPowers.DOMWindowUtils.garbageCollect();
// Ensure "inner-window-destroyed" event is processed,
// so the storage cache is cleared.
executeSoon(function () {

View File

@ -135,10 +135,7 @@ function messageReceiver(evt) {
function handleTestEnd() {
function gc() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.garbageCollect();
SpecialPowers.DOMWindowUtils.garbageCollect();
}
if (numTestsSet1) {
if (!--numTestsSet1) {

View File

@ -22,8 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=397571
/** Test for Bug 397571 **/
// Get the interface
var utils = window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
var utils = SpecialPowers.DOMWindowUtils.SpecialPowers_wrappedObject;
// Try to call functions without privileges
var success = false;

View File

@ -22,7 +22,8 @@ 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;

View File

@ -36,7 +36,8 @@ 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);

View File

@ -53,7 +53,8 @@ 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)
@ -72,7 +73,8 @@ 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)
@ -89,7 +91,8 @@ 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)

View File

@ -25,8 +25,7 @@ var layoutCSSBranch = prefService.getBranch("layout.css.");
var oldVal = layoutCSSBranch.getCharPref("devPixelsPerPx");
try {
var domWindowUtils = window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIDOMWindowUtils);
var domWindowUtils = SpecialPowers.DOMWindowUtils;
var devPxPerCSSPx = domWindowUtils.screenPixelsPerCSSPixel;
layoutCSSBranch.setCharPref("devPixelsPerPx", "2");

View File

@ -22,9 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
const Ci = Components.interfaces;
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
const utils = SpecialPowers.DOMWindowUtils;
function go() {
var wrappedWin = $('ifr').contentWindow;

View File

@ -8,10 +8,7 @@
window.expando = document.documentElement;
function testme(obj) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
const Ci = Components.interfaces;
const utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
const utils = SpecialPowers.DOMWindowUtils;
return utils.getClassName(obj) != "Proxy" &&
typeof obj.querySelector == 'function';

View File

@ -7,10 +7,8 @@
{
window.setTimeout(function()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
SpecialPowers.wrap(window).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor)
.getInterface(SpecialPowers.Ci.nsIWebNavigation)
.goBack();
}, 100);
}

View File

@ -117,9 +117,9 @@ function doKey(aKey, modifier) {
modifier = null;
// Window utils for sending fake sey events.
var wutils = window.QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor).
var wutils = SpecialPowers.wrap(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);