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

Side by Side Diff: extensions/renderer/send_request_natives.cc

Issue 2709103004: [Content] Allow V8ValueConverter to convert -0 to an integer (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « extensions/renderer/resources/schema_utils.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « extensions/renderer/resources/schema_utils.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698