| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 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 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 845 if (scriptState->contextIsValid()) { | 845 if (scriptState->contextIsValid()) { |
| 846 ASSERT(toFrameIfNotDetached(context) == frame); | 846 ASSERT(toFrameIfNotDetached(context) == frame); |
| 847 return scriptState->context(); | 847 return scriptState->context(); |
| 848 } | 848 } |
| 849 return v8::Local<v8::Context>(); | 849 return v8::Local<v8::Context>(); |
| 850 } | 850 } |
| 851 | 851 |
| 852 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, | 852 v8::Local<v8::Context> toV8ContextEvenIfDetached(Frame* frame, |
| 853 DOMWrapperWorld& world) { | 853 DOMWrapperWorld& world) { |
| 854 ASSERT(frame); | 854 ASSERT(frame); |
| 855 return frame->windowProxy(world)->contextIfInitialized(); | 855 // Note: despite the name of this function, it's not actually safe to call |
| 856 // this on a detached frame. |
| 857 return frame->getWindowProxyManager()->context(world); |
| 856 } | 858 } |
| 857 | 859 |
| 858 void crashIfIsolateIsDead(v8::Isolate* isolate) { | 860 void crashIfIsolateIsDead(v8::Isolate* isolate) { |
| 859 if (isolate->IsDead()) { | 861 if (isolate->IsDead()) { |
| 860 // FIXME: We temporarily deal with V8 internal error situations | 862 // FIXME: We temporarily deal with V8 internal error situations |
| 861 // such as out-of-memory by crashing the renderer. | 863 // such as out-of-memory by crashing the renderer. |
| 862 CRASH(); | 864 CRASH(); |
| 863 } | 865 } |
| 864 } | 866 } |
| 865 | 867 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | 1015 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), |
| 1014 parsed, tryCatch)) { | 1016 parsed, tryCatch)) { |
| 1015 if (tryCatch.HasCaught()) | 1017 if (tryCatch.HasCaught()) |
| 1016 exceptionState.rethrowV8Exception(tryCatch.Exception()); | 1018 exceptionState.rethrowV8Exception(tryCatch.Exception()); |
| 1017 } | 1019 } |
| 1018 | 1020 |
| 1019 return parsed; | 1021 return parsed; |
| 1020 } | 1022 } |
| 1021 | 1023 |
| 1022 } // namespace blink | 1024 } // namespace blink |
| OLD | NEW |