Merge m-c to inbound.

This commit is contained in:
Ryan VanderMeulen 2012-06-18 20:59:17 -04:00
commit c5934032a4
14 changed files with 67 additions and 82 deletions

View File

@ -145,7 +145,7 @@ class B2GRemoteAutomation(Automation):
def restartB2G(self):
self._devicemanager.checkCmd(['shell', 'stop', 'b2g'])
# Wait for a bit to make sure B2G has completely shut down.
time.sleep(5)
time.sleep(10)
self._devicemanager.checkCmd(['shell', 'start', 'b2g'])
if self._is_emulator:
self.marionette.emulator.wait_for_port()
@ -192,7 +192,7 @@ class B2GRemoteAutomation(Automation):
# Infrequently, gecko comes up before networking does, so wait a little
# bit to give the network time to become available.
# XXX: need a more robust mechanism for this
time.sleep(20)
time.sleep(40)
# Set up port forwarding again for Marionette, since any that
# existed previously got wiped out by the reboot.

View File

@ -76,48 +76,18 @@ ExpectError.prototype = {
function addPermission(type, allow, url)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let uri;
if (url) {
uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
if (!url) {
url = window.document;
}
else {
uri = SpecialPowers.getDocumentURIObject(window.document);
}
let permission;
if (allow) {
permission = Components.interfaces.nsIPermissionManager.ALLOW_ACTION;
}
else {
permission = Components.interfaces.nsIPermissionManager.DENY_ACTION;
}
Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager)
.add(uri, type, permission);
SpecialPowers.addPermission(type, allow, url);
}
function removePermission(permission, url)
function removePermission(type, url)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let uri;
if (url) {
uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
if (!url) {
url = window.document;
}
else {
uri = SpecialPowers.getDocumentURIObject(window.document);
}
Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager)
.remove(uri.host, permission);
SpecialPowers.removePermission(type, url);
}
function allowIndexedDB(url)

View File

@ -25,10 +25,10 @@
let lockedFile2;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService()
.currentThread;
let comp = SpecialPowers.wrap(Components);
let thread = comp.classes["@mozilla.org/thread-manager;1"]
.getService(comp.interfaces.nsIThreadManager)
.currentThread;
let eventHasRun;

View File

@ -44,14 +44,14 @@
is(sawError, true, "Saw getMetadata() error");
// Make sure the success event isn't queued somehow.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService(Components.interfaces.nsIThreadManager)
.currentThread;
let comp = SpecialPowers.wrap(Components);
var thread = comp.classes["@mozilla.org/thread-manager;1"]
.getService(comp.interfaces.nsIThreadManager)
.currentThread;
while (thread.hasPendingEvents()) {
thread.processNextEvent(false);
}
}
}
finishTest();
yield;

View File

@ -3,7 +3,6 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var manager = null;
var bufferCache = [];
var utils = SpecialPowers.getDOMWindowUtils(window);
@ -171,12 +170,9 @@ function grabFileUsageAndContinueHandler(usage, fileUsage)
function getUsage(usageHandler)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if (!manager) {
manager = Components.classes["@mozilla.org/dom/indexeddb/manager;1"]
.getService(Components.interfaces.nsIIndexedDatabaseManager);
}
let comp = SpecialPowers.wrap(Components);
let idbManager = comp.classes["@mozilla.org/dom/indexeddb/manager;1"]
.getService(comp.interfaces.nsIIndexedDatabaseManager);
let uri = SpecialPowers.getDocumentURIObject(window.document);
let callback = {
@ -185,7 +181,7 @@ function getUsage(usageHandler)
}
};
manager.getUsageForURI(uri, callback);
idbManager.getUsageForURI(uri, callback);
}
function getUsageSync()
@ -196,10 +192,10 @@ function getUsageSync()
usage = aUsage;
});
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService(Components.interfaces.nsIThreadManager)
.currentThread;
let comp = SpecialPowers.wrap(Components);
let thread = comp.classes["@mozilla.org/thread-manager;1"]
.getService(comp.interfaces.nsIThreadManager)
.currentThread;
while (!usage) {
thread.processNextEvent(true);
}

View File

