OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010, The Android Open Source Project | 2 * Copyright 2010, The Android Open Source Project |
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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * * Redistributions of source code must retain the above copyright | 7 * * Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * * Redistributions in binary form must reproduce the above copyright | 9 * * Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 DOMWindow* ScriptCachedFrameData::domWindow() const | 52 DOMWindow* ScriptCachedFrameData::domWindow() const |
53 { | 53 { |
54 return m_domWindow; | 54 return m_domWindow; |
55 } | 55 } |
56 | 56 |
57 void ScriptCachedFrameData::restore(Frame* frame) | 57 void ScriptCachedFrameData::restore(Frame* frame) |
58 { | 58 { |
59 if (m_context.get().IsEmpty()) | 59 if (m_context.get().IsEmpty()) |
60 return; | 60 return; |
61 | 61 |
62 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) | 62 if (!frame || !frame->script()->canExecuteScripts(NotAboutToExecuteScript)) |
63 return; | 63 return; |
64 | 64 |
65 v8::HandleScope handleScope; | 65 v8::HandleScope handleScope; |
66 v8::Context::Scope contextScope(m_context.get()); | 66 v8::Context::Scope contextScope(m_context.get()); |
67 | 67 |
68 m_context.get()->ReattachGlobal(m_global.get()); | 68 m_context.get()->ReattachGlobal(m_global.get()); |
69 V8Proxy* proxy = V8Proxy::retrieve(frame); | 69 V8Proxy* proxy = V8Proxy::retrieve(frame); |
70 if (proxy) | 70 if (proxy) |
71 proxy->windowShell()->setContext(m_context.get()); | 71 proxy->windowShell()->setContext(m_context.get()); |
72 } | 72 } |
73 | 73 |
74 void ScriptCachedFrameData::clear() | 74 void ScriptCachedFrameData::clear() |
75 { | 75 { |
76 m_context.clear(); | 76 m_context.clear(); |
77 m_global.clear(); | 77 m_global.clear(); |
78 } | 78 } |
79 | 79 |
80 } // namespace WebCore | 80 } // namespace WebCore |
81 | 81 |
82 #endif // PLATFORM(QT) | 82 #endif // PLATFORM(QT) |
OLD | NEW |