Bug 804562 - fix file permissions for marionette imported scripts, r=jgriffin
authorMalini Das <mdas@mozilla.com>
Wed, 24 Oct 2012 11:36:43 -0400
changeset 111386 8aa98d89341f5dfc95623502e29b27c511eccd3b
parent 111385 fd6c7fa6b826c8c9d48fee2ff02e75b697af461e
child 111387 8fd0d9938697428c24b85ba750e3023dcb3cadb6
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjgriffin
bugs804562
milestone19.0a1
Bug 804562 - fix file permissions for marionette imported scripts, r=jgriffin
testing/marionette/marionette-actors.js
testing/marionette/marionette-listener.js
--- a/testing/marionette/marionette-actors.js
+++ b/testing/marionette/marionette-actors.js
@@ -1538,17 +1538,20 @@ MarionetteDriverActor.prototype = {
   
   importScript: function MDA_importScript(aRequest) {
     if (this.context == "chrome") {
       let file;
       if (this.importedScripts.exists()) {
         file = FileUtils.openFileOutputStream(this.importedScripts, FileUtils.MODE_APPEND | FileUtils.MODE_WRONLY);
       }
       else {
+        //Note: The permission bits here don't actually get set (bug 804563)
+        this.importedScripts.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
         file = FileUtils.openFileOutputStream(this.importedScripts, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);
+        this.importedScripts.permissions = parseInt("0666", 8); //actually set permissions
       }
       file.write(aRequest.script, aRequest.script.length);
       file.close();
       this.sendOk();
     }
     else {
       this.sendAsync("importScript", {script: aRequest.script});
     }
--- a/testing/marionette/marionette-listener.js
+++ b/testing/marionette/marionette-listener.js
@@ -890,17 +890,20 @@ function emulatorCmdResult(msg) {
 }
 
 function importScript(msg) {
   let file;
   if (importedScripts.exists()) {
     file = FileUtils.openFileOutputStream(importedScripts, FileUtils.MODE_APPEND | FileUtils.MODE_WRONLY);
   }
   else {
+    //Note: The permission bits here don't actually get set (bug 804563)
+    importedScripts.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, parseInt("0666", 8));
     file = FileUtils.openFileOutputStream(importedScripts, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE);
+    importedScripts.permissions = parseInt("0666", 8); //actually set permissions
   }
   file.write(msg.json.script, msg.json.script.length);
   file.close();
   sendOk();
 }
 
 //call register self when we get loaded
 registerSelf();