Reviewed by Mitz.
- fix <rdar://problem/
5530185> WebKit does not show <object> fallback content when both
URL and MIME type is omitted
Already covered by existing tests (that had incorrect results).
* loader/FrameLoader.cpp: (WebCore::FrameLoader::requestObject): Return false to indicate
failure when both URL and MIME type are empty. The old code would not attempt a load, but
it would indicate success.
* rendering/RenderPartObject.cpp: (WebCore::RenderPartObject::updateWidget): Remove
non-helpful early exit for the case where there is no URL and no type. Returning early
prevents the fallback code from running.
WebKit:
Reviewed by Mitz.
- fix problem I ran into while doing some testing on Mac for
<rdar://problem/
5530185> WebKit does not show <object>
fallback content when both URL and MIME type is omitted
I don't know how to reproduce this failure in DumpRenderTree, so there is no
regression test.
* Plugins/WebNullPluginView.h: Removed some unneeded declarations, including
the didSendError local variable. Instead we just set the error to nil once
we've sent it.
* Plugins/WebNullPluginView.mm:
(-[WebNullPluginView initWithFrame:error:DOMElement:]): Refactored so that
the null plug-in image code is separate from the rest of the function and
so that the whole thing is not inside an if statement. Also don't hold a
reference to the DOM element if there is no error to report.
(-[WebNullPluginView reportFailure]): Added. Does the actual delegate
callback. Happens back at the top level of the run loop so it doesn't
fire deep inside layout. Also wrote this so that it is guaranteed not to
reenter and so that it can handle the case where the delegate destroys
the world (including this object). NOTE: This is not a real, general
solution to the problem of plug-ins that do work inside layout. We will need
a more general fix that works for other plug-ins, and we'll track that with
a separate bug report.
(-[WebNullPluginView viewDidMoveToWindow]): Removed most of the code;
changed so it just does a performSelector:afterDelay:0.
LayoutTests:
Reviewed by Mitz.
- update tests affected by fix for <rdar://problem/
5530185> WebKit does not show
<object> fallback content when both URL and MIME type is omitted
* dom/html/level2/html/AppletsCollection-expected.txt: The text "Nothing here!" renders now.
* fast/dom/HTMLDocument/object-by-name-unknown-child-element-expected.txt: Some blank
space renders now.
* platform/mac/fast/invalid/residual-style-expected.txt: A font element renders now.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27378
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Mitz.
+
+ - update tests affected by fix for <rdar://problem/5530185> WebKit does not show
+ <object> fallback content when both URL and MIME type is omitted
+
+ * dom/html/level2/html/AppletsCollection-expected.txt: The text "Nothing here!" renders now.
+ * fast/dom/HTMLDocument/object-by-name-unknown-child-element-expected.txt: Some blank
+ space renders now.
+ * platform/mac/fast/invalid/residual-style-expected.txt: A font element renders now.
+
2007-11-01 Dan Bernstein <mitz@apple.com>
- fix typo in test name
Applets length is currently 0
-
+Nothing here!
Applets length is currently 0
-
This tests that an object element with an unknown child element is still part of the document's named item map.
SUCCESS
RenderText {#text} at (0,0) size 68x18
text run at (0,0) width 68: "OBJECT: "
RenderInline {FONT} at (0,0) size 171x18 [color=#008000]
- RenderPartObject {OBJECT} at (68,14) size 0x0
+ RenderInline {OBJECT} at (0,0) size 0x18
+ RenderInline {FONT} at (0,0) size 0x18 [color=#FF0000]
RenderText {#text} at (68,0) size 171x18
text run at (68,0) width 171: "All of this should be green."
RenderText {#text} at (0,0) size 0x0
RenderText {#text} at (0,0) size 66x18
text run at (0,0) width 66: "PARAM: "
RenderInline {FONT} at (0,0) size 171x18 [color=#008000]
- RenderPartObject {OBJECT} at (66,14) size 0x0
+ RenderInline {OBJECT} at (0,0) size 0x18
+ RenderInline {FONT} at (0,0) size 0x18 [color=#FF0000]
RenderText {#text} at (66,0) size 171x18
text run at (66,0) width 171: "All of this should be green."
RenderText {#text} at (0,0) size 0x0
+2007-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Mitz.
+
+ - fix <rdar://problem/5530185> WebKit does not show <object> fallback content when both
+ URL and MIME type is omitted
+
+ Already covered by existing tests (that had incorrect results).
+
+ * loader/FrameLoader.cpp: (WebCore::FrameLoader::requestObject): Return false to indicate
+ failure when both URL and MIME type are empty. The old code would not attempt a load, but
+ it would indicate success.
+
+ * rendering/RenderPartObject.cpp: (WebCore::RenderPartObject::updateWidget): Remove
+ non-helpful early exit for the case where there is no URL and no type. Returning early
+ prevents the fallback code from running.
+
2007-11-02 Alp Toker <alp@atoker.com>
Reviewed by Darin.
const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues)
{
if (url.isEmpty() && mimeType.isEmpty())
- return true;
+ return false;
#if USE(LOW_BANDWIDTH_DISPLAY)
// don't care object during low bandwidth display
if (serviceType.isEmpty() && !o->m_classId.isEmpty())
mapClassIdToServiceType(o->m_classId, serviceType);
- // If no URL and type, abort.
- if (url.isEmpty() && serviceType.isEmpty())
- return;
if (!isURLAllowed(document(), url))
return;
+2007-11-02 Darin Adler <darin@apple.com>
+
+ Reviewed by Mitz.
+
+ - fix problem I ran into while doing some testing on Mac for
+ <rdar://problem/5530185> WebKit does not show <object>
+ fallback content when both URL and MIME type is omitted
+
+ I don't know how to reproduce this failure in DumpRenderTree, so there is no
+ regression test.
+
+ * Plugins/WebNullPluginView.h: Removed some unneeded declarations, including
+ the didSendError local variable. Instead we just set the error to nil once
+ we've sent it.
+ * Plugins/WebNullPluginView.mm:
+ (-[WebNullPluginView initWithFrame:error:DOMElement:]): Refactored so that
+ the null plug-in image code is separate from the rest of the function and
+ so that the whole thing is not inside an if statement. Also don't hold a
+ reference to the DOM element if there is no error to report.
+ (-[WebNullPluginView reportFailure]): Added. Does the actual delegate
+ callback. Happens back at the top level of the run loop so it doesn't
+ fire deep inside layout. Also wrote this so that it is guaranteed not to
+ reenter and so that it can handle the case where the delegate destroys
+ the world (including this object). NOTE: This is not a real, general
+ solution to the problem of plug-ins that do work inside layout. We will need
+ a more general fix that works for other plug-ins, and we'll track that with
+ a separate bug report.
+ (-[WebNullPluginView viewDidMoveToWindow]): Removed most of the code;
+ changed so it just does a performSelector:afterDelay:0.
+
2007-11-02 Mark Rowe <mrowe@apple.com>
Reviewed by Darin Adler.
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#import <AppKit/AppKit.h>
-@class NSError;
-@class WebFrame;
@class DOMElement;
@interface WebNullPluginView : NSImageView
{
- BOOL didSendError;
NSError *error;
DOMElement *element;
}
-- (id)initWithFrame:(NSRect)frame error:(NSError *)pluginError DOMElement:(DOMElement *)element;
+- (id)initWithFrame:(NSRect)frame error:(NSError *)error DOMElement:(DOMElement *)element;
@end
/*
- * Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#import "WebNullPluginView.h"
+
+#import "WebFrameInternal.h"
+#import "WebViewInternal.h"
#import <WebCore/Document.h>
-#import <WebCore/Element.h>
-#import <WebKit/WebDataSource.h>
-#import <WebKit/WebFrame.h>
-#import <WebKit/WebFrameInternal.h>
-#import <WebKit/WebFrameView.h>
-#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebNSViewExtras.h>
-#import <WebKit/WebNullPluginView.h>
-#import <WebKit/WebResourceLoadDelegate.h>
-#import <WebKit/WebViewInternal.h>
-
-static NSImage *image = nil;
@implementation WebNullPluginView
-- initWithFrame:(NSRect)frame error:(NSError *)pluginError DOMElement:(DOMElement *)anElement
+- initWithFrame:(NSRect)frame error:(NSError *)err DOMElement:(DOMElement *)elem
{
- self = [super initWithFrame:frame];
- if (self) {
-
- if (!image) {
- NSBundle *bundle = [NSBundle bundleForClass:[WebNullPluginView class]];
- NSString *imagePath = [bundle pathForResource:@"nullplugin" ofType:@"tiff"];
- image = [[NSImage alloc] initWithContentsOfFile:imagePath];
- }
-
- [self setImage:image];
-
- error = [pluginError retain];
- element = [anElement retain];
+ static NSImage *nullPlugInImage;
+ if (!nullPlugInImage) {
+ NSBundle *bundle = [NSBundle bundleForClass:[WebNullPluginView class]];
+ NSString *imagePath = [bundle pathForResource:@"nullplugin" ofType:@"tiff"];
+ nullPlugInImage = [[NSImage alloc] initWithContentsOfFile:imagePath];
}
+
+ self = [super initWithFrame:frame];
+ if (!self)
+ return nil;
+
+ error = [err retain];
+ if (err)
+ element = [elem retain];
+
+ [self setImage:nullPlugInImage];
+
return self;
}
[super dealloc];
}
-- (void)viewDidMoveToWindow
+- (void)reportFailure
{
- if (!didSendError && _window && error) {
- didSendError = YES;
- WebFrame *webFrame = kit(core(element)->document()->frame());
- WebView *webView = [webFrame webView];
- WebDataSource *dataSource = [webFrame _dataSource];
+ NSError *localError = error;
+ DOMElement *localElement = element;
+ error = nil;
+ element = nil;
+
+ WebFrame *webFrame = kit(core(localElement)->document()->frame());
+ if (webFrame) {
+ WebView *webView = [webFrame webView];
WebResourceDelegateImplementationCache implementations = WebViewGetResourceLoadDelegateImplementations(webView);
if (implementations.plugInFailedWithErrorFunc)
- CallResourceLoadDelegate(implementations.plugInFailedWithErrorFunc, webView, @selector(webView:plugInFailedWithError:dataSource:), error, dataSource);
+ CallResourceLoadDelegate(implementations.plugInFailedWithErrorFunc, webView,
+ @selector(webView:plugInFailedWithError:dataSource:), localError, [webFrame _dataSource]);
}
+
+ [localError release];
+ [localElement release];
+}
+
+- (void)viewDidMoveToWindow
+{
+ if (!error)
+ return;
+
+ [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(reportFailure) object:nil];
+ if ([self window])
+ [self performSelector:@selector(reportFailure) withObject:nil afterDelay:0.0];
}
@end