Reviewed by Darin Adler.
Speculative fix for <rdar://problem/
5479443> REGRESSION: Hang due to
infinite JS recursion on close @ engadget.com (onunload-based ad)
If page is NULL, shouldInterruptScript now returns true, so you can't
get stuck in a state in which a script executes forever without putting
up a UI to ask if it should stop.
* bindings/js/kjs_binding.cpp:
(KJS::ScriptInterpreter::shouldInterruptScript):
WebKit:
Reviewed by Darin Adler.
Fixed a hang due to an infinite script running in the window's unload
event handler, which may be the cause of <rdar://problem/
5479443>
REGRESSION: Hang due to infinite JS recursion on close @ engadget.com
(onunload-based ad)
* WebView/WebUIDelegatePrivate.h: Added FIXME.
* WebView/WebView.h: Clarified headerdoc ambiguity about when delegate
methods stop firing.
* WebView/WebView.mm:
(-[WebView _close]): The fix: don't nil out our delegates until after
detaching the FrameLoader, because the act of detaching the FrameLoader
might fire important delegate methods, like webViewShouldInterruptJavaScript:.
Don't do other tear-down either, because the unload event handler needs
to run in a fully constructed page.
This change is fairly low risk because niling out our delegates is a
very recent, never-shipped feature in WebKit, so it's unlikely that any
apps rely on it in a crazy way.
win:
Reviewed by Darin Adler.
Fixed a hang due to an infinite script running in the window's unload
event handler, which may be the cause of <rdar://problem/
5479443>
REGRESSION: Hang due to infinite JS recursion on close @ engadget.com
(onunload-based ad)
Added a bunch of WebKitMac's close features, and reordered others to
match WebKitMac.
* WebView.cpp:
(WebView::close):
(WebView::removeDragCaret):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25612
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-09-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Speculative fix for <rdar://problem/5479443> REGRESSION: Hang due to
+ infinite JS recursion on close @ engadget.com (onunload-based ad)
+
+ If page is NULL, shouldInterruptScript now returns true, so you can't
+ get stuck in a state in which a script executes forever without putting
+ up a UI to ask if it should stop.
+
+ * bindings/js/kjs_binding.cpp:
+ (KJS::ScriptInterpreter::shouldInterruptScript):
+
2007-09-17 Dave Hyatt <hyatt@apple.com>
Fix for bug 14743, missing glyphs on many international sites because of MLang's tiny cache.
bool ScriptInterpreter::shouldInterruptScript() const
{
- if (Page *page = m_frame->page())
- return page->chrome()->shouldInterruptJavaScript();
-
- return false;
+ Page* page = m_frame->page();
+
+ // See <rdar://problem/5479443>. We don't think that page can ever be NULL
+ // in this case, but if it is, we've gotten into a state where we may have
+ // hung the UI, with no way to ask the client whether to cancel execution.
+ // For now, our solution is just to cancel execution no matter what,
+ // ensuring that we never hang. We might want to consider other solutions
+ // if we discover problems with this one.
+ ASSERT(page);
+ if (!page)
+ return true;
+
+ return page->chrome()->shouldInterruptJavaScript();
}
-
-//////
JSValue* jsStringOrNull(const String& s)
{
+2007-09-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed a hang due to an infinite script running in the window's unload
+ event handler, which may be the cause of <rdar://problem/5479443>
+ REGRESSION: Hang due to infinite JS recursion on close @ engadget.com
+ (onunload-based ad)
+
+ * WebView/WebUIDelegatePrivate.h: Added FIXME.
+
+ * WebView/WebView.h: Clarified headerdoc ambiguity about when delegate
+ methods stop firing.
+
+ * WebView/WebView.mm:
+ (-[WebView _close]): The fix: don't nil out our delegates until after
+ detaching the FrameLoader, because the act of detaching the FrameLoader
+ might fire important delegate methods, like webViewShouldInterruptJavaScript:.
+ Don't do other tear-down either, because the unload event handler needs
+ to run in a fully constructed page.
+
+ This change is fairly low risk because niling out our delegates is a
+ very recent, never-shipped feature in WebKit, so it's unlikely that any
+ apps rely on it in a crazy way.
+
2007-09-15 Darin Adler <darin@apple.com>
Reviewed by John Sullivan.
- (void)webView:(WebView *)sender dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag forView:(NSView *)view;
- (void)webView:(WebView *)sender didDrawRect:(NSRect)rect;
- (void)webView:(WebView *)sender didScrollDocumentInFrameView:(WebFrameView *)frameView;
+// FIXME: If we ever make this method public, it should include a WebFrame parameter.
- (BOOL)webViewShouldInterruptJavaScript:(WebView *)sender;
- (void)webView:(WebView *)sender willPopupMenu:(NSMenu *)menu;
- (void)webView:(WebView *)sender contextMenuItemSelected:(NSMenuItem *)item forElement:(NSDictionary *)element;
/*!
@method close
- @abstract Cancels any pending load operations. Once the receiver is closed it will no longer
- respond to new requests or fire any more delegate methods.
+ @abstract Closes the receiver, unloading its web page and canceling any pending loads.
+ Once the receiver has closed, it will no longer respond to requests or fire delegate methods.
+ (However, the -close method itself may fire delegate methods.)
@discussion A garbage collected application is required to call close when the receiver is no longer needed.
The close method will be called automatically when the window or hostWindow closes and shouldCloseWithWindow returns YES.
A non-garbage collected application can still call close, providing a convenient way to prevent receiver
return;
_private->closed = YES;
- [self _removeFromAllWebViewsSet];
+ FrameLoader* mainFrameLoader = [[self mainFrame] _frameLoader];
+ if (mainFrameLoader)
+ mainFrameLoader->detachFromParent();
+ [self _removeFromAllWebViewsSet];
[self setGroupName:nil];
[self setHostWindow:nil];
+
[self setDownloadDelegate:nil];
[self setEditingDelegate:nil];
[self setFrameLoadDelegate:nil];
// To avoid leaks, call removeDragCaret in case it wasn't called after moveDragCaretToPoint.
[self removeDragCaret];
- FrameLoader* mainFrameLoader = [[self mainFrame] _frameLoader];
- if (mainFrameLoader)
- mainFrameLoader->detachFromParent();
-
// Deleteing the WebCore::Page will clear the page cache so we call destroy on
// all the plug-ins in the page cache to break any retain cycles.
// See comment in HistoryItem::releaseAllPendingPageCaches() for more information.
+2007-09-17 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Fixed a hang due to an infinite script running in the window's unload
+ event handler, which may be the cause of <rdar://problem/5479443>
+ REGRESSION: Hang due to infinite JS recursion on close @ engadget.com
+ (onunload-based ad)
+
+ Added a bunch of WebKitMac's close features, and reordered others to
+ match WebKitMac.
+
+ * WebView.cpp:
+ (WebView::close):
+ (WebView::removeDragCaret):
+
2007-09-17 Adam Roben <aroben@apple.com>
Fix <rdar://4979801> overflow divs don't respond to keyboard scrolling (affects RSS pages)
m_didClose = true;
+ Frame* frame = m_page->mainFrame();
+ if (frame)
+ frame->loader()->detachFromParent();
+
+ m_page->setGroupName(String());
+ setHostWindow(0);
+
+ setDownloadDelegate(0);
+ setEditingDelegate(0);
+ setFrameLoadDelegate(0);
+ setFrameLoadDelegatePrivate(0);
+ setPolicyDelegate(0);
+ setResourceLoadDelegate(0);
+ setUIDelegate(0);
+ setFormDelegate(0);
+
+ delete m_page;
+ m_page = 0;
+
IWebNotificationCenter* notifyCenter = WebNotificationCenter::defaultCenterInternal();
COMPtr<IWebPreferences> prefs;
if (SUCCEEDED(preferences(&prefs)))
m_preferences = 0;
}
- setHostWindow(0);
- setFrameLoadDelegate(0);
- setFrameLoadDelegatePrivate(0);
- setUIDelegate(0);
- setFormDelegate(0);
- setPolicyDelegate(0);
-
- Frame* frame = NULL;
- frame = m_page->mainFrame();
- if (frame)
- frame->loader()->detachFromParent();
-
- delete m_page;
- m_page = 0;
-
deleteBackingStore();
}