| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |