зеркало из https://github.com/mozilla/gecko-dev.git
Bug 778420 - Initial stab at the tests. v2 r=bholley
--HG-- extra : rebase_source : e014ba90baa75ba3146f4e3fb5c447b87a8e83c0
This commit is contained in:
Родитель
3ec06da029
Коммит
710c56850a
|
@ -26,6 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462856
|
||||||
<script class="testbody" type="text/javascript">
|
<script class="testbody" type="text/javascript">
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
const Cc = SpecialPowers.wrap(Components).classes;
|
||||||
|
|
||||||
var numFinished = 0;
|
var numFinished = 0;
|
||||||
|
|
||||||
|
@ -34,18 +35,17 @@ window.addEventListener("message", function(event) {
|
||||||
|
|
||||||
if (++numFinished == 3) {
|
if (++numFinished == 3) {
|
||||||
// Clean up after ourself
|
// Clean up after ourself
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var pm = Cc["@mozilla.org/permissionmanager;1"].
|
||||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
|
|
||||||
getService(Components.interfaces.nsIPermissionManager);
|
getService(Components.interfaces.nsIPermissionManager);
|
||||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
var ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||||
.getService(Components.interfaces.nsIIOService);
|
.getService(Components.interfaces.nsIIOService);
|
||||||
var uri1 = ioService.newURI(frames.testFrame.location, null, null);
|
var uri1 = ioService.newURI(frames.testFrame.location, null, null);
|
||||||
var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
|
var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
|
||||||
|
|
||||||
var principal1 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
var principal1 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||||
.getNoAppCodebasePrincipal(uri1);
|
.getNoAppCodebasePrincipal(uri1);
|
||||||
var principal2 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
var principal2 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||||
.getNoAppCodebasePrincipal(uri2);
|
.getNoAppCodebasePrincipal(uri2);
|
||||||
|
|
||||||
|
@ -108,8 +108,7 @@ function loaded() {
|
||||||
// Click the notification bar's "Allow" button. This should kick
|
// Click the notification bar's "Allow" button. This should kick
|
||||||
// off updates, which will eventually lead to getting messages from
|
// off updates, which will eventually lead to getting messages from
|
||||||
// the children.
|
// the children.
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
|
||||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
|
|
||||||
getService(Components.interfaces.nsIWindowMediator);
|
getService(Components.interfaces.nsIWindowMediator);
|
||||||
var win = wm.getMostRecentWindow("navigator:browser");
|
var win = wm.getMostRecentWindow("navigator:browser");
|
||||||
var notificationBox = win.gBrowser.getNotificationBox();
|
var notificationBox = win.gBrowser.getNotificationBox();
|
||||||
|
@ -117,7 +116,7 @@ function loaded() {
|
||||||
var notification = notificationBox.getNotificationWithValue("offline-app-requested-mochi.test");
|
var notification = notificationBox.getNotificationWithValue("offline-app-requested-mochi.test");
|
||||||
notification.childNodes[0].click();
|
notification.childNodes[0].click();
|
||||||
|
|
||||||
notification = notificationBox.getNotificationWithValue("offline-app-requested-example.com");
|
notification = SpecialPowers.wrap(notificationBox).getNotificationWithValue("offline-app-requested-example.com");
|
||||||
notification.childNodes[0].click();
|
notification.childNodes[0].click();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,15 +32,13 @@ SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
function finishTest() {
|
function finishTest() {
|
||||||
// Clean up after ourselves.
|
// Clean up after ourselves.
|
||||||
netscape.security.PrivilegeManager
|
var Cc = SpecialPowers.wrap(Components).classes;
|
||||||
.enablePrivilege("UniversalXPConnect");
|
var pm = Cc["@mozilla.org/permissionmanager;1"].
|
||||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
|
|
||||||
getService(Components.interfaces.nsIPermissionManager);
|
getService(Components.interfaces.nsIPermissionManager);
|
||||||
|
|
||||||
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
var uri = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService)
|
||||||
.getService(Components.interfaces.nsIIOService)
|
|
||||||
.newURI(window.frames[0].location, null, null);
|
.newURI(window.frames[0].location, null, null);
|
||||||
var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||||
.getNoAppCodebasePrincipal(uri);
|
.getNoAppCodebasePrincipal(uri);
|
||||||
|
|
||||||
|
@ -70,8 +68,6 @@ function handleMessageEvents(event) {
|
||||||
// successfully reloaded), or the string "error" appears
|
// successfully reloaded), or the string "error" appears
|
||||||
// in the iframe, as in the case of bug 501422.
|
// in the iframe, as in the case of bug 501422.
|
||||||
intervalID = setInterval(function() {
|
intervalID = setInterval(function() {
|
||||||
netscape.security.PrivilegeManager
|
|
||||||
.enablePrivilege("UniversalXPConnect");
|
|
||||||
// Sometimes document.body may not exist, and trying to access
|
// Sometimes document.body may not exist, and trying to access
|
||||||
// it will throw an exception, so handle this case.
|
// it will throw an exception, so handle this case.
|
||||||
try {
|
try {
|
||||||
|
@ -103,8 +99,7 @@ function loaded() {
|
||||||
// Click the notification bar's "Allow" button. This should kick
|
// Click the notification bar's "Allow" button. This should kick
|
||||||
// off updates, which will eventually lead to getting messages from
|
// off updates, which will eventually lead to getting messages from
|
||||||
// the iframe.
|
// the iframe.
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
|
||||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
|
|
||||||
getService(Components.interfaces.nsIWindowMediator);
|
getService(Components.interfaces.nsIWindowMediator);
|
||||||
var win = wm.getMostRecentWindow("navigator:browser");
|
var win = wm.getMostRecentWindow("navigator:browser");
|
||||||
var notificationBox = win.gBrowser.getNotificationBox();
|
var notificationBox = win.gBrowser.getNotificationBox();
|
||||||
|
|
|
@ -20,8 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589543
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
addLoadEvent(function() {
|
addLoadEvent(function() {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var doc = SpecialPowers.wrap($("testFrame").contentDocument);
|
||||||
var doc = $("testFrame").contentDocument;
|
|
||||||
var daddy = doc.getElementById("feedSubscribeLine");
|
var daddy = doc.getElementById("feedSubscribeLine");
|
||||||
var popup = doc.getAnonymousElementByAttribute(daddy, "anonid", "handlersMenuPopup");
|
var popup = doc.getAnonymousElementByAttribute(daddy, "anonid", "handlersMenuPopup");
|
||||||
isnot(popup, null, "Feed preview should have a handlers popup");
|
isnot(popup, null, "Feed preview should have a handlers popup");
|
||||||
|
|
|
@ -22,14 +22,13 @@
|
||||||
request.send(null);
|
request.send(null);
|
||||||
|
|
||||||
// Try reading headers in privileged context
|
// Try reading headers in privileged context
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
is(SpecialPowers.wrap(request).getResponseHeader("Set-Cookie"), "test", "Reading Set-Cookie response header in privileged context");
|
||||||
is(request.getResponseHeader("Set-Cookie"), "test", "Reading Set-Cookie response header in privileged context");
|
is(SpecialPowers.wrap(request).getResponseHeader("Set-Cookie2"), "test2", "Reading Set-Cookie2 response header in privileged context");
|
||||||
is(request.getResponseHeader("Set-Cookie2"), "test2", "Reading Set-Cookie2 response header in privileged context");
|
is(SpecialPowers.wrap(request).getResponseHeader("X-Dummy"), "test", "Reading X-Dummy response header in privileged context");
|
||||||
is(request.getResponseHeader("X-Dummy"), "test", "Reading X-Dummy response header in privileged context");
|
|
||||||
|
|
||||||
ok(/\bSet-Cookie:/i.test(request.getAllResponseHeaders()), "Looking for Set-Cookie in all response headers in privileged context");
|
ok(/\bSet-Cookie:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for Set-Cookie in all response headers in privileged context");
|
||||||
ok(/\bSet-Cookie2:/i.test(request.getAllResponseHeaders()), "Looking for Set-Cookie2 in all response headers in privileged context");
|
ok(/\bSet-Cookie2:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for Set-Cookie2 in all response headers in privileged context");
|
||||||
ok(/\bX-Dummy:/i.test(request.getAllResponseHeaders()), "Looking for X-Dummy in all response headers in privileged context");
|
ok(/\bX-Dummy:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for X-Dummy in all response headers in privileged context");
|
||||||
|
|
||||||
// Try reading headers in unprivileged context
|
// Try reading headers in unprivileged context
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
|
|
|
@ -32,26 +32,25 @@ var input2Files =
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
function setFileInputs () {
|
function setFileInputs () {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
f = createFileWithData(input1File.name, input1File.body);
|
f = createFileWithData(input1File.name, input1File.body);
|
||||||
singleFileInput.mozSetFileNameArray([f.path], 1);
|
SpecialPowers.wrap(singleFileInput).mozSetFileNameArray([f.path], 1);
|
||||||
|
|
||||||
var input2FileNames = [];
|
var input2FileNames = [];
|
||||||
for each (file in input2Files) {
|
for each (file in input2Files) {
|
||||||
f = createFileWithData(file.name, file.body);
|
f = createFileWithData(file.name, file.body);
|
||||||
input2FileNames.push(f.path);
|
input2FileNames.push(f.path);
|
||||||
}
|
}
|
||||||
multiFileInput.mozSetFileNameArray(input2FileNames, input2FileNames.length);
|
SpecialPowers.wrap(multiFileInput).mozSetFileNameArray(input2FileNames, input2FileNames.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFileWithData(fileName, fileData) {
|
function createFileWithData(fileName, fileData) {
|
||||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
var dirSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
|
||||||
.getService(Components.interfaces.nsIProperties);
|
.getService(Components.interfaces.nsIProperties);
|
||||||
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
|
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
|
||||||
testFile.append(fileName);
|
testFile.append(fileName);
|
||||||
var outStream = Components.
|
var outStream = SpecialPowers.wrap(Components).
|
||||||
classes["@mozilla.org/network/file-output-stream;1"].
|
classes["@mozilla.org/network/file-output-stream;1"].
|
||||||
createInstance(Components.interfaces.nsIFileOutputStream);
|
createInstance(Components.interfaces.nsIFileOutputStream);
|
||||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||||
0666, 0);
|
0666, 0);
|
||||||
outStream.write(fileData, fileData.length);
|
outStream.write(fileData, fileData.length);
|
||||||
|
|
|
@ -55,9 +55,7 @@ function checkURI(uri, name, type) {
|
||||||
|
|
||||||
function checkFrame(num) {
|
function checkFrame(num) {
|
||||||
// Just snarf our data
|
// Just snarf our data
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var outer = SpecialPowers.wrap(window.frames[num]);
|
||||||
|
|
||||||
var outer = window.frames[num]
|
|
||||||
name = outer.name;
|
name = outer.name;
|
||||||
|
|
||||||
is(outer.document.baseURI,
|
is(outer.document.baseURI,
|
||||||
|
|
|
@ -24,21 +24,19 @@ var frame = document.getElementById("i");
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
addLoadEvent(function() {
|
addLoadEvent(function() {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
var viewer =
|
var viewer =
|
||||||
frame.contentWindow
|
SpecialPowers.wrap(frame.contentWindow
|
||||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor))
|
||||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||||
.contentViewer
|
.contentViewer
|
||||||
.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
|
.QueryInterface(Components.interfaces.nsIMarkupDocumentViewer);
|
||||||
|
|
||||||
viewer.fullZoom = 1.5;
|
viewer.fullZoom = 1.5;
|
||||||
|
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
synthesizeMouse(frame, 30, 30, {});
|
synthesizeMouse(frame, 30, 30, {});
|
||||||
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
is(viewer.fullZoom, 1.5, "Zoom in the image frame should not have been reset");
|
is(viewer.fullZoom, 1.5, "Zoom in the image frame should not have been reset");
|
||||||
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
|
|
@ -116,9 +116,8 @@ function test5()
|
||||||
SimpleTest.executeSoon(function() {
|
SimpleTest.executeSoon(function() {
|
||||||
// We have to focus back the originating window but we can't do that with
|
// We have to focus back the originating window but we can't do that with
|
||||||
// .focus() or .blur() anymore.
|
// .focus() or .blur() anymore.
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var fm = SpecialPowers.wrap(Components).classes["@mozilla.org/focus-manager;1"]
|
||||||
var fm = Components.classes["@mozilla.org/focus-manager;1"].
|
.getService(Components.interfaces.nsIFocusManager);
|
||||||
getService(Components.interfaces.nsIFocusManager);
|
|
||||||
fm.focusedWindow = window;
|
fm.focusedWindow = window;
|
||||||
});
|
});
|
||||||
}, w, true);
|
}, w, true);
|
||||||
|
@ -126,10 +125,9 @@ function test5()
|
||||||
|
|
||||||
function finished()
|
function finished()
|
||||||
{
|
{
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
|
||||||
Components.classes["@mozilla.org/preferences-service;1"]
|
.getService(Components.interfaces.nsIPrefBranch)
|
||||||
.getService(Components.interfaces.nsIPrefBranch)
|
.setBoolPref("dom.disable_window_flip", gOldPrefValue);
|
||||||
.setBoolPref("dom.disable_window_flip", gOldPrefValue);
|
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,9 +135,8 @@ SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
|
||||||
// dom.disable_window_flip has to be set to true for this test.
|
// dom.disable_window_flip has to be set to true for this test.
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var prefs = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
|
||||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
.getService(Components.interfaces.nsIPrefBranch);
|
||||||
.getService(Components.interfaces.nsIPrefBranch);
|
|
||||||
gOldPrefValue = prefs.getBoolPref("dom.disable_window_flip");
|
gOldPrefValue = prefs.getBoolPref("dom.disable_window_flip");
|
||||||
prefs.setBoolPref("dom.disable_window_flip", true);
|
prefs.setBoolPref("dom.disable_window_flip", true);
|
||||||
|
|
||||||
|
|
|
@ -153,8 +153,7 @@ function popstateExpected(msg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getColor(elem) {
|
function getColor(elem) {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var utils = SpecialPowers.wrap(document).defaultView.
|
||||||
var utils = document.defaultView.
|
|
||||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||||
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||||
return utils.getVisitedDependentComputedStyle(elem, "", "color");
|
return utils.getVisitedDependentComputedStyle(elem, "", "color");
|
||||||
|
@ -162,12 +161,10 @@ function getColor(elem) {
|
||||||
|
|
||||||
function getSHistory(theWindow)
|
function getSHistory(theWindow)
|
||||||
{
|
{
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
|
|
||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
var sh = theWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
var sh = SpecialPowers.wrap(theWindow.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.sessionHistory;
|
.sessionHistory;
|
||||||
if (!sh || sh == null)
|
if (!sh || sh == null)
|
||||||
throw("Couldn't get shistory for window!");
|
throw("Couldn't get shistory for window!");
|
||||||
|
|
||||||
|
@ -176,8 +173,6 @@ function getSHistory(theWindow)
|
||||||
|
|
||||||
function getSHTitle(sh, offset)
|
function getSHTitle(sh, offset)
|
||||||
{
|
{
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
|
|
||||||
if (!offset)
|
if (!offset)
|
||||||
offset = 0;
|
offset = 0;
|
||||||
|
|
||||||
|
|
|
@ -22,11 +22,10 @@ var iframe = document.getElementById("load-frame");
|
||||||
function enableJS() allowJS(true, iframe);
|
function enableJS() allowJS(true, iframe);
|
||||||
function disableJS() allowJS(false, iframe);
|
function disableJS() allowJS(false, iframe);
|
||||||
function allowJS(allow, frame) {
|
function allowJS(allow, frame) {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
SpecialPowers.wrap(frame.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor))
|
||||||
frame.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
.allowJavascript = allow;
|
||||||
.allowJavascript = allow;
|
|
||||||
}
|
}
|
||||||
function expectJSAllowed(allowed, testCondition, callback) {
|
function expectJSAllowed(allowed, testCondition, callback) {
|
||||||
window.ICanRunMyJS = false;
|
window.ICanRunMyJS = false;
|
||||||
|
|
|
@ -36,10 +36,10 @@ function editDoc() {
|
||||||
function getSpellCheckSelection() {
|
function getSpellCheckSelection() {
|
||||||
var Ci = Components.interfaces;
|
var Ci = Components.interfaces;
|
||||||
var win = editDoc().defaultView;
|
var win = editDoc().defaultView;
|
||||||
var editingSession = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
var editingSession = SpecialPowers.wrap(win.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIEditingSession);
|
.getInterface(Ci.nsIEditingSession);
|
||||||
var editor = editingSession.getEditorForWindow(win);
|
var editor = editingSession.getEditorForWindow(win);
|
||||||
var selcon = editor.selectionController;
|
var selcon = editor.selectionController;
|
||||||
return selcon.getSelection(selcon.SELECTION_SPELLCHECK);
|
return selcon.getSelection(selcon.SELECTION_SPELLCHECK);
|
||||||
|
@ -51,7 +51,6 @@ function runTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function addWords(aLimit) {
|
function addWords(aLimit) {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
if (aLimit == 0) {
|
if (aLimit == 0) {
|
||||||
is(isSpellingCheckOk(), true, "All misspellings accounted for.");
|
is(isSpellingCheckOk(), true, "All misspellings accounted for.");
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
|
|
@ -20,8 +20,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=468353
|
||||||
var styleSheets = null;
|
var styleSheets = null;
|
||||||
|
|
||||||
function checkStylesheets() {
|
function checkStylesheets() {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
|
|
||||||
// Evidently RemoveStyleSheet is the only method in nsIEditorStyleSheets
|
// Evidently RemoveStyleSheet is the only method in nsIEditorStyleSheets
|
||||||
// that would throw. RemoveOverrideStyleSheet returns NS_OK even if the
|
// that would throw. RemoveOverrideStyleSheet returns NS_OK even if the
|
||||||
// sheet is not there
|
// sheet is not there
|
||||||
|
@ -43,8 +41,6 @@ function checkStylesheets() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function runTest() {
|
function runTest() {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
|
|
||||||
const Ci = Components.interfaces;
|
const Ci = Components.interfaces;
|
||||||
const Cc = Components.classes;
|
const Cc = Components.classes;
|
||||||
|
|
||||||
|
@ -58,7 +54,7 @@ function runTest() {
|
||||||
editdoc.designMode='on';
|
editdoc.designMode='on';
|
||||||
|
|
||||||
// Hold the reference to the editor
|
// Hold the reference to the editor
|
||||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIEditingSession)
|
.getInterface(Ci.nsIEditingSession)
|
||||||
|
@ -77,7 +73,7 @@ function runTest() {
|
||||||
editdoc.body.contentEditable = true;
|
editdoc.body.contentEditable = true;
|
||||||
|
|
||||||
// Hold the reference to the editor
|
// Hold the reference to the editor
|
||||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIEditingSession)
|
.getInterface(Ci.nsIEditingSession)
|
||||||
|
@ -94,7 +90,7 @@ function runTest() {
|
||||||
editdoc.designMode = "off";
|
editdoc.designMode = "off";
|
||||||
|
|
||||||
// Hold the reference to the editor
|
// Hold the reference to the editor
|
||||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIEditingSession)
|
.getInterface(Ci.nsIEditingSession)
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
<script class="testbody" type="application/javascript">
|
<script class="testbody" type="application/javascript">
|
||||||
|
|
||||||
function runTest() {
|
function runTest() {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
|
|
||||||
function verifyContent(s) {
|
function verifyContent(s) {
|
||||||
var e = document.getElementById('i1');
|
var e = document.getElementById('i1');
|
||||||
var doc = e.contentDocument;
|
var doc = e.contentDocument;
|
||||||
|
@ -27,7 +25,7 @@ function runTest() {
|
||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
selection.selectAllChildren(e);
|
selection.selectAllChildren(e);
|
||||||
selection.collapseToEnd();
|
selection.collapseToEnd();
|
||||||
doc.execCommand("paste", false, null);
|
SpecialPowers.wrap(doc).execCommand("paste", false, null);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +49,7 @@ function runTest() {
|
||||||
range.selectNode(doc.getElementById(target_id));
|
range.selectNode(doc.getElementById(target_id));
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
}
|
}
|
||||||
doc.execCommand("copy", false, null);
|
SpecialPowers.wrap(doc).execCommand("copy", false, null);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,6 @@
|
||||||
<script class="testbody" type="application/javascript">
|
<script class="testbody" type="application/javascript">
|
||||||
|
|
||||||
function runTest() {
|
function runTest() {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
|
|
||||||
function verifyContent(s) {
|
function verifyContent(s) {
|
||||||
var e = document.getElementById('i1');
|
var e = document.getElementById('i1');
|
||||||
var doc = e.contentDocument;
|
var doc = e.contentDocument;
|
||||||
|
@ -30,7 +28,7 @@ function runTest() {
|
||||||
selection.removeAllRanges();
|
selection.removeAllRanges();
|
||||||
selection.selectAllChildren(e);
|
selection.selectAllChildren(e);
|
||||||
selection.collapseToEnd();
|
selection.collapseToEnd();
|
||||||
doc.execCommand("paste", false, null);
|
SpecialPowers.wrap(doc).execCommand("paste", false, null);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +52,7 @@ function runTest() {
|
||||||
range.selectNode(doc.getElementById(target_id));
|
range.selectNode(doc.getElementById(target_id));
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
}
|
}
|
||||||
doc.execCommand("copy", false, null);
|
SpecialPowers.wrap(doc).execCommand("copy", false, null);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -563,13 +563,11 @@ function runTest(test) {
|
||||||
} else
|
} else
|
||||||
elem.focus();
|
elem.focus();
|
||||||
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var trans = SpecialPowers.wrap(Components).classes["@mozilla.org/widget/transferable;1"]
|
||||||
|
.createInstance(Components.interfaces.nsITransferable);
|
||||||
var trans = Components.classes["@mozilla.org/widget/transferable;1"]
|
|
||||||
.createInstance(Components.interfaces.nsITransferable);
|
|
||||||
trans.init(getLoadContext());
|
trans.init(getLoadContext());
|
||||||
var data = Components.classes["@mozilla.org/supports-string;1"]
|
var data = SpecialPowers.wrap(Components).classes["@mozilla.org/supports-string;1"]
|
||||||
.createInstance(Components.interfaces.nsISupportsString);
|
.createInstance(Components.interfaces.nsISupportsString);
|
||||||
data.data = test.payload;
|
data.data = test.payload;
|
||||||
trans.addDataFlavor("text/html");
|
trans.addDataFlavor("text/html");
|
||||||
trans.setTransferData("text/html", data, data.data.length * 2);
|
trans.setTransferData("text/html", data, data.data.length * 2);
|
||||||
|
@ -582,14 +580,14 @@ function runTest(test) {
|
||||||
getSelection().collapse(elem, 0);
|
getSelection().collapse(elem, 0);
|
||||||
win = window;
|
win = window;
|
||||||
}
|
}
|
||||||
editor = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
editor = SpecialPowers.wrap(win).QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
.QueryInterface(Components.interfaces.nsIEditorDocShell)
|
.QueryInterface(Components.interfaces.nsIEditorDocShell)
|
||||||
.editor;
|
.editor;
|
||||||
editor.pasteTransferable(trans);
|
editor.pasteTransferable(trans);
|
||||||
} else {
|
} else {
|
||||||
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
|
var clipboard = SpecialPowers.wrap(Components).classes["@mozilla.org/widget/clipboard;1"]
|
||||||
.getService(Components.interfaces.nsIClipboard);
|
.getService(Components.interfaces.nsIClipboard);
|
||||||
|
|
||||||
clipboard.setData(trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
clipboard.setData(trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||||
|
|
||||||
|
|
|
@ -7,13 +7,14 @@
|
||||||
|
|
||||||
<script class="testbody" type="application/javascript">
|
<script class="testbody" type="application/javascript">
|
||||||
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
var utils = SpecialPowers.wrap(window)
|
||||||
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||||
var Cc = Components.classes;
|
var Cc = SpecialPowers.wrap(Components).classes;
|
||||||
var Ci = Components.interfaces;
|
var Ci = Components.interfaces;
|
||||||
|
|
||||||
function getLoadContext() {
|
function getLoadContext() {
|
||||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
return SpecialPowers.wrap(window)
|
||||||
|
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIWebNavigation)
|
.getInterface(Ci.nsIWebNavigation)
|
||||||
.QueryInterface(Ci.nsILoadContext);
|
.QueryInterface(Ci.nsILoadContext);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +30,6 @@ function runTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function pasteInto(trans, html, target_id) {
|
function pasteInto(trans, html, target_id) {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
var e = document.getElementById('i1');
|
var e = document.getElementById('i1');
|
||||||
var doc = e.contentDocument;
|
var doc = e.contentDocument;
|
||||||
doc.designMode = "on";
|
doc.designMode = "on";
|
||||||
|
@ -53,7 +53,6 @@ function runTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTransferableFromClipboard(asHTML) {
|
function getTransferableFromClipboard(asHTML) {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
|
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
|
||||||
trans.init(getLoadContext());
|
trans.init(getLoadContext());
|
||||||
if (asHTML) {
|
if (asHTML) {
|
||||||
|
@ -67,8 +66,6 @@ function runTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeTransferable(s,asHTML,target_id) {
|
function makeTransferable(s,asHTML,target_id) {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
|
|
||||||
var e = document.getElementById('i2');
|
var e = document.getElementById('i2');
|
||||||
var doc = e.contentDocument;
|
var doc = e.contentDocument;
|
||||||
if (asHTML) {
|
if (asHTML) {
|
||||||
|
@ -112,7 +109,6 @@ function runTest() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function copyToClipBoard(s,asHTML,target_id) {
|
function copyToClipBoard(s,asHTML,target_id) {
|
||||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
||||||
var e = document.getElementById('i2');
|
var e = document.getElementById('i2');
|
||||||
var doc = e.contentDocument;
|
var doc = e.contentDocument;
|
||||||
if (asHTML) {
|
if (asHTML) {
|
||||||
|
@ -132,7 +128,7 @@ function runTest() {
|
||||||
range.selectNode(doc.getElementById(target_id));
|
range.selectNode(doc.getElementById(target_id));
|
||||||
selection.addRange(range);
|
selection.addRange(range);
|
||||||
}
|
}
|
||||||
doc.execCommand("copy", false, null);
|
SpecialPowers.wrap(doc).execCommand("copy", false, null);
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
SimpleTest.waitForFocus(runTest);
|
SimpleTest.waitForFocus(runTest);
|
||||||
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
|
|
||||||
function runDesignModeTest(aDoc, aFocus, aNewSource)
|
function runDesignModeTest(aDoc, aFocus, aNewSource)
|
||||||
{
|
{
|
||||||
aDoc.designMode = "on";
|
aDoc.designMode = "on";
|
||||||
|
@ -83,11 +81,9 @@ var gSetFocusToIFrame = false;
|
||||||
|
|
||||||
function onLoadIFrame()
|
function onLoadIFrame()
|
||||||
{
|
{
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
|
|
||||||
var frameDoc = gIFrame.contentWindow.document;
|
var frameDoc = gIFrame.contentWindow.document;
|
||||||
|
|
||||||
var selCon = gIFrame.contentWindow.
|
var selCon = SpecialPowers.wrap(gIFrame).contentWindow.
|
||||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||||
getInterface(Components.interfaces.nsIWebNavigation).
|
getInterface(Components.interfaces.nsIWebNavigation).
|
||||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||||
|
|
|
@ -36,9 +36,8 @@ addLoadEvent(function() {
|
||||||
ok(equal, "Show/hide should have no effect",
|
ok(equal, "Show/hide should have no effect",
|
||||||
"got " + str1 + " but expected " + str2);
|
"got " + str1 + " but expected " + str2);
|
||||||
|
|
||||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
|
||||||
var viewer =
|
var viewer =
|
||||||
$("ourFrame").contentWindow
|
SpecialPowers.wrap($("ourFrame")).contentWindow
|
||||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче