Changeset 31199 in webkit
- Timestamp:
- Mar 20, 2008 5:14:58 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r31198 r31199 1 2008-03-20 Adam Roben <aroben@apple.com> 2 3 Allow pausing/blocking of JS execution by plugins 4 5 Part of Bug 17133: Should support pausing JavaScript execution without 6 hanging the process 7 8 <http://bugs.webkit.org/show_bug.cgi?id=17133> 9 <rdar://problem/5719551> 10 11 This patch doesn't affect Mac, which doesn't use the shared PluginView 12 code. 13 14 Note that this patch doesn't prevent plugins from executing JS via an 15 NPObject they've already gotten hold of. It just blocks obtaining new 16 NPObjects and pauses any requests to evaluate javascript: URIs. This 17 is probably good enough for now because most plugins seem to always 18 obtain the Window object each time they want to execute JS. 19 20 Reviewed by Tim Hatcher. 21 22 * plugins/PluginView.cpp: 23 (WebCore::PluginView::getValue): Return an error if JS is paused. 24 (WebCore::PluginView::setJavaScriptPaused): Stop the request timer if 25 we're pausing, and resume it if we're unpausing. 26 (WebCore::PluginView::PluginView): Initialize new members. 27 * plugins/PluginView.h: 28 1 29 2008-03-20 Adam Roben <aroben@apple.com> 2 30 -
trunk/WebCore/plugins/PluginView.cpp
r31196 r31199 393 393 NPError PluginView::getValue(NPNVariable variable, void* value) 394 394 { 395 if (m_isJavaScriptPaused) 396 return NPERR_GENERIC_ERROR; 397 395 398 switch (variable) { 396 399 #if ENABLE(NETSCAPE_PLUGIN_API) … … 478 481 479 482 return false; 483 } 484 485 void PluginView::setJavaScriptPaused(bool paused) 486 { 487 if (m_isJavaScriptPaused == paused) 488 return; 489 m_isJavaScriptPaused = paused; 490 491 if (m_isJavaScriptPaused) { 492 m_requestTimerWasActive = m_requestTimer.isActive(); 493 m_requestTimer.stop(); 494 } else if (m_requestTimerWasActive) 495 m_requestTimer.startOneShot(0); 480 496 } 481 497 … … 566 582 , m_loadManually(loadManually) 567 583 , m_manualStream(0) 584 , m_isJavaScriptPaused(false) 585 , m_requestTimerWasActive(false) 568 586 { 569 587 if (!m_plugin) { -
trunk/WebCore/plugins/PluginView.h
r31196 r31199 130 130 bool arePopupsAllowed() const; 131 131 132 void setJavaScriptPaused(bool); 133 132 134 void disconnectStream(PluginStream*); 133 135 void streamDidFinishLoading(PluginStream* stream) { disconnectStream(stream); } … … 234 236 RefPtr<PluginStream> m_manualStream; 235 237 238 bool m_isJavaScriptPaused; 239 bool m_requestTimerWasActive; 240 236 241 static PluginView* s_currentPluginView; 237 242 };
Note: See TracChangeset
for help on using the changeset viewer.