Reviewed by Darin Adler.
Removed Dashboard quirk from expected results. Now that we have a Dashboard
quirks mode, there's no reason to keep the old, bad behavior in the browser.
* http/tests/xmlhttprequest/exceptions-expected.txt:
* http/tests/xmlhttprequest/exceptions.html:
WebCore:
Reviewed by Darin Adler.
Added support for Dashboard backward compatibility mode.
* html/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::stroke): Added support for old behavior
of automatically clearing the stroke path buffer after a call to stroke().
* html/HTMLCanvasElement.cpp: Added supoprt for old behavior of the canvas
tag being self-closing.
(WebCore::HTMLCanvasElement::endTagRequirement):
(WebCore::HTMLCanvasElement::tagPriority):
* html/HTMLCanvasElement.h:
* html/HTMLParser.cpp: Ditto.
(WebCore::HTMLParser::canvasCreateErrorCheck):
* xml/xmlhttprequest.cpp: Added support for old behavior of silently ignoring
a call to setRequestHeader() if it preceded a call to open() or followed a call
to send().
(WebCore::XMLHttpRequest::setRequestHeader):
WebKit:
Reviewed by Darin Adler.
Added SPI for enabling Dashboard backward compatibility mode. For now,
we enable it unconditionally for Dashboard and Dashcode. Once they
implement specific support for the backward compatibility mode behavior,
we can change that.
Set the default WebDashboardBehaviorUseBackwardCompatibilityModeEnabled
to YES in order to turn this code on.
* WebView/WebView.mm:
(-[WebView _setDashboardBehavior:to:]):
(-[WebView _dashboardBehavior:]):
* WebView/WebViewPrivate.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@18009
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Removed Dashboard quirk from expected results. Now that we have a Dashboard
+ quirks mode, there's no reason to keep the old, bad behavior in the browser.
+
+ * http/tests/xmlhttprequest/exceptions-expected.txt:
+ * http/tests/xmlhttprequest/exceptions.html:
+
2006-12-04 Rob Buis <buis@kde.org>
Reviewed by dhyatt.
Test that XMLHttpRequest raises exceptions when it should.
new XMLHttpRequest()
+PASS: req.setRequestHeader("Foo", "bar") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
PASS: req.send(null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
PASS: req.open("GET", "http://www.apple.com/", true) threw exception Error: Permission denied.
open()
PASS: req.statusText() threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
send()
PASS: req.send(null) threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
+PASS: req.setRequestHeader("Foo", "bar") threw exception Error: INVALID_STATE_ERR: DOM Exception 11.
PASS: req.getResponseHeader() threw exception SyntaxError: Not enough arguments.
}
log("new XMLHttpRequest()");
- // According to the XHR spec, this should throw INVALID_STATE_ERR. However,
- // widgets exist that depend on WebKit not throwing an exception here, and
- // to make them keep working we have to go against spec and support this
- // legacy behavior. See <rdar://problem/4758577> "REGRESSION: Business and
- // People widgets fails to complete search query" for more details.
- req.setRequestHeader("Foo", "bar");
-
+ shouldThrow('req.setRequestHeader("Foo", "bar")');
shouldThrow('req.send(null)');
-
shouldThrow('req.open("GET", "http://www.apple.com/", true)');
req.open('GET', 'resources/zero-length.txt', false);
log("send()");
shouldThrow('req.send(null)');
-
- // According to the XHR spec, this should throw INVALID_STATE_ERR. However,
- // widgets exist that depend on WebKit not throwing an exception here, and
- // to make them keep working we have to go against spec and support this
- // legacy behavior. See <rdar://problem/4758577> "REGRESSION: Business and
- // People widgets fails to complete search query" for more details.
- req.setRequestHeader("Foo", "bar");
-
+ shouldThrow('req.setRequestHeader("Foo", "bar")');
shouldThrow('req.getResponseHeader()');
</script>
+2006-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Added support for Dashboard backward compatibility mode.
+
+ * html/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::stroke): Added support for old behavior
+ of automatically clearing the stroke path buffer after a call to stroke().
+ * html/HTMLCanvasElement.cpp: Added supoprt for old behavior of the canvas
+ tag being self-closing.
+ (WebCore::HTMLCanvasElement::endTagRequirement):
+ (WebCore::HTMLCanvasElement::tagPriority):
+ * html/HTMLCanvasElement.h:
+ * html/HTMLParser.cpp: Ditto.
+ (WebCore::HTMLParser::canvasCreateErrorCheck):
+ * xml/xmlhttprequest.cpp: Added support for old behavior of silently ignoring
+ a call to setRequestHeader() if it preceded a call to open() or followed a call
+ to send().
+ (WebCore::XMLHttpRequest::setRequestHeader):
+
2006-12-04 Darin Adler <darin@apple.com>
Reviewed by Alice.
- (void)setEditableLinkBehavior:(int)behavior;
- (int)editableLinkBehavior;
+- (void)setShouldUseDashboardBackwardCompatibilityMode:(BOOL)use;
+- (BOOL)shouldUseDashboardBackwardCompatibilityMode;
+
- (WebCoreSettingsImpl *)settings;
@end
return (int)settings->editableLinkBehavior();
}
+- (void)setShouldUseDashboardBackwardCompatibilityMode:(BOOL)use
+{
+ settings->setShouldUseDashboardBackwardCompatibilityMode(use);
+}
+
+- (BOOL)shouldUseDashboardBackwardCompatibilityMode;
+{
+ return settings->shouldUseDashboardBackwardCompatibilityMode();
+}
+
- (Settings *)settings
{
return settings;
#include "config.h"
#include "CanvasRenderingContext2D.h"
+#include "AffineTransform.h"
#include "CachedImage.h"
#include "CanvasGradient.h"
#include "CanvasPattern.h"
#include "CanvasStyle.h"
+#include "Document.h"
#include "ExceptionCode.h"
+#include "Frame.h"
#include "GraphicsContext.h"
#include "HTMLCanvasElement.h"
#include "HTMLImageElement.h"
#include "HTMLNames.h"
#include "RenderHTMLCanvas.h"
+#include "Settings.h"
#include "cssparser.h"
-#include "AffineTransform.h"
#include <wtf/MathExtras.h>
namespace WebCore {
CGContextStrokePath(c->platformContext());
}
#endif
+
+ if (m_canvas && m_canvas->document()->frame() && m_canvas->document()->frame()->settings()->shouldUseDashboardBackwardCompatibilityMode())
+ state().m_path.clear();
}
void CanvasRenderingContext2D::clip()
#include "Page.h"
#include "RenderHTMLCanvas.h"
#include "Chrome.h"
+#include "Settings.h"
#include "Screen.h"
#include <math.h>
using namespace HTMLNames;
-// These value come from the specification.
+// These values come from the WhatWG spec.
const int defaultWidth = 300;
const int defaultHeight = 150;
delete m_drawingContext;
}
+HTMLTagStatus HTMLCanvasElement::endTagRequirement() const
+{
+ if (document()->frame() && document()->frame()->settings()->shouldUseDashboardBackwardCompatibilityMode())
+ return TagStatusForbidden;
+
+ return HTMLElement::endTagRequirement();
+}
+
+int HTMLCanvasElement::tagPriority() const
+{
+ if (document()->frame() && document()->frame()->settings()->shouldUseDashboardBackwardCompatibilityMode())
+ return 0;
+
+ return HTMLElement::tagPriority();
+}
+
void HTMLCanvasElement::parseMappedAttribute(MappedAttribute* attr)
{
const QualifiedName& attrName = attr->name();
HTMLCanvasElement(Document*);
virtual ~HTMLCanvasElement();
+ virtual HTMLTagStatus endTagRequirement() const;
+ virtual int tagPriority() const;
+
int width() const { return m_size.width(); }
int height() const { return m_size.height(); }
void setWidth(int);
#include "HTMLTableSectionElement.h"
#include "HTMLTokenizer.h"
#include "LocalizedStrings.h"
+#include "Settings.h"
#include "Text.h"
namespace WebCore {
bool HTMLParser::canvasCreateErrorCheck(Token* t, RefPtr<Node>& result)
{
+ if (document->frame() && document->frame()->settings()->shouldUseDashboardBackwardCompatibilityMode())
+ return true;
+
if (!m_fragment && document->frame() && document->frame()->javaScriptEnabled())
setSkipMode(canvasTag);
return true;
, m_pluginsEnabled(0)
, m_javaScriptEnabled(0)
, m_javaScriptCanOpenWindowsAutomatically(0)
- , m_shouldPrintBackgrounds(0)
+ , m_shouldPrintBackgrounds(false)
, m_textAreasAreResizable(0)
+ , m_shouldUseDashboardBackwardCompatibilityMode(false)
, m_editableLinkBehavior(EditableLinkDefaultBehavior)
{
}
void setTextAreasAreResizable(bool f) { m_textAreasAreResizable = f; }
void setEditableLinkBehavior(EditableLinkBehavior e) { m_editableLinkBehavior = e; }
+ void setShouldUseDashboardBackwardCompatibilityMode(bool b) { m_shouldUseDashboardBackwardCompatibilityMode = b; }
+ bool shouldUseDashboardBackwardCompatibilityMode() const { return m_shouldUseDashboardBackwardCompatibilityMode; }
+
private:
AtomicString m_stdFontName;
AtomicString m_fixedFontName;
bool m_javaScriptCanOpenWindowsAutomatically : 1;
bool m_shouldPrintBackgrounds : 1;
bool m_textAreasAreResizable : 1;
+ bool m_shouldUseDashboardBackwardCompatibilityMode : 1;
EditableLinkBehavior m_editableLinkBehavior;
};
#include "EventNames.h"
#include "ExceptionCode.h"
#include "FormData.h"
+#include "Frame.h"
#include "HTMLDocument.h"
#include "LoaderFunctions.h"
#include "PlatformString.h"
#include "RegularExpression.h"
#include "ResourceHandle.h"
#include "ResourceRequest.h"
+#include "Settings.h"
#include "TextEncoding.h"
#include "kjs_binding.h"
#include <kjs/protect.h>
void XMLHttpRequest::setRequestHeader(const String& name, const String& value, ExceptionCode& ec)
{
- if (m_state != Open)
- // rdar 4758577: XHR spec says an exception should be thrown here. However, doing so breaks the Business and People widgets.
+ if (m_state != Open) {
+ if (m_doc && m_doc->frame() && m_doc->frame()->settings()->shouldUseDashboardBackwardCompatibilityMode())
+ return;
+
+ ec = INVALID_STATE_ERR;
return;
+ }
if (!m_requestHeaders.contains(name)) {
m_requestHeaders.set(name, value);
+2006-12-02 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Darin Adler.
+
+ Added SPI for enabling Dashboard backward compatibility mode. For now,
+ we enable it unconditionally for Dashboard and Dashcode. Once they
+ implement specific support for the backward compatibility mode behavior,
+ we can change that.
+
+ Set the default WebDashboardBehaviorUseBackwardCompatibilityModeEnabled
+ to YES in order to turn this code on.
+
+ * WebView/WebView.mm:
+ (-[WebView _setDashboardBehavior:to:]):
+ (-[WebView _dashboardBehavior:]):
+ * WebView/WebViewPrivate.h:
+
2006-12-04 Darin Adler <darin@apple.com>
Reviewed by Alice.
return regions;
}
-- (void)_setDashboardBehavior:(WebDashboardBehavior)behavior to:(BOOL)flag;
+- (void)_setDashboardBehavior:(WebDashboardBehavior)behavior to:(BOOL)flag
{
+ // FIXME: Remove this defaults read once we decide to "turn on" compatibility
+ // mode support for good.
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"WebDashboardBehaviorUseBackwardCompatibilityModeEnabled"]) {
+ // FIXME: Remove this blanket assignment once Dashboard and Dashcode implement
+ // specific support for the backward compatibility mode flag.
+ if (behavior == WebDashboardBehaviorAllowWheelScrolling && flag == NO)
+ [_private->settings setShouldUseDashboardBackwardCompatibilityMode:YES];
+ }
+
switch (behavior) {
case WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows: {
_private->dashboardBehaviorAlwaysSendMouseEventsToAllWindows = flag;
_private->dashboardBehaviorAllowWheelScrolling = flag;
break;
}
+ case WebDashboardBehaviorUseBackwardCompatibilityMode: {
+ [_private->settings setShouldUseDashboardBackwardCompatibilityMode:flag];
+ break;
+ }
}
}
case WebDashboardBehaviorAllowWheelScrolling: {
return _private->dashboardBehaviorAllowWheelScrolling;
}
+ case WebDashboardBehaviorUseBackwardCompatibilityMode: {
+ return [_private->settings shouldUseDashboardBackwardCompatibilityMode];
+ }
}
return NO;
}
WebDashboardBehaviorAlwaysSendMouseEventsToAllWindows,
WebDashboardBehaviorAlwaysSendActiveNullEventsToPlugIns,
WebDashboardBehaviorAlwaysAcceptsFirstMouse,
- WebDashboardBehaviorAllowWheelScrolling
+ WebDashboardBehaviorAllowWheelScrolling,
+ WebDashboardBehaviorUseBackwardCompatibilityMode
} WebDashboardBehavior;
@interface WebController : NSTreeController {