Index: chrome/renderer/loadtimes_extension_bindings.cc |
diff --git a/chrome/renderer/loadtimes_extension_bindings.cc b/chrome/renderer/loadtimes_extension_bindings.cc |
index a1aad263c03b96d47762d65ffce72580ab480ea0..c45acaa9a4357730b387dc5838c9bb098c178b4c 100644 |
--- a/chrome/renderer/loadtimes_extension_bindings.cc |
+++ b/chrome/renderer/loadtimes_extension_bindings.cc |
@@ -8,6 +8,7 @@ |
#include "base/time/time.h" |
#include "content/public/renderer/document_state.h" |
+#include "extensions/renderer/v8_helpers.h" |
#include "net/http/http_response_info.h" |
#include "third_party/WebKit/public/web/WebLocalFrame.h" |
#include "third_party/WebKit/public/web/WebPerformance.h" |
@@ -105,6 +106,13 @@ class LoadTimesExtensionWrapper : public v8::Extension { |
return kTransitionOther; |
} |
+ static void TestLoadtimesGetter( |
+ v8::Local<v8::Name> name, |
+ const v8::PropertyCallbackInfo<v8::Value>& info) { |
+ v8::Local<v8::Object> param = v8::Local<v8::Object>::Cast(info.Data()); |
adamk
2016/07/14 22:09:03
Object here is the wrong type (since you might hav
|
+ info.GetReturnValue().Set(param); |
+ } |
+ |
static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) { |
args.GetReturnValue().SetNull(); |
WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext(); |
@@ -170,11 +178,15 @@ class LoadTimesExtensionWrapper : public v8::Extension { |
v8::Isolate* isolate = args.GetIsolate(); |
v8::Local<v8::Context> ctx = isolate->GetCurrentContext(); |
v8::Local<v8::Object> load_times = v8::Object::New(isolate); |
+ |
if (!load_times |
- ->Set(ctx, v8::String::NewFromUtf8(isolate, "requestTime", |
- v8::NewStringType::kNormal) |
- .ToLocalChecked(), |
- v8::Number::New(isolate, request_time)) |
+ ->SetAccessor( |
+ ctx, |
+ extensions::v8_helpers::ToV8StringUnsafe( |
+ isolate, "requestTime", v8::NewStringType::kNormal), |
+ TestLoadtimesGetter, |
+ nullptr, |
+ v8::Number::New(isolate, request_time)) |
.FromMaybe(false)) { |
return; |
} |