Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: Source/WebCore/bindings/ScriptControllerBase.cpp

Issue 7946004: Merge 94820 - REGRESSION (r66874): Missing RefPtr in ScriptController (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode) 62 ScriptValue ScriptController::executeScript(const ScriptSourceCode& sourceCode)
63 { 63 {
64 if (!canExecuteScripts(AboutToExecuteScript) || isPaused()) 64 if (!canExecuteScripts(AboutToExecuteScript) || isPaused())
65 return ScriptValue(); 65 return ScriptValue();
66 66
67 bool wasInExecuteScript = m_inExecuteScript; 67 bool wasInExecuteScript = m_inExecuteScript;
68 m_inExecuteScript = true; 68 m_inExecuteScript = true;
69 69
70 RefPtr<Frame> protect(m_frame); // Script execution can destroy the frame, a nd thus the ScriptController.
71
70 ScriptValue result = evaluate(sourceCode); 72 ScriptValue result = evaluate(sourceCode);
71 73
72 if (!wasInExecuteScript) { 74 if (!wasInExecuteScript) {
73 m_inExecuteScript = false; 75 m_inExecuteScript = false;
74 Document::updateStyleForAllDocuments(); 76 Document::updateStyleForAllDocuments();
75 } 77 }
76 78
77 return result; 79 return result;
78 } 80 }
79 81
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 124
123 // DocumentWriter::replaceDocument can cause the DocumentLoader to get d eref'ed and possible destroyed, 125 // DocumentWriter::replaceDocument can cause the DocumentLoader to get d eref'ed and possible destroyed,
124 // so protect it with a RefPtr. 126 // so protect it with a RefPtr.
125 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader()) 127 if (RefPtr<DocumentLoader> loader = m_frame->document()->loader())
126 loader->writer()->replaceDocument(scriptResult); 128 loader->writer()->replaceDocument(scriptResult);
127 } 129 }
128 return true; 130 return true;
129 } 131 }
130 132
131 } // namespace WebCore 133 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698