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 } |
480 | 482 |
| 483 v8::Handle<v8::Function> function = v8::Handle<v8::Function>::Cast(info[0]); |
| 484 v8::Handle<v8::Value> receiver = info[1]; |
| 485 |
| 486 if (info.Length() < 3 || info[2]->IsUndefined()) { |
| 487 v8::Local<v8::Value> result = function->Call(receiver, 0, 0); |
| 488 v8SetReturnValue(info, result); |
| 489 return; |
| 490 } |
| 491 |
| 492 if (!info[2]->IsArray()) { |
| 493 ASSERT_NOT_REACHED(); |
| 494 return; |
| 495 } |
| 496 |
| 497 v8::Handle<v8::Array> arguments = v8::Handle<v8::Array>::Cast(info[2]); |
| 498 size_t argc = arguments->Length(); |
| 499 OwnPtr<v8::Handle<v8::Value>[]> argv = adoptArrayPtr(new v8::Handle<v8::Valu
e>[argc]); |
| 500 for (size_t i = 0; i < argc; ++i) |
| 501 argv[i] = arguments->Get(i); |
| 502 |
| 503 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); |
| 504 v8SetReturnValue(info, result); |
| 505 } |
| 506 |
| 507 void V8InjectedScriptHost::suppressWarningsAndCallFunctionMethodCustom(const v8:
:FunctionCallbackInfo<v8::Value>& info) |
| 508 { |
481 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); | 509 InjectedScriptHost* host = V8InjectedScriptHost::toNative(info.Holder()); |
482 ScriptDebugServer& debugServer = host->scriptDebugServer(); | 510 ScriptDebugServer& debugServer = host->scriptDebugServer(); |
483 debugServer.muteWarningsAndDeprecations(); | 511 debugServer.muteWarningsAndDeprecations(); |
484 | 512 |
485 v8::Handle<v8::Object> receiver = v8::Handle<v8::Object>::Cast(info[0]); | 513 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 | 514 |
492 v8::Local<v8::Value> result = function->Call(receiver, argc, argv.get()); | |
493 debugServer.unmuteWarningsAndDeprecations(); | 515 debugServer.unmuteWarningsAndDeprecations(); |
494 v8SetReturnValue(info, result); | |
495 } | 516 } |
496 | 517 |
497 } // namespace blink | 518 } // namespace blink |
OLD | NEW |