Bug 813762: Teach OS.File about compartment sharing. r=mrbkap

This commit is contained in:
Kyle Huey 2012-11-26 08:55:12 -08:00
parent 9ce11fb93c
commit 439a5889fa
2 changed files with 12 additions and 6 deletions

View File

@ -78,7 +78,10 @@ EXPORTS_mozilla = \
$(NULL)
# We fire the nsDOMDeviceAcceleration
LOCAL_INCLUDES += -I$(topsrcdir)/content/events/src
LOCAL_INCLUDES += \
-I$(topsrcdir)/content/events/src \
-I$(topsrcdir)/js/xpconnect/loader \
$(NULL)
ifdef ENABLE_TESTS
DIRS += tests

View File

@ -36,6 +36,7 @@
#include "nsAutoPtr.h"
#include "nsDirectoryServiceDefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "mozJSComponentLoader.h"
#include "OSFileConstants.h"
#include "nsIOSFileConstantsService.h"
@ -699,11 +700,13 @@ OSFileConstantsService::Init(JSContext *aCx)
return rv;
}
JSObject *global = JS_GetGlobalForScopeChain(aCx);
if (!global) {
return NS_ERROR_NOT_AVAILABLE;
}
if (!mozilla::DefineOSFileConstants(aCx, global)) {
JSObject *targetObj = nullptr;
mozJSComponentLoader* loader = mozJSComponentLoader::Get();
rv = loader->FindTargetObject(aCx, &targetObj);
NS_ENSURE_SUCCESS(rv, rv);
if (!mozilla::DefineOSFileConstants(aCx, targetObj)) {
return NS_ERROR_FAILURE;
}