Title: [207908] trunk/Source/WebCore
Revision
207908
Author
[email protected]
Date
2016-10-26 13:17:24 -0700 (Wed, 26 Oct 2016)

Log Message

Regression(r203848): 百度糯米 app fails to load content due to a _javascript_ error
https://bugs.webkit.org/show_bug.cgi?id=163967
<rdar://problem/28707838>

Reviewed by Ryosuke Niwa.

Add quirk for 百度糯米 app making the 2 last parameters to Event.prototype.initEvent()
optional.

No new tests, change only impacts this specific application.

* bindings/scripts/CodeGeneratorJS.pm:
(GeneratePropertiesHashTable):
* dom/Event.cpp:
(WebCore::Event::initEventForBindings):
* dom/Event.h:
* dom/Event.idl:
* platform/RuntimeApplicationChecks.h:
* platform/RuntimeApplicationChecks.mm:
(WebCore::IOSApplication::isBaiduNuomi):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (207907 => 207908)


--- trunk/Source/WebCore/ChangeLog	2016-10-26 19:27:20 UTC (rev 207907)
+++ trunk/Source/WebCore/ChangeLog	2016-10-26 20:17:24 UTC (rev 207908)
@@ -1,5 +1,28 @@
 2016-10-26  Chris Dumez  <[email protected]>
 
+        Regression(r203848): 百度糯米 app fails to load content due to a _javascript_ error
+        https://bugs.webkit.org/show_bug.cgi?id=163967
+        <rdar://problem/28707838>
+
+        Reviewed by Ryosuke Niwa.
+
+        Add quirk for 百度糯米 app making the 2 last parameters to Event.prototype.initEvent()
+        optional.
+
+        No new tests, change only impacts this specific application.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GeneratePropertiesHashTable):
+        * dom/Event.cpp:
+        (WebCore::Event::initEventForBindings):
+        * dom/Event.h:
+        * dom/Event.idl:
+        * platform/RuntimeApplicationChecks.h:
+        * platform/RuntimeApplicationChecks.mm:
+        (WebCore::IOSApplication::isBaiduNuomi):
+
+2016-10-26  Chris Dumez  <[email protected]>
+
         First parameter to TextTrack.addCue() / removeCue() should not be nullable
         https://bugs.webkit.org/show_bug.cgi?id=164020
 

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (207907 => 207908)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-10-26 19:27:20 UTC (rev 207907)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-10-26 20:17:24 UTC (rev 207908)
@@ -1859,6 +1859,10 @@
         push(@$hashValue1, $functionName);
 
         my $functionLength = GetFunctionLength($function);
+
+        # FIXME: Remove this once we can get rid of the quirk introduced in https://bugs.webkit.org/show_bug.cgi?id=163967.
+        $functionLength = 3 if $interfaceName eq "Event" and $function->signature->name eq "initEvent";
+
         push(@$hashValue2, $functionLength);
 
         push(@$hashSpecials, ComputeFunctionSpecial($interface, $function));

Modified: trunk/Source/WebCore/dom/Event.cpp (207907 => 207908)


--- trunk/Source/WebCore/dom/Event.cpp	2016-10-26 19:27:20 UTC (rev 207907)
+++ trunk/Source/WebCore/dom/Event.cpp	2016-10-26 20:17:24 UTC (rev 207908)
@@ -26,6 +26,7 @@
 #include "EventNames.h"
 #include "EventPath.h"
 #include "EventTarget.h"
+#include "RuntimeApplicationChecks.h"
 #include "UserGestureIndicator.h"
 #include <wtf/CurrentTime.h>
 
@@ -89,6 +90,23 @@
     m_cancelable = cancelableArg;
 }
 
