Index: Source/bindings/core/v8/PrivateScriptRunner.cpp |
diff --git a/Source/bindings/core/v8/PrivateScriptRunner.cpp b/Source/bindings/core/v8/PrivateScriptRunner.cpp |
index 1295dbfe00062bb7261278c57f5d951d27ad9c57..e81bf5b25ae0274a0cd1d28f602222d48f06aba9 100644 |
--- a/Source/bindings/core/v8/PrivateScriptRunner.cpp |
+++ b/Source/bindings/core/v8/PrivateScriptRunner.cpp |
@@ -15,6 +15,7 @@ |
#include "core/PrivateScriptSourcesForTesting.h" |
#endif |
#include "core/dom/ExceptionCode.h" |
+#include "platform/PlatformResourceLoader.h" |
namespace blink { |
@@ -39,10 +40,10 @@ static void dumpV8Message(v8::Handle<v8::Message> message) |
fprintf(stderr, "%s (line %d): %s\n", fileName.utf8().data(), lineNumber, toCoreString(errorMessage).utf8().data()); |
} |
-static v8::Handle<v8::Value> compileAndRunPrivateScript(v8::Isolate* isolate, String scriptClassName, const unsigned char* source, size_t size) |
+static v8::Handle<v8::Value> compileAndRunPrivateScript(v8::Isolate* isolate, String scriptClassName, const char* source, size_t size) |
{ |
v8::TryCatch block; |
- String sourceString(reinterpret_cast<const char*>(source), size); |
+ String sourceString(source, size); |
String fileName = scriptClassName + ".js"; |
v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(v8String(isolate, sourceString), fileName, TextPosition::minimumPosition(), 0, isolate, NotSharableCrossOrigin, V8CacheOptionsOff); |
if (block.HasCaught()) { |
@@ -82,7 +83,8 @@ static void installPrivateScript(v8::Isolate* isolate, String className) |
// by make_private_script_source.py. |
for (size_t index = 0; index < WTF_ARRAY_LENGTH(kPrivateScriptSources); index++) { |
if (className == kPrivateScriptSources[index].className) { |
- compileAndRunPrivateScript(isolate, kPrivateScriptSources[index].scriptClassName, kPrivateScriptSources[index].source, kPrivateScriptSources[index].size); |
+ String resourceData = loadResourceAsASCIIString(kPrivateScriptSources[index].resourceFile); |
+ compileAndRunPrivateScript(isolate, kPrivateScriptSources[index].scriptClassName, resourceData.utf8().data(), resourceData.length()); |
compiledScriptCount++; |
} |
} |
@@ -107,7 +109,8 @@ static v8::Handle<v8::Value> installPrivateScriptRunner(v8::Isolate* isolate) |
fprintf(stderr, "Private script error: Target source code was not found. (Class name = %s)\n", className.utf8().data()); |
RELEASE_ASSERT_NOT_REACHED(); |
} |
- return compileAndRunPrivateScript(isolate, className, kPrivateScriptSources[index].source, kPrivateScriptSources[index].size); |
+ String resourceData = loadResourceAsASCIIString(kPrivateScriptSources[index].resourceFile); |
+ return compileAndRunPrivateScript(isolate, className, resourceData.utf8().data(), resourceData.length()); |
} |
static v8::Handle<v8::Object> classObjectOfPrivateScript(ScriptState* scriptState, String className) |