@ -62,8 +62,8 @@
continue;
}
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
isnot(result.mozFullPath, refResult.mozFullPath, "Different os files");
isnot(SpecialPowers.getMozFullPath(result),
SpecialPowers.getMozFullPath(refResult), "Different os files");
}
for (let i = 1; i < databases.length; i++) {
@ -86,8 +86,8 @@
verifyBlob(result, refResult, 2);
yield;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
isnot(result.mozFullPath, refResult.mozFullPath, "Different os files");
isnot(SpecialPowers.getMozFullPath(result),
SpecialPowers.getMozFullPath(refResult), "Different os files");
}
is(bufferCache.length, 2, "Correct length");

View File

@ -62,8 +62,8 @@
continue;
}
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
is(result.mozFullPath, refResult.mozFullPath, "The same os file");
is(SpecialPowers.getMozFullPath(result),
SpecialPowers.getMozFullPath(refResult), "The same os file");
}
for (let i = 1; i < objectStoreInfo.length; i++) {
@ -86,8 +86,8 @@
verifyBlob(result, refResult, 1);
yield;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
is(result.mozFullPath, refResult.mozFullPath, "The same os file");
is(SpecialPowers.getMozFullPath(result),
SpecialPowers.getMozFullPath(refResult), "The same os file");
}
is(bufferCache.length, 2, "Correct length");

View File

@ -36,23 +36,23 @@ function testSteps()
sawError = true;
event.preventDefault();
}
transaction.abort();
event = yield;
is(event.type, "abort", "Got abort event");
is(sawError, true, "Saw get() error");
if (this.window) {
// Make sure the success event isn't queued somehow.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService(Components.interfaces.nsIThreadManager)
.currentThread;
let comp = SpecialPowers.wrap(Components);
let thread = comp.classes["@mozilla.org/thread-manager;1"]
.getService(comp.interfaces.nsIThreadManager)
.currentThread;
while (thread.hasPendingEvents()) {
thread.processNextEvent(false);
}
}
}
finishTest();
yield;

View File

@ -23,11 +23,10 @@ function testSteps()
let transaction2;
if (this.window)
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let thread = Components.classes["@mozilla.org/thread-manager;1"]
.getService()
.currentThread;
let comp = this.window ? SpecialPowers.wrap(Components) : Components;
let thread = comp.classes["@mozilla.org/thread-manager;1"]
.getService(comp.interfaces.nsIThreadManager)
.currentThread;
let eventHasRun;

View File

@ -0,0 +1 @@
let testAnotherFunc = function() { return "i'm yet another test function!";};

View File

@ -13,6 +13,21 @@ class TestImportScript(MarionetteTestCase):
self.assertEqual("i'm a test function!", self.marionette.execute_script("return testFunc();"))
self.assertEqual("i'm a test function!", self.marionette.execute_async_script("marionetteScriptFinished(testFunc());"))
def test_importing_another_script_and_check_they_append(self):
firstjs = os.path.abspath(
os.path.join(__file__, os.path.pardir, "importscript.js"))
secondjs = os.path.abspath(
os.path.join(__file__, os.path.pardir, "importanotherscript.js"))
self.marionette.import_script(firstjs)
self.marionette.import_script(secondjs)
self.assertEqual("i'm a test function!",
self.marionette.execute_script("return testFunc();"))
self.assertEqual("i'm yet another test function!",
self.marionette.execute_script("return testAnotherFunc();"))
class TestImportScriptChrome(TestImportScript):
def setUp(self):
MarionetteTestCase.setUp(self)

View File

@ -1271,7 +1271,7 @@ MarionetteDriverActor.prototype = {
if (this.context == "chrome") {
let file;
if (this.importedScripts.exists()) {
file = FileUtils.openFileOutputStream(this.importedScripts, FileUtils.MODE_APPEND);
file = FileUtils.openFileOutputStream(this.importedScripts, FileUtils.MODE_APPEND | FileUtils.MODE_WRONLY);
}
else {
file = FileUtils.openFileOutputStream(this.importedScripts, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);

View File

@ -767,7 +767,7 @@ function emulatorCmdResult(msg) {
function importScript(msg) {
let file;
if (importedScripts.exists()) {
file = FileUtils.openFileOutputStream(importedScripts, FielUtils.MODE_APPEND);
file = FileUtils.openFileOutputStream(importedScripts, FileUtils.MODE_APPEND | FileUtils.MODE_WRONLY);
}
else {
file = FileUtils.openFileOutputStream(importedScripts, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);

View File

@ -1143,5 +1143,9 @@ SpecialPowersAPI.prototype = {
};
this._sendSyncMessage('SPPermissionManager', msg);
},
getMozFullPath: function(file) {
return file.mozFullPath;
}
};