This commit is contained in:
Phil Ringnalda 2017-01-09 18:49:22 -08:00
Родитель 0a8b98e56c 225ab0637e
Коммит 8e3c56f8cf
12 изменённых файлов: 41 добавлений и 53 удалений

Просмотреть файл

@ -32,6 +32,7 @@ function dumpAccessibleNode(aNode, level) {
function dumpAccessibleTree(aNode, level) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
level = level || 0;
dumpAccessibleNode(aNode, level);
@ -47,12 +48,14 @@ function dumpAccessibleTree(aNode, level) {
}
function A(o) {
var acc = SpecialPowers.Cc['@mozilla.org/accessibilityService;1']
.getService(SpecialPowers.Ci.nsIAccessibilityService);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var acc = Components.classes['@mozilla.org/accessibilityService;1']
.getService(Components.interfaces.nsIAccessibilityService);
return acc.getAccessibleFor(o);
}
function beginAccessible() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
dumpAccessibleTree(A(document),0);
}
setTimeout(beginAccessible, 100);

Просмотреть файл

@ -1,6 +1,6 @@
<script>
var win = SpecialPowers.wrap(window).wrappedJSObject;
win.opener.opener.postMessage(win.opener.testNum + " - " + win.x, "http://mochi.test:8888");
win.opener.close();
win.close();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
window.opener.opener.postMessage(window.opener.testNum + " - " + window.x, "http://mochi.test:8888");
window.opener.close();
window.close();
</script>

Просмотреть файл

@ -1,5 +1,5 @@
<script>
var win = SpecialPowers.wrap(window).wrappedJSObject;
win.parent.opener.postMessage(win.parent.testNum + " - " + win.x, "http://mochi.test:8888");
win.parent.close();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
window.parent.opener.postMessage(window.parent.testNum + " - " + window.x, "http://mochi.test:8888");
window.parent.close();
</script>

Просмотреть файл

