Diff
Modified: branches/safari-603.1.30.0-branch/Source/WebCore/ChangeLog (212818 => 212819)
--- branches/safari-603.1.30.0-branch/Source/WebCore/ChangeLog 2017-02-22 09:23:08 UTC (rev 212818)
+++ branches/safari-603.1.30.0-branch/Source/WebCore/ChangeLog 2017-02-22 09:50:42 UTC (rev 212819)
@@ -1,3 +1,25 @@
+2017-02-22 Matthew Hanson <[email protected]>
+
+ Merge r212773. rdar://problem/30640217
+
+ 2017-02-21 Chris Dumez <[email protected]>
+
+ REGRESSION (203941): iAd Producer: Clicking buttons in Preview does not work
+ https://bugs.webkit.org/show_bug.cgi?id=168677
+ <rdar://problem/30640101>
+
+ Reviewed by Ryosuke Niwa.
+
+ Add quirk to initMouseEvent to unbreak iAd Producer.
+
+ * dom/MouseEvent.cpp:
+ (WebCore::MouseEvent::initMouseEventQuirk):
+ * dom/MouseEvent.h:
+ * dom/MouseEvent.idl:
+ * platform/RuntimeApplicationChecks.h:
+ * platform/RuntimeApplicationChecks.mm:
+ (WebCore::MacApplication::isIADProducer):
+
2017-02-21 Matthew Hanson <[email protected]>
Merge r212737. rdar://problem/30636274
Modified: branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.cpp (212818 => 212819)
--- branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.cpp 2017-02-22 09:23:08 UTC (rev 212818)
+++ branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.cpp 2017-02-22 09:50:42 UTC (rev 212819)
@@ -28,11 +28,17 @@
#include "Frame.h"
#include "FrameView.h"
#include "HTMLIFrameElement.h"
+#include "JSDOMConvert.h"
+#include "JSEventTarget.h"
+#include "JSEventTargetCustom.h"
#include "PlatformMouseEvent.h"
+#include "RuntimeApplicationChecks.h"
#include <wtf/CurrentTime.h>
namespace WebCore {
+using namespace JSC;
+
Ref<MouseEvent> MouseEvent::create(const AtomicString& type, const MouseEventInit& initializer, IsTrusted isTrusted)
{
return adoptRef(*new MouseEvent(type, initializer, isTrusted));
@@ -170,6 +176,34 @@
// FIXME: m_dataTransfer is not set to 0 here.
}
+// FIXME: We need this quirk because iAd Producer is calling this function with a relatedTarget that is not an EventTarget (rdar://problem/30640101).
+// We should remove this quirk when possible.
+void MouseEvent::initMouseEventQuirk(ExecState& state, ScriptExecutionContext& scriptExecutionContext, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow* view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSValue relatedTargetValue)
+{
+ EventTarget* relatedTarget = nullptr;
+#if PLATFORM(MAC)
+ if (MacApplication::isIAdProducer()) {
+ // jsEventTargetCast() does not throw and will silently convert bad input to nullptr.
+ auto jsRelatedTarget = jsEventTargetCast(relatedTargetValue);
+ if (!jsRelatedTarget && !relatedTargetValue.isUndefinedOrNull())
+ scriptExecutionContext.addConsoleMessage(MessageSource::JS, MessageLevel::Warning, ASCIILiteral("Calling initMouseEvent() with a relatedTarget that is not an EventTarget is deprecated."));
+ relatedTarget = jsRelatedTarget ? &jsRelatedTarget->wrapped() : nullptr;
+ } else {
+#else
+ UNUSED_PARAM(scriptExecutionContext);
+#endif
+ // This is what the bindings generator would have produced.
+ auto throwScope = DECLARE_THROW_SCOPE(state.vm());
+ relatedTarget = convert<IDLNullable<IDLInterface<EventTarget>>>(state, relatedTargetValue, [](ExecState& state, ThrowScope& scope) {
+ throwArgumentTypeError(state, scope, 14, "relatedTarget", "MouseEvent", "initMouseEvent", "EventTarget");
+ });
+ RETURN_IF_EXCEPTION(throwScope, void());
+#if PLATFORM(MAC)
+ }
+#endif
+ initMouseEvent(type, canBubble, cancelable, view, detail, screenX, screenY, clientX, clientY, ctrlKey, altKey, shiftKey, metaKey, button, relatedTarget);
+}
+
EventInterface MouseEvent::eventInterface() const
{
return MouseEventInterfaceType;
Modified: branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.h (212818 => 212819)
--- branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.h 2017-02-22 09:23:08 UTC (rev 212818)
+++ branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.h 2017-02-22 09:50:42 UTC (rev 212819)
@@ -69,7 +69,7 @@
int detail, int screenX, int screenY, int clientX, int clientY,
bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
unsigned short button, PassRefPtr<EventTarget> relatedTarget);
-
+ void initMouseEventQuirk(JSC::ExecState&, ScriptExecutionContext&, const AtomicString& type, bool canBubble, bool cancelable, DOMWindow*, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, unsigned short button, JSC::JSValue relatedTarget);
// WinIE uses 1,4,2 for left/middle/right but not for click (just for mousedown/up, maybe others),
// but we will match the standard DOM.
unsigned short button() const { return m_button; }
Modified: branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.idl (212818 => 212819)
--- branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.idl 2017-02-22 09:23:08 UTC (rev 212818)
+++ branches/safari-603.1.30.0-branch/Source/WebCore/dom/MouseEvent.idl 2017-02-22 09:50:42 UTC (rev 212819)
@@ -39,11 +39,12 @@
[Conditional=MOUSE_FORCE_EVENTS, ImplementedAs=force]readonly attribute double webkitForce;
// FIXME: Using "undefined" as default parameter value is wrong.
- void initMouseEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false,
+ // FIXME: relatedTarget should be of type EventTarget? but we need to use any to support a quirk for iAd Producer (rdar://problem/30640101).
+ [CallWith=ScriptState&ScriptExecutionContext, ImplementedAs=initMouseEventQuirk] void initMouseEvent(optional DOMString type = "undefined", optional boolean canBubble = false, optional boolean cancelable = false,
optional DOMWindow? view = null, optional long detail = 0,
optional long screenX = 0, optional long screenY = 0, optional long clientX = 0, optional long clientY = 0,
optional boolean ctrlKey = false, optional boolean altKey = false, optional boolean shiftKey = false, optional boolean metaKey = false,
- optional unsigned short button = 0, optional EventTarget? relatedTarget = null);
+ optional unsigned short button = 0, optional any relatedTarget = null);
readonly attribute long offsetX;
readonly attribute long offsetY;
Modified: branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.h (212818 => 212819)
--- branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.h 2017-02-22 09:23:08 UTC (rev 212818)
+++ branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.h 2017-02-22 09:50:42 UTC (rev 212819)
@@ -53,6 +53,7 @@
WEBCORE_EXPORT bool isVersions();
WEBCORE_EXPORT bool isHRBlock();
WEBCORE_EXPORT bool isAppStore();
+WEBCORE_EXPORT bool isIAdProducer();
} // MacApplication
Modified: branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.mm (212818 => 212819)
--- branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.mm 2017-02-22 09:23:08 UTC (rev 212818)
+++ branches/safari-603.1.30.0-branch/Source/WebCore/platform/RuntimeApplicationChecks.mm 2017-02-22 09:50:42 UTC (rev 212819)
@@ -148,6 +148,12 @@
return isHRBlock;
}
+bool MacApplication::isIAdProducer()
+{
+ static bool isIAdProducer = applicationBundleIsEqualTo("com.apple.iAdProducer");
+ return isIAdProducer;
+}
+
bool MacApplication::isSolidStateNetworksDownloader()
{
static bool isSolidStateNetworksDownloader = applicationBundleIsEqualTo("com.solidstatenetworks.awkhost");