| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) | 2 * Copyright (C) 1999-2001 Harri Porten (porten@kde.org) |
| 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) | 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) |
| 4 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 4 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 Settings* settings = m_frame->settings(); | 53 Settings* settings = m_frame->settings(); |
| 54 const bool allowed = m_frame->loader()->client()->allowScript(settings && se
ttings->isScriptEnabled()); | 54 const bool allowed = m_frame->loader()->client()->allowScript(settings && se
ttings->isScriptEnabled()); |
| 55 if (!allowed && reason == AboutToExecuteScript) | 55 if (!allowed && reason == AboutToExecuteScript) |
| 56 m_frame->loader()->client()->didNotAllowScript(); | 56 m_frame->loader()->client()->didNotAllowScript(); |
| 57 return allowed; | 57 return allowed; |
| 58 } | 58 } |
| 59 | 59 |
| 60 ScriptValue ScriptController::executeScript(const String& script, bool forceUser
Gesture) | 60 ScriptValue ScriptController::executeScript(const String& script, bool forceUser
Gesture) |
| 61 { | 61 { |
| 62 UserGestureIndicator gestureIndicator(forceUserGesture ? DefinitelyProcessin
gUserGesture : PossiblyProcessingUserGesture); | 62 UserGestureIndicator gestureIndicator(forceUserGesture ? DefinitelyProcessin
gNewUserGesture : PossiblyProcessingUserGesture); |
| 63 return executeScript(ScriptSourceCode(script, m_frame->document()->url())); | 63 return executeScript(ScriptSourceCode(script, m_frame->document()->url())); |
| 64 } | 64 } |
| 65 | 65 |
| 66 ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode) | 66 ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode) |
| 67 { | 67 { |
| 68 if (!canExecuteScripts(AboutToExecuteScript) || isPaused()) | 68 if (!canExecuteScripts(AboutToExecuteScript) || isPaused()) |
| 69 return ScriptValue(); | 69 return ScriptValue(); |
| 70 | 70 |
| 71 RefPtr<Frame> protect(m_frame); // Script execution can destroy the frame, a
nd thus the ScriptController. | 71 RefPtr<Frame> protect(m_frame); // Script execution can destroy the frame, a
nd thus the ScriptController. |
| 72 | 72 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 // DocumentWriter::replaceDocument can cause the DocumentLoader to get d
eref'ed and possible destroyed, | 118 // DocumentWriter::replaceDocument can cause the DocumentLoader to get d
eref'ed and possible destroyed, |
| 119 // so protect it with a RefPtr. | 119 // so protect it with a RefPtr. |
| 120 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) | 120 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) |
| 121 loader->writer()->replaceDocument(scriptResult, ownerDocument.get())
; | 121 loader->writer()->replaceDocument(scriptResult, ownerDocument.get())
; |
| 122 } | 122 } |
| 123 return true; | 123 return true; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace WebCore | 126 } // namespace WebCore |
| OLD | NEW |