Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Unified Diff: src/d8.cc

Issue 2922353002: Support reading a binary file as ArrayBuffer (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/d8.cc
diff --git a/src/d8.cc b/src/d8.cc
index c23458fc4f84955c1220aba6045fc98872384d1c..3ca0dae67a5b79e16701a1a839bc5edf4e7fdc38 100644
--- a/src/d8.cc
+++ b/src/d8.cc
@@ -1196,6 +1196,13 @@ void Shell::Read(const v8::FunctionCallbackInfo<v8::Value>& args) {
Throw(args.GetIsolate(), "Error loading file");
return;
}
+ if (args.Length() == 2) {
+ String::Utf8Value format(args[1]);
+ if (*format && std::strcmp(*format, "binary") == 0) {
+ ReadBuffer(args);
+ return;
+ }
+ }
Local<String> source = ReadFile(args.GetIsolate(), *file);
if (source.IsEmpty()) {
Throw(args.GetIsolate(), "Error loading file");
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698