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

Side by Side Diff: Source/WebCore/bindings/v8/ScheduledAction.cpp

Issue 9340005: Merge 106846 - Before accessing a frame's script controller in V8 bindings, first check that the ... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1025/
Patch Set: Created 8 years, 10 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007-2009 Google Inc. All rights reserved. 2 * Copyright (C) 2007-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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 } 89 }
90 90
91 if (m_argc > 0) 91 if (m_argc > 0)
92 delete[] m_argv; 92 delete[] m_argv;
93 } 93 }
94 94
95 void ScheduledAction::execute(ScriptExecutionContext* context) 95 void ScheduledAction::execute(ScriptExecutionContext* context)
96 { 96 {
97 if (context->isDocument()) { 97 if (context->isDocument()) {
98 Frame* frame = static_cast<Document*>(context)->frame(); 98 Frame* frame = static_cast<Document*>(context)->frame();
99 if (!frame)
100 return;
99 ScriptController* scriptController = frame->script(); 101 ScriptController* scriptController = frame->script();
100 if (!scriptController->canExecuteScripts(NotAboutToExecuteScript)) 102 if (!scriptController->canExecuteScripts(NotAboutToExecuteScript))
101 return; 103 return;
102 V8Proxy* proxy = V8Proxy::retrieve(frame); 104 V8Proxy* proxy = V8Proxy::retrieve(frame);
103 execute(proxy); 105 execute(proxy);
104 } 106 }
105 #if ENABLE(WORKERS) 107 #if ENABLE(WORKERS)
106 else { 108 else {
107 ASSERT(context->isWorkerContext()); 109 ASSERT(context->isWorkerContext());
108 execute(static_cast<WorkerContext*>(context)); 110 execute(static_cast<WorkerContext*>(context));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_contex t.get()); 149 v8::Handle<v8::Context> v8Context = v8::Local<v8::Context>::New(m_contex t.get());
148 ASSERT(!v8Context.IsEmpty()); 150 ASSERT(!v8Context.IsEmpty());
149 v8::Context::Scope scope(v8Context); 151 v8::Context::Scope scope(v8Context);
150 m_function->Call(v8Context->Global(), m_argc, m_argv); 152 m_function->Call(v8Context->Global(), m_argc, m_argv);
151 } else 153 } else
152 scriptController->evaluate(m_code); 154 scriptController->evaluate(m_code);
153 } 155 }
154 #endif 156 #endif
155 157
156 } // namespace WebCore 158 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/bindings/v8/PageScriptDebugServer.cpp ('k') | Source/WebCore/bindings/v8/ScriptCachedFrameData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698