| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 8693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8704 FunctionTemplate::New(ThrowingCallbackWithTryCatch)->GetFunction(); | 8704 FunctionTemplate::New(ThrowingCallbackWithTryCatch)->GetFunction(); |
| 8705 context->Global()->Set(v8_str("func"), func); | 8705 context->Global()->Set(v8_str("func"), func); |
| 8706 | 8706 |
| 8707 MessageCallback callbacks[] = | 8707 MessageCallback callbacks[] = |
| 8708 { NULL, WebKitLike, ThrowViaApi, ThrowFromJS, WithTryCatch }; | 8708 { NULL, WebKitLike, ThrowViaApi, ThrowFromJS, WithTryCatch }; |
| 8709 for (unsigned i = 0; i < sizeof(callbacks)/sizeof(callbacks[0]); i++) { | 8709 for (unsigned i = 0; i < sizeof(callbacks)/sizeof(callbacks[0]); i++) { |
| 8710 MessageCallback callback = callbacks[i]; | 8710 MessageCallback callback = callbacks[i]; |
| 8711 if (callback != NULL) { | 8711 if (callback != NULL) { |
| 8712 V8::AddMessageListener(callback); | 8712 V8::AddMessageListener(callback); |
| 8713 } | 8713 } |
| 8714 // Some small number to control number of times message handler should |
| 8715 // throw an exception. |
| 8714 call_depth = 5; | 8716 call_depth = 5; |
| 8715 ExpectFalse( | 8717 ExpectFalse( |
| 8716 "var thrown = false;\n" | 8718 "var thrown = false;\n" |
| 8717 "try { func(); } catch(e) { thrown = true; }\n" | 8719 "try { func(); } catch(e) { thrown = true; }\n" |
| 8718 "thrown\n"); | 8720 "thrown\n"); |
| 8719 if (callback != NULL) { | 8721 if (callback != NULL) { |
| 8720 V8::RemoveMessageListeners(callback); | 8722 V8::RemoveMessageListeners(callback); |
| 8721 } | 8723 } |
| 8722 } | 8724 } |
| 8723 } | 8725 } |
| (...skipping 5165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13889 CHECK(func2->CreationContext() == context2); | 13891 CHECK(func2->CreationContext() == context2); |
| 13890 CheckContextId(func2, 2); | 13892 CheckContextId(func2, 2); |
| 13891 CHECK(instance2->CreationContext() == context2); | 13893 CHECK(instance2->CreationContext() == context2); |
| 13892 CheckContextId(instance2, 2); | 13894 CheckContextId(instance2, 2); |
| 13893 } | 13895 } |
| 13894 | 13896 |
| 13895 context1.Dispose(); | 13897 context1.Dispose(); |
| 13896 context2.Dispose(); | 13898 context2.Dispose(); |
| 13897 context3.Dispose(); | 13899 context3.Dispose(); |
| 13898 } | 13900 } |
| OLD | NEW |