| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/renderer/send_request_natives.h" | 5 #include "extensions/renderer/send_request_natives.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 int request_id = request_sender_->GetNextRequestId(); | 42 int request_id = request_sender_->GetNextRequestId(); |
| 43 args.GetReturnValue().Set(static_cast<int32_t>(request_id)); | 43 args.GetReturnValue().Set(static_cast<int32_t>(request_id)); |
| 44 | 44 |
| 45 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 45 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 46 | 46 |
| 47 // See http://crbug.com/149880. The context menus APIs relies on this, but | 47 // See http://crbug.com/149880. The context menus APIs relies on this, but |
| 48 // we shouldn't really be doing it (e.g. for the sake of the storage API). | 48 // we shouldn't really be doing it (e.g. for the sake of the storage API). |
| 49 converter->SetFunctionAllowed(true); | 49 converter->SetFunctionAllowed(true); |
| 50 | 50 |
| 51 // See http://crbug.com/694248. |
| 52 converter->SetConvertNegativeZeroToInt(true); |
| 53 |
| 51 if (!preserve_null_in_objects) | 54 if (!preserve_null_in_objects) |
| 52 converter->SetStripNullFromObjects(true); | 55 converter->SetStripNullFromObjects(true); |
| 53 | 56 |
| 54 std::unique_ptr<base::Value> value_args( | 57 std::unique_ptr<base::Value> value_args( |
| 55 converter->FromV8Value(args[1], context()->v8_context())); | 58 converter->FromV8Value(args[1], context()->v8_context())); |
| 56 if (!value_args.get() || !value_args->IsType(base::Value::Type::LIST)) { | 59 if (!value_args.get() || !value_args->IsType(base::Value::Type::LIST)) { |
| 57 NOTREACHED() << "Unable to convert args passed to StartRequest"; | 60 NOTREACHED() << "Unable to convert args passed to StartRequest"; |
| 58 return; | 61 return; |
| 59 } | 62 } |
| 60 | 63 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 78 CHECK(args[0]->IsObject()); | 81 CHECK(args[0]->IsObject()); |
| 79 v8::Local<v8::Context> v8_context = | 82 v8::Local<v8::Context> v8_context = |
| 80 v8::Local<v8::Object>::Cast(args[0])->CreationContext(); | 83 v8::Local<v8::Object>::Cast(args[0])->CreationContext(); |
| 81 if (ContextCanAccessObject(context()->v8_context(), v8_context->Global(), | 84 if (ContextCanAccessObject(context()->v8_context(), v8_context->Global(), |
| 82 false)) { | 85 false)) { |
| 83 args.GetReturnValue().Set(v8_context->Global()); | 86 args.GetReturnValue().Set(v8_context->Global()); |
| 84 } | 87 } |
| 85 } | 88 } |
| 86 | 89 |
| 87 } // namespace extensions | 90 } // namespace extensions |
| OLD | NEW |