OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 { | 556 { |
557 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsM
ethod2", "TestInterface", info.Holder(), info.GetIsolate()); | 557 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsM
ethod2", "TestInterface", info.Holder(), info.GetIsolate()); |
558 if (UNLIKELY(info.Length() < 2)) { | 558 if (UNLIKELY(info.Length() < 2)) { |
559 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | 559 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); |
560 exceptionState.throwIfNeeded(); | 560 exceptionState.throwIfNeeded(); |
561 return; | 561 return; |
562 } | 562 } |
563 TestInterface* imp = V8TestInterface::toNative(info.Holder()); | 563 TestInterface* imp = V8TestInterface::toNative(info.Holder()); |
564 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); | 564 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); |
565 if (info.Length() <= 1 || !info[1]->IsFunction()) { | 565 if (info.Length() <= 1 || !info[1]->IsFunction()) { |
566 throwTypeError(ExceptionMessages::failedToExecute("implementsMethod2", "
TestInterface", "The callback provided as parameter 2 is not a function."), info
.GetIsolate()); | 566 exceptionState.throwTypeError("The callback provided as parameter 2 is n
ot a function."); |
| 567 exceptionState.throwIfNeeded(); |
567 return; | 568 return; |
568 } | 569 } |
569 OwnPtr<TestObject> objArg = V8TestObject::create(v8::Handle<v8::Function>::C
ast(info[1]), getExecutionContext()); | 570 OwnPtr<TestObject> objArg = V8TestObject::create(v8::Handle<v8::Function>::C
ast(info[1]), getExecutionContext()); |
570 ExecutionContext* scriptContext = getExecutionContext(); | 571 ExecutionContext* scriptContext = getExecutionContext(); |
571 RefPtr<TestObj> result = TestImplements::implementsMethod2(scriptContext, im
p, strArg, objArg.release(), exceptionState); | 572 RefPtr<TestObj> result = TestImplements::implementsMethod2(scriptContext, im
p, strArg, objArg.release(), exceptionState); |
572 if (exceptionState.throwIfNeeded()) | 573 if (exceptionState.throwIfNeeded()) |
573 return; | 574 return; |
574 v8SetReturnValue(info, result.release()); | 575 v8SetReturnValue(info, result.release()); |
575 } | 576 } |
576 | 577 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 { | 623 { |
623 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa
lMethod2", "TestInterface", info.Holder(), info.GetIsolate()); | 624 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa
lMethod2", "TestInterface", info.Holder(), info.GetIsolate()); |
624 if (UNLIKELY(info.Length() < 2)) { | 625 if (UNLIKELY(info.Length() < 2)) { |
625 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); | 626 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i
nfo.Length())); |
626 exceptionState.throwIfNeeded(); | 627 exceptionState.throwIfNeeded(); |
627 return; | 628 return; |
628 } | 629 } |
629 TestInterface* imp = V8TestInterface::toNative(info.Holder()); | 630 TestInterface* imp = V8TestInterface::toNative(info.Holder()); |
630 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); | 631 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); |
631 if (info.Length() <= 1 || !info[1]->IsFunction()) { | 632 if (info.Length() <= 1 || !info[1]->IsFunction()) { |
632 throwTypeError(ExceptionMessages::failedToExecute("supplementalMethod2",
"TestInterface", "The callback provided as parameter 2 is not a function."), in
fo.GetIsolate()); | 633 exceptionState.throwTypeError("The callback provided as parameter 2 is n
ot a function."); |
| 634 exceptionState.throwIfNeeded(); |
633 return; | 635 return; |
634 } | 636 } |
635 OwnPtr<TestObject> objArg = V8TestObject::create(v8::Handle<v8::Function>::C
ast(info[1]), getExecutionContext()); | 637 OwnPtr<TestObject> objArg = V8TestObject::create(v8::Handle<v8::Function>::C
ast(info[1]), getExecutionContext()); |
636 ExecutionContext* scriptContext = getExecutionContext(); | 638 ExecutionContext* scriptContext = getExecutionContext(); |
637 RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptCon
text, imp, strArg, objArg.release(), exceptionState); | 639 RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptCon
text, imp, strArg, objArg.release(), exceptionState); |
638 if (exceptionState.throwIfNeeded()) | 640 if (exceptionState.throwIfNeeded()) |
639 return; | 641 return; |
640 v8SetReturnValue(info, result.release()); | 642 v8SetReturnValue(info, result.release()); |
641 } | 643 } |
642 #endif // ENABLE(Condition11) || ENABLE(Condition12) | 644 #endif // ENABLE(Condition11) || ENABLE(Condition12) |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
980 } | 982 } |
981 | 983 |
982 template<> | 984 template<> |
983 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) | 985 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c
reationContext, v8::Isolate* isolate) |
984 { | 986 { |
985 return toV8(impl, creationContext, isolate); | 987 return toV8(impl, creationContext, isolate); |
986 } | 988 } |
987 | 989 |
988 } // namespace WebCore | 990 } // namespace WebCore |
989 #endif // ENABLE(Condition1) || ENABLE(Condition2) | 991 #endif // ENABLE(Condition1) || ENABLE(Condition2) |
OLD | NEW |