+ExceptionOr<void> Event::initEventForBindings(ScriptExecutionContext& scriptExecutionContext, const AtomicString& type, bool bubbles)
+{
+#if PLATFORM(IOS)
+    // FIXME: Temporary quirk for Baidu Nuomi App which calls initEvent() with too few parameters (rdar://problem/28707838).
+    if (IOSApplication::isBaiduNuomi()) {
+        scriptExecutionContext.addConsoleMessage(MessageSource::JS, MessageLevel::Warning, ASCIILiteral("Calling Event.prototype.initEvent() with less than 3 parameters is deprecated."));
+        initEvent(type, bubbles, false);
+        return { };
+    }
+#else
+    UNUSED_PARAM(scriptExecutionContext);
+    UNUSED_PARAM(type);
+    UNUSED_PARAM(bubbles);
+#endif
+    return Exception { TypeError, ASCIILiteral("Not enough arguments") };
+}
+
 bool Event::composed() const
 {
     if (m_composed)

Modified: trunk/Source/WebCore/dom/Event.h (207907 => 207908)


--- trunk/Source/WebCore/dom/Event.h	2016-10-26 19:27:20 UTC (rev 207907)
+++ trunk/Source/WebCore/dom/Event.h	2016-10-26 20:17:24 UTC (rev 207908)
@@ -27,6 +27,7 @@
 #include "DOMTimeStamp.h"
 #include "EventInit.h"
 #include "EventInterfaces.h"
+#include "ExceptionOr.h"
 #include "ScriptWrappable.h"
 #include <wtf/RefCounted.h>
 #include <wtf/TypeCasts.h>
@@ -38,6 +39,7 @@
 class EventPath;
 class EventTarget;
 class HTMLIFrameElement;
+class ScriptExecutionContext;
 
 enum EventInterface {
 
@@ -95,6 +97,8 @@
     virtual ~Event();
 
     WEBCORE_EXPORT void initEvent(const AtomicString& type, bool canBubble, bool cancelable);
+    ExceptionOr<void> initEventForBindings(ScriptExecutionContext&, const AtomicString& type, bool bubbles); // Quirk.
+
     bool isInitialized() const { return m_isInitialized; }
 
     const AtomicString& type() const { return m_type; }

Modified: trunk/Source/WebCore/dom/Event.idl (207907 => 207908)


--- trunk/Source/WebCore/dom/Event.idl	2016-10-26 19:27:20 UTC (rev 207907)
+++ trunk/Source/WebCore/dom/Event.idl	2016-10-26 20:17:24 UTC (rev 207908)
@@ -65,7 +65,8 @@
     void stopPropagation();
     void preventDefault();
 
-    void initEvent(DOMString eventTypeArg, boolean canBubbleArg, boolean cancelableArg);
+    void initEvent(DOMString type, boolean bubbles, boolean cancelable); // Standard.
+    [MayThrowException, ImplementedAs=initEventForBindings, CallWith=ScriptExecutionContext] void initEvent(DOMString type, optional boolean bubbles = false); // Quirk.
 
     readonly attribute boolean defaultPrevented;
     void stopImmediatePropagation();

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (207907 => 207908)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2016-10-26 19:27:20 UTC (rev 207907)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2016-10-26 20:17:24 UTC (rev 207908)
@@ -75,6 +75,7 @@
 WEBCORE_EXPORT bool isWebProcess();
 bool isIBooks();
 WEBCORE_EXPORT bool isTheSecretSocietyHiddenMystery();
+bool isBaiduNuomi();
 
 } // IOSApplication
 

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm (207907 => 207908)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm	2016-10-26 19:27:20 UTC (rev 207907)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.mm	2016-10-26 20:17:24 UTC (rev 207908)
@@ -252,7 +252,13 @@
     static bool isTheSecretSocietyHiddenMystery = applicationBundleIsEqualTo("com.g5e.secretsociety");
     return isTheSecretSocietyHiddenMystery;
 }
-    
+
+bool IOSApplication::isBaiduNuomi()
+{
+    static bool isBaiduNuomi = applicationBundleIsEqualTo("com.renren-inc.nuomi");
+    return isBaiduNuomi;
+}
+
 #endif
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to