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

Side by Side Diff: net/proxy/proxy_resolver_v8.cc

Issue 2126763002: Remove the prototype from all V8 functions that aren't constructors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 4 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "net/proxy/proxy_resolver_v8.h" 5 #include "net/proxy/proxy_resolver_v8.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cstdio> 8 #include <cstdio>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 500
501 v8_this_.Reset(isolate_, v8::External::New(isolate_, this)); 501 v8_this_.Reset(isolate_, v8::External::New(isolate_, this));
502 v8::Local<v8::External> v8_this = 502 v8::Local<v8::External> v8_this =
503 v8::Local<v8::External>::New(isolate_, v8_this_); 503 v8::Local<v8::External>::New(isolate_, v8_this_);
504 v8::Local<v8::ObjectTemplate> global_template = 504 v8::Local<v8::ObjectTemplate> global_template =
505 v8::ObjectTemplate::New(isolate_); 505 v8::ObjectTemplate::New(isolate_);
506 506
507 // Attach the javascript bindings. 507 // Attach the javascript bindings.
508 v8::Local<v8::FunctionTemplate> alert_template = 508 v8::Local<v8::FunctionTemplate> alert_template =
509 v8::FunctionTemplate::New(isolate_, &AlertCallback, v8_this); 509 v8::FunctionTemplate::New(isolate_, &AlertCallback, v8_this);
510 alert_template->RemovePrototype();
510 global_template->Set(ASCIILiteralToV8String(isolate_, "alert"), 511 global_template->Set(ASCIILiteralToV8String(isolate_, "alert"),
511 alert_template); 512 alert_template);
512 513
513 v8::Local<v8::FunctionTemplate> my_ip_address_template = 514 v8::Local<v8::FunctionTemplate> my_ip_address_template =
514 v8::FunctionTemplate::New(isolate_, &MyIpAddressCallback, v8_this); 515 v8::FunctionTemplate::New(isolate_, &MyIpAddressCallback, v8_this);
516 my_ip_address_template->RemovePrototype();
515 global_template->Set(ASCIILiteralToV8String(isolate_, "myIpAddress"), 517 global_template->Set(ASCIILiteralToV8String(isolate_, "myIpAddress"),
516 my_ip_address_template); 518 my_ip_address_template);
517 519
518 v8::Local<v8::FunctionTemplate> dns_resolve_template = 520 v8::Local<v8::FunctionTemplate> dns_resolve_template =
519 v8::FunctionTemplate::New(isolate_, &DnsResolveCallback, v8_this); 521 v8::FunctionTemplate::New(isolate_, &DnsResolveCallback, v8_this);
522 dns_resolve_template->RemovePrototype();
520 global_template->Set(ASCIILiteralToV8String(isolate_, "dnsResolve"), 523 global_template->Set(ASCIILiteralToV8String(isolate_, "dnsResolve"),
521 dns_resolve_template); 524 dns_resolve_template);
522 525
523 v8::Local<v8::FunctionTemplate> is_plain_host_name_template = 526 v8::Local<v8::FunctionTemplate> is_plain_host_name_template =
524 v8::FunctionTemplate::New(isolate_, &IsPlainHostNameCallback, v8_this); 527 v8::FunctionTemplate::New(isolate_, &IsPlainHostNameCallback, v8_this);
528 is_plain_host_name_template->RemovePrototype();
525 global_template->Set(ASCIILiteralToV8String(isolate_, "isPlainHostName"), 529 global_template->Set(ASCIILiteralToV8String(isolate_, "isPlainHostName"),
526 is_plain_host_name_template); 530 is_plain_host_name_template);
527 531
528 // Microsoft's PAC extensions: 532 // Microsoft's PAC extensions:
529 533
530 v8::Local<v8::FunctionTemplate> dns_resolve_ex_template = 534 v8::Local<v8::FunctionTemplate> dns_resolve_ex_template =
531 v8::FunctionTemplate::New(isolate_, &DnsResolveExCallback, v8_this); 535 v8::FunctionTemplate::New(isolate_, &DnsResolveExCallback, v8_this);
536 dns_resolve_ex_template->RemovePrototype();
532 global_template->Set(ASCIILiteralToV8String(isolate_, "dnsResolveEx"), 537 global_template->Set(ASCIILiteralToV8String(isolate_, "dnsResolveEx"),
533 dns_resolve_ex_template); 538 dns_resolve_ex_template);
534 539
535 v8::Local<v8::FunctionTemplate> my_ip_address_ex_template = 540 v8::Local<v8::FunctionTemplate> my_ip_address_ex_template =
536 v8::FunctionTemplate::New(isolate_, &MyIpAddressExCallback, v8_this); 541 v8::FunctionTemplate::New(isolate_, &MyIpAddressExCallback, v8_this);
542 my_ip_address_ex_template->RemovePrototype();
537 global_template->Set(ASCIILiteralToV8String(isolate_, "myIpAddressEx"), 543 global_template->Set(ASCIILiteralToV8String(isolate_, "myIpAddressEx"),
538 my_ip_address_ex_template); 544 my_ip_address_ex_template);
539 545
540 v8::Local<v8::FunctionTemplate> sort_ip_address_list_template = 546 v8::Local<v8::FunctionTemplate> sort_ip_address_list_template =
541 v8::FunctionTemplate::New(isolate_, 547 v8::FunctionTemplate::New(isolate_,
542 &SortIpAddressListCallback, 548 &SortIpAddressListCallback,
543 v8_this); 549 v8_this);
550 sort_ip_address_list_template->RemovePrototype();
544 global_template->Set(ASCIILiteralToV8String(isolate_, "sortIpAddressList"), 551 global_template->Set(ASCIILiteralToV8String(isolate_, "sortIpAddressList"),
545 sort_ip_address_list_template); 552 sort_ip_address_list_template);
546 553
547 v8::Local<v8::FunctionTemplate> is_in_net_ex_template = 554 v8::Local<v8::FunctionTemplate> is_in_net_ex_template =
548 v8::FunctionTemplate::New(isolate_, &IsInNetExCallback, v8_this); 555 v8::FunctionTemplate::New(isolate_, &IsInNetExCallback, v8_this);
556 is_in_net_ex_template->RemovePrototype();
549 global_template->Set(ASCIILiteralToV8String(isolate_, "isInNetEx"), 557 global_template->Set(ASCIILiteralToV8String(isolate_, "isInNetEx"),
550 is_in_net_ex_template); 558 is_in_net_ex_template);
551 559
552 v8_context_.Reset( 560 v8_context_.Reset(
553 isolate_, v8::Context::New(isolate_, NULL, global_template)); 561 isolate_, v8::Context::New(isolate_, NULL, global_template));
554 562
555 v8::Local<v8::Context> context = 563 v8::Local<v8::Context> context =
556 v8::Local<v8::Context>::New(isolate_, v8_context_); 564 v8::Local<v8::Context>::New(isolate_, v8_context_);
557 v8::Context::Scope ctx(context); 565 v8::Context::Scope ctx(context);
558 566
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 return 0; 899 return 0;
892 900
893 v8::Locker locked(isolate); 901 v8::Locker locked(isolate);
894 v8::Isolate::Scope isolate_scope(isolate); 902 v8::Isolate::Scope isolate_scope(isolate);
895 v8::HeapStatistics heap_statistics; 903 v8::HeapStatistics heap_statistics;
896 isolate->GetHeapStatistics(&heap_statistics); 904 isolate->GetHeapStatistics(&heap_statistics);
897 return heap_statistics.used_heap_size(); 905 return heap_statistics.used_heap_size();
898 } 906 }
899 907
900 } // namespace net 908 } // namespace net
OLDNEW
« no previous file with comments | « mojo/public/js/validation_unittests.js ('k') | third_party/WebKit/LayoutTests/fast/dom/Window/window-methods-construct.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698