@ -37,11 +37,14 @@ function handleCmd(evt) {
return false;
}
// Grab privileges so we can access cross-domain windows
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if ("load" in cmd) {
var testNum = cmd.load;
var win = SpecialPowers.wrap(wins[testNum]).wrappedJSObject;
var win = wins[testNum];
win.childWin.x = testNum;
if (SpecialPowers.unwrap(win.childWin.opener) == SpecialPowers.unwrap(win)) {
if (win.childWin.opener == win) {
if ("xsite" in cmd) {
var loc = r(window.location.href, "bug346659-opener-echoer.html");
} else {

Просмотреть файл

@ -29,11 +29,12 @@ var promptState;
function registerMockPromptService()
{
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var XPCOMUtils = SpecialPowers.Cu.import("resource://gre/modules/XPCOMUtils.jsm").XPCOMUtils;
var Ci = SpecialPowers.Ci;
function MockPrompt(aDOMWindow) {
this.domWindow = SpecialPowers.unwrap(aDOMWindow);
this.domWindow = aDOMWindow;
}
MockPrompt.prototype = {

Просмотреть файл

@ -92,6 +92,7 @@ function persistDocument(aDoc) {
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var srcDoc = document.getElementById('source').contentDocument;
persistDocument(srcDoc);
});

Просмотреть файл

@ -37,30 +37,21 @@ MockObjectRegisterer.prototype = {
throw new Exception("Invalid object state when calling register()");
// Define a factory that creates a new object using the given constructor.
var isChrome = location.protocol == "chrome:";
var providedConstructor = this._replacementCtor;
this._mockFactory = {
createInstance: function MF_createInstance(aOuter, aIid) {
if (aOuter != null)
throw SpecialPowers.Cr.NS_ERROR_NO_AGGREGATION;
var inst = new providedConstructor();
if (!isChrome) {
var QI = inst.QueryInterface;
inst = SpecialPowers.wrapCallbackObject(inst);
inst.QueryInterface = QI;
}
return inst.QueryInterface(aIid);
return new providedConstructor().QueryInterface(aIid);
}
};
if (!isChrome) {
this._mockFactory = SpecialPowers.wrapCallbackObject(this._mockFactory);
}
var retVal = SpecialPowers.swapFactoryRegistration(null, this._contractID, this._mockFactory, this._originalFactory);
var retVal = SpecialPowers.swapFactoryRegistration(this._cid, this._contractID, this._mockFactory, this._originalFactory);
if ('error' in retVal) {
throw new Exception("ERROR: " + retVal.error);
} else {
this._originalFactory = SpecialPowers.wrap(retVal).originalFactory;
this._cid = retVal.cid;
this._originalFactory = retVal.originalFactory;
}
},
@ -72,9 +63,10 @@ MockObjectRegisterer.prototype = {
throw new Exception("Invalid object state when calling unregister()");
// Free references to the mock factory.
SpecialPowers.swapFactoryRegistration(null, this._contractID, this._originalFactory, this._mockFactory);
SpecialPowers.swapFactoryRegistration(this._cid, this._contractID, this._mockFactory, this._originalFactory);
// Allow registering a mock factory again later.
this._cid = null;
this._originalFactory = null;
this._mockFactory = null;
},
@ -86,6 +78,11 @@ MockObjectRegisterer.prototype = {
*/
_originalFactory: null,
/**
* The CID under which the mock contractID was registered.
*/
_cid: null,
/**
* The nsIFactory that was automatically generated by this object.
*/

Просмотреть файл

@ -17,18 +17,9 @@
</form>
<script>
var parentOrigin = "http://mochi.test:8888";
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
if (event.origin !== parentOrigin) {
parent.postMessage({error: "unexpected origin " + event.origin}, parentOrigin);
return;
}
clickButton(+event.data);
}
function checkSubmit(num) {
return parent.postMessage({num}, parentOrigin);
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
return parent.checkSubmit(num);
}
function clickButton(num) {

Просмотреть файл

@ -256,16 +256,6 @@
<pre id="test">
<script class="testbody" type="text/javascript">
/* import-globals-from satchel_common.js */
var iframeOrigin = "https://example.com";
window.addEventListener("message", receiveMessage, false);
function receiveMessage(event) {
is(event.origin, iframeOrigin, "checking origin");
if (event.data.error) {
ok(false, event.data.error);
}
checkSubmit(+event.data.num);
}
var numSubmittedForms = 0;
var ccNumbers = {
@ -375,6 +365,7 @@ function startTest() {
// Called by each form's onsubmit handler.
function checkSubmit(formNum) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
ok(true, "form " + formNum + " submitted");
numSubmittedForms++;
@ -510,7 +501,7 @@ function submitForm(formNum) {
// from an HTTPS domain in an iframe.
if (nextFormNum == 21 || nextFormNum == 100) {
ok(true, "submitting iframe test " + nextFormNum);
document.getElementById("iframe").contentWindow.postMessage(nextFormNum, iframeOrigin);
document.getElementById("iframe").contentWindow.clickButton(nextFormNum);
} else {
var button = getFormSubmitButton(nextFormNum);
button.click();

Просмотреть файл

@ -16,9 +16,6 @@ support-files = window_bug478536.xul
[test_bug517396.xul]
[test_bug538242.xul]
support-files = window_bug538242.xul
[test_bug565392.html]
subsuite = clipboard
skip-if = toolkit != "windows"
[test_bug593307.xul]
support-files = window_bug593307_offscreen.xul window_bug593307_centerscreen.xul
[test_bug1151186.html]

Просмотреть файл

@ -4,6 +4,9 @@ support-files = utils.js
[test_assign_event_data.html]
subsuite = clipboard
skip-if = toolkit == "cocoa" # Mac: Bug 933303
[test_bug565392.html]
subsuite = clipboard
skip-if = toolkit != "windows" || e10s # Bug 1267406
[test_picker_no_crash.html]
skip-if = toolkit != "windows" || e10s # Bug 1267491
support-files = window_picker_no_crash_child.html

Просмотреть файл

@ -5,8 +5,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565392
-->
<head>
<title>Test for Bug 565392</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=565392">Mozilla Bug 565392</a>
@ -19,6 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=565392
/** Test for Bug 565392 **/
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
var ds = Cc["@mozilla.org/file/directory_service;1"]