Merge m-c to m-i

This commit is contained in:
Phil Ringnalda 2017-04-05 21:35:03 -07:00
commit ae74044b98
2 changed files with 18 additions and 17 deletions

View File

@ -197,10 +197,16 @@ function* createTempFile() {
let browser = gBrowser.selectedBrowser;
let path = fileInTempDir().path;
let fileCreated = yield ContentTask.spawn(browser, path, createFile);
ok(fileCreated == true, "creating a file in content temp is permitted");
// now delete the file
let fileDeleted = yield ContentTask.spawn(browser, path, deleteFile);
ok(fileDeleted == true, "deleting a file in content temp is permitted");
if (!fileCreated && isWin()) {
// TODO: fix 1329294 and enable this test for Windows.
// Not using todo() because this only fails on automation.
info("ignoring failure to write to content temp due to 1329294\n");
} else {
ok(fileCreated == true, "creating a file in content temp is permitted");
// now delete the file
let fileDeleted = yield ContentTask.spawn(browser, path, deleteFile);
ok(fileDeleted == true, "deleting a file in content temp is permitted");
}
}
// Test reading files and dirs from web and file content processes.

View File

@ -498,10 +498,6 @@ nsXREDirProvider::GetFile(const char* aProperty, bool* aPersistent,
}
#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
else if (!strcmp(aProperty, NS_APP_CONTENT_PROCESS_TEMP_DIR)) {
// If we are in the parent and the sandbox is enabled then mContentTempDir
// must have been created and set before anything calls for it.
MOZ_ASSERT_IF(XRE_IsParentProcess() && !IsContentSandboxDisabled(),
mContentTempDir);
if (!mContentTempDir && NS_FAILED((rv = LoadContentProcessTempDir()))) {
return rv;
}
@ -1150,15 +1146,6 @@ nsXREDirProvider::DoStartup()
static const char16_t kStartup[] = {'s','t','a','r','t','u','p','\0'};
obsSvc->NotifyObservers(nullptr, "profile-do-change", kStartup);
#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
// The parent is responsible for creating the sandbox temp dir. It needs to
// be called before it is used, which can happen later in this function.
if (XRE_IsParentProcess()) {
mContentProcessSandboxTempDir = CreateContentProcessSandboxTempDir();
mContentTempDir = mContentProcessSandboxTempDir;
}
#endif
// Init the Extension Manager
nsCOMPtr<nsIObserver> em = do_GetService("@mozilla.org/addons/integration;1");
if (em) {
@ -1213,6 +1200,14 @@ nsXREDirProvider::DoStartup()
}
obsSvc->NotifyObservers(nullptr, "profile-initial-state", nullptr);
#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
// The parent is responsible for creating the sandbox temp dir
if (XRE_IsParentProcess()) {
mContentProcessSandboxTempDir = CreateContentProcessSandboxTempDir();
mContentTempDir = mContentProcessSandboxTempDir;
}
#endif
}
return NS_OK;
}