699{
700#if OO_CACHE_JS_SCRIPTS
702#endif
703 NSString *fileContents =
nil;
705 JSScript *script = NULL;
706
707 NSCParameterAssert(outScriptObject != NULL && outErrorMessage != NULL);
708 *outErrorMessage =
nil;
709
710#if OO_CACHE_JS_SCRIPTS
711
715 {
717 }
718#endif
719
720 if (script == NULL)
721 {
722 fileContents = [NSString stringWithContentsOfUnicodeFile:path];
723
724 if (fileContents !=
nil)
725 {
726#ifndef NDEBUG
727
728
729
730
731 if ([fileContents rangeOfString:@"\"use strict\";"].location == NSNotFound && [fileContents rangeOfString:@"'use strict';"].location == NSNotFound)
732 {
735 {
736
737
738 fileContents = [@"\"use strict\";\n" stringByAppendingString:fileContents];
739 }
740 }
741#endif
742 data = [fileContents utf16DataWithBOM:NO];
743 }
744 if (data ==
nil) *outErrorMessage =
@"could not load file";
745 else
746 {
747 script = JS_CompileUCScript(context, object, [data bytes], [data length] / sizeof(unichar), [path UTF8String], 1);
748 if (script != NULL) *outScriptObject = JS_NewScriptObject(context, script);
749 else *outErrorMessage = @"compilation failed";
750 }
751
752#if OO_CACHE_JS_SCRIPTS
753 if (script != NULL)
754 {
755
758 }
759#endif
760 }
761
762 return script;
763}
void OOStandardsDeprecated(NSString *message)
BOOL OOEnforceStandards(void)
static NSData * CompiledScriptData(JSContext *context, JSScript *script)
static JSScript * ScriptWithCompiledData(JSContext *context, NSData *data)
void setObject:forKey:inCache:(id inElement,[forKey] NSString *inKey,[inCache] NSString *inCacheKey)
id objectForKey:inCache:(NSString *inKey,[inCache] NSString *inCacheKey)
OOCacheManager * sharedCache()