Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2007-2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 String scriptId; | 466 String scriptId; |
| 467 int lineNumber; | 467 int lineNumber; |
| 468 int columnNumber; | 468 int columnNumber; |
| 469 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) | 469 if (!getFunctionLocation(info, &scriptId, &lineNumber, &columnNumber)) |
| 470 return; | 470 return; |
| 471 | 471 |
| 472 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 472 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); |
| 473 host->unmonitorFunction(scriptId, lineNumber, columnNumber); | 473 host->unmonitorFunction(scriptId, lineNumber, columnNumber); |
| 474 } | 474 } |
| 475 | 475 |
| 476 void V8InjectedScriptHost::suppressWarningsAndCallMethodCustom(const v8::Functio nCallbackInfo<v8::Value>& info) | 476 void V8InjectedScriptHost::callFunctionMethodCustom(const v8::FunctionCallbackIn fo<v8::Value>& info) |
| 477 { | 477 { |
| 478 if (info.Length() < 2 || !info[0]->IsObject() || !info[1]->IsFunction()) | 478 if (info.Length() < 2 || info.Length() > 3 || !info[0]->IsFunction()) { |
| 479 ASSERT_NOT_REACHED(); | |
| 479 return; | 480 return; |
| 481 } | |
| 482 if (info.Length() == 3 && !info[2]->IsArray()) { | |
| 483 ASSERT_NOT_REACHED(); | |
|
yurys
2014/08/07 16:54:03
In theory InjectedScriptHost can leak into the pag
| |
| 484 return; | |
| 485 } | |
| 480 | 486 |
| 487 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(info[0]); | |
| 488 v8::Handle<v8::Value> receiver = info[1]; | |
| 489 | |
| 490 if (info.Length() < 3) { | |
| 491 v8::Local<v8::Value> result = function->Call(receiver, 0, 0); | |
| 492 v8SetReturnValue(info, result); | |
| 493 return; | |
| 494 } | |
| 495 | |
| 496 v8::Handle<v8::Array> arguments = v8::Handle<v8::Array>::Cast(info[2]); | |
| 497 size_t argc = arguments->Length(); | |
| 498 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu e>[argc]); | |
| 499 for (size_t i = 0; i < argc; ++i) | |
| 500 argv[i] = arguments->Get(i); | |
| 501 | |
| 502 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); | |
| 503 v8SetReturnValue(info, result); | |
| 504 } | |
| 505 | |
| 506 void V8InjectedScriptHost::suppressWarningsAndCallFunctionMethodCustom(const v8: :FunctionCallbackInfo<v8::Value>& info) | |
| 507 { | |
| 481 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 508 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); |
| 482 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 509 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
| 483 debugServer.muteWarningsAndDeprecations(); | 510 debugServer.muteWarningsAndDeprecations(); |
| 484 | 511 |
| 485 v8::Handle<v8::Object> receiver = v8::Handle<v8::Object>::Cast(info[0]); | 512 callFunctionMethodCustom(info); |
| 486 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(info[1]); | |
| 487 size_t argc = info.Length() - 2; | |
| 488 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu e>[argc]); | |
| 489 for (size_t i = 0; i < argc; ++i) | |
| 490 argv[i] = info[i + 2]; | |
| 491 | 513 |
| 492 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); | |
| 493 debugServer.unmuteWarningsAndDeprecations(); | 514 debugServer.unmuteWarningsAndDeprecations(); |
| 494 v8SetReturnValue(info, result); | |
| 495 } | 515 } |
| 496 | 516 |
| 497 } // namespace blink | 517 } // namespace blink |
| OLD | NEW |