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

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

Issue 9383010: Strip brackets from IPv6 host literals before passing down to PAC script. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
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 <algorithm> 5 #include <algorithm>
6 #include <cstdio> 6 #include <cstdio>
7 7
8 #include "net/proxy/proxy_resolver_v8.h" 8 #include "net/proxy/proxy_resolver_v8.h"
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 362
363 v8::Local<v8::Value> function; 363 v8::Local<v8::Value> function;
364 if (!GetFindProxyForURL(&function)) { 364 if (!GetFindProxyForURL(&function)) {
365 js_bindings_->OnError( 365 js_bindings_->OnError(
366 -1, ASCIIToUTF16("FindProxyForURL() is undefined.")); 366 -1, ASCIIToUTF16("FindProxyForURL() is undefined."));
367 return ERR_PAC_SCRIPT_FAILED; 367 return ERR_PAC_SCRIPT_FAILED;
368 } 368 }
369 369
370 v8::Handle<v8::Value> argv[] = { 370 v8::Handle<v8::Value> argv[] = {
371 ASCIIStringToV8String(query_url.spec()), 371 ASCIIStringToV8String(query_url.spec()),
372 ASCIIStringToV8String(query_url.host()), 372 ASCIIStringToV8String(query_url.HostNoBrackets()),
373 }; 373 };
374 374
375 v8::TryCatch try_catch; 375 v8::TryCatch try_catch;
376 v8::Local<v8::Value> ret = v8::Function::Cast(*function)->Call( 376 v8::Local<v8::Value> ret = v8::Function::Cast(*function)->Call(
377 v8_context_->Global(), arraysize(argv), argv); 377 v8_context_->Global(), arraysize(argv), argv);
378 378
379 if (try_catch.HasCaught()) { 379 if (try_catch.HasCaught()) {
380 HandleError(try_catch.Message()); 380 HandleError(try_catch.Message());
381 return ERR_PAC_SCRIPT_FAILED; 381 return ERR_PAC_SCRIPT_FAILED;
382 } 382 }
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 795
796 // Try parsing the PAC script. 796 // Try parsing the PAC script.
797 scoped_ptr<Context> context(new Context(js_bindings_.get())); 797 scoped_ptr<Context> context(new Context(js_bindings_.get()));
798 int rv = context->InitV8(script_data); 798 int rv = context->InitV8(script_data);
799 if (rv == OK) 799 if (rv == OK)
800 context_.reset(context.release()); 800 context_.reset(context.release());
801 return rv; 801 return rv;
802 } 802 }
803 803
804 } // namespace net 804 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698