Bug 1510985 - Remove Event.returnValue temporarily in 64. r=smaug a=jcristau FIREFOX_64_0_BUILD1
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 03 Dec 2018 15:24:39 -0500
changeset 501449 80a34446b74a
parent 501448 c814d6d044cc
child 501450 626d7b63b958
push id1867
push userjcristau@mozilla.com
push dateMon, 03 Dec 2018 20:26:53 +0000
treeherdermozilla-release@80a34446b74a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, jcristau
bugs1510985, 1479964
milestone64.0
Bug 1510985 - Remove Event.returnValue temporarily in 64. r=smaug a=jcristau Event.returnValue causes breaking a bank application. The reason of the breakage is, the web app assumes that Event.returnValue is available only on IE and it hits same incompatibility issue with window.event (bug 1479964). Additionally, the app may be used in various domains including in intranet. Therefore, we cannot disable it with blacklist of domains like other similar changes. Fortunately, we can ship new keypress event behaviors which is tracked by bug 1479964 in 65. So, for backward compatibility with 62 or earlier, we should temporarily disable Event.returnValue in 64. But unfortunately, this was introduced in 63. So, if some web apps have started to use this legacy attribute, we need to contact their vendors, though.
dom/base/DOMPrefsInternal.h
dom/webidl/Event.webidl
modules/libpref/init/StaticPrefList.h
testing/web-platform/meta/dom/events/AddEventListenerOptions-passive.html.ini
testing/web-platform/meta/dom/events/Event-constructors.html.ini
testing/web-platform/meta/dom/events/Event-defaultPrevented-after-dispatch.html.ini
testing/web-platform/meta/dom/events/Event-defaultPrevented.html.ini
testing/web-platform/meta/dom/events/Event-initEvent.html.ini
testing/web-platform/meta/dom/events/Event-returnValue.html.ini
testing/web-platform/meta/dom/events/EventTarget-dispatchEvent-returnvalue.html.ini
testing/web-platform/meta/dom/interfaces.html.ini
--- a/dom/base/DOMPrefsInternal.h
+++ b/dom/base/DOMPrefsInternal.h
@@ -11,16 +11,17 @@
 //   DOM_WEBIDL_PREF(foo_bar)
 //
 //   * This defines DOMPrefs::foo_bar(JSContext* aCx, JSObject* aObj) which
 //     returns the value of StaticPrefs::foo_bar().
 //     This is allows the use of DOMPrefs in WebIDL files.
 
 DOM_WEBIDL_PREF(canvas_imagebitmap_extensions_enabled)
 DOM_WEBIDL_PREF(dom_caches_enabled)
+DOM_WEBIDL_PREF(dom_event_returnValue_enabled)
 DOM_WEBIDL_PREF(dom_webnotifications_serviceworker_enabled)
 DOM_WEBIDL_PREF(dom_webnotifications_requireinteraction_enabled)
 DOM_WEBIDL_PREF(dom_serviceWorkers_enabled)
 DOM_WEBIDL_PREF(dom_storageManager_enabled)
 DOM_WEBIDL_PREF(dom_testing_structuredclonetester_enabled)
 DOM_WEBIDL_PREF(dom_promise_rejection_events_enabled)
 DOM_WEBIDL_PREF(dom_push_enabled)
 DOM_WEBIDL_PREF(gfx_offscreencanvas_enabled)
--- a/dom/webidl/Event.webidl
+++ b/dom/webidl/Event.webidl
@@ -31,17 +31,18 @@ interface Event {
 
   void stopPropagation();
   void stopImmediatePropagation();
 
   [Pure]
   readonly attribute boolean bubbles;
   [Pure]
   readonly attribute boolean cancelable;
-  [NeedsCallerType]
+  [NeedsCallerType,
+   Func="mozilla::dom::DOMPrefs::dom_event_returnValue_enabled"]
   attribute boolean returnValue;
   [NeedsCallerType]
   void preventDefault();
   [Pure, NeedsCallerType]
   readonly attribute boolean defaultPrevented;
   [ChromeOnly, Pure]
   readonly attribute boolean defaultPreventedByChrome;
   [ChromeOnly, Pure]
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -174,16 +174,23 @@ VARCACHE_PREF(
 #endif
 VARCACHE_PREF(
   "dom.animations-api.timelines.enabled",
    dom_animations_api_timelines_enabled,
   bool, PREF_VALUE
 )
 #undef PREF_VALUE
 
+// If this is true, event.returnValue is available.
+VARCACHE_PREF(
+  "dom.event.returnValue.enabled",
+   dom_event_returnValue_enabled,
+  RelaxedAtomicBool, false
+)
+
 // How long a content process can take before closing its IPC channel
 // after shutdown is initiated.  If the process exceeds the timeout,
 // we fear the worst and kill it.
 #if !defined(DEBUG) && !defined(MOZ_ASAN) && !defined(MOZ_VALGRIND) && \
     !defined(MOZ_TSAN)
 # define PREF_VALUE 5
 #else
 # define PREF_VALUE 0
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/dom/events/AddEventListenerOptions-passive.html.ini
@@ -0,0 +1,4 @@
+[AddEventListenerOptions-passive.html]
+  [returnValue should be ignored if-and-only-if the passive option is true]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/dom/events/Event-constructors.html.ini
@@ -0,0 +1,7 @@
+[Event-constructors.html]
+  [Event constructors 2]
+    expected: FAIL
+
+  [Event constructors 3]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/dom/events/Event-defaultPrevented-after-dispatch.html.ini
@@ -0,0 +1,4 @@
+[Event-defaultPrevented-after-dispatch.html]
+  [Default prevention via returnValue]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/dom/events/Event-defaultPrevented.html.ini
@@ -0,0 +1,4 @@
+[Event-defaultPrevented.html]
+  [returnValue should change defaultPrevented if cancelable is true.]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/dom/events/Event-initEvent.html.ini
@@ -0,0 +1,13 @@
+[Event-initEvent.html]
+  [Properties of initEvent(type, true, true)]
+    expected: FAIL
+
+  [Properties of initEvent(type, true, false)]
+    expected: FAIL
+
+  [Properties of initEvent(type, false, true)]
+    expected: FAIL
+
+  [Properties of initEvent(type, false, false)]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/dom/events/Event-returnValue.html.ini
@@ -0,0 +1,19 @@
+[Event-returnValue.html]
+  [When an event is created, returnValue should be initialized to true.]
+    expected: FAIL
+
+  [preventDefault() should not change returnValue if cancelable is false.]
+    expected: FAIL
+
+  [returnValue=false should have no effect if cancelable is false.]
+    expected: FAIL
+
+  [preventDefault() should change returnValue if cancelable is true.]
+    expected: FAIL
+
+  [initEvent should unset returnValue.]
+    expected: FAIL
+
+  [returnValue=true should have no effect once the canceled flag was set.]
+    expected: FAIL
+
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent-returnvalue.html.ini
@@ -0,0 +1,7 @@
+[EventTarget-dispatchEvent-returnvalue.html]
+  [Return value of EventTarget.dispatchEvent() affected by preventDefault().]
+    expected: FAIL
+
+  [Return value of EventTarget.dispatchEvent() affected by returnValue.]
+    expected: FAIL
+
--- a/testing/web-platform/meta/dom/interfaces.html.ini
+++ b/testing/web-platform/meta/dom/interfaces.html.ini
@@ -82,31 +82,55 @@
     expected: FAIL
 
   [Range interface: existence and properties of interface object]
     expected: FAIL
 
   [Range interface: existence and properties of interface prototype object]
     expected: FAIL
 
+  [Event interface: attribute returnValue]
+    expected: FAIL
+
+  [Event interface: document.createEvent("Event") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
+  [Event interface: new Event("foo") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
+  [Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type]
+    expected: FAIL
 
 [interfaces.html?1-1000]
   [Test driver]
     expected: FAIL
 
 
 [interfaces.html?1001-last]
   [Test driver]
     expected: FAIL
 
 
 [interfaces.html?exclude=Node]
   [Test driver]
     expected: FAIL
 
+[interfaces.html?exclude=Node]
+  [Event interface: attribute returnValue]
+    expected: FAIL
+
+  [Event interface: document.createEvent("Event") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
+  [Event interface: new Event("foo") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
+  [Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
   [Document interface: attribute origin]
     expected: FAIL
 
   [Document interface: new Document() must inherit property "origin" with the proper type]
     expected: FAIL
 
   [Document interface: xmlDoc must inherit property "origin" with the proper type]
     expected: FAIL
@@ -168,16 +192,28 @@
   [Range interface: existence and properties of interface prototype object]
     expected: FAIL
 
 
 [interfaces.html?include=Node]
 
 [interfaces.html?exclude=Node]
   prefs: [dom.window.event.enabled:true]
+  [Event interface: attribute returnValue]
+    expected: FAIL
+
+  [Event interface: document.createEvent("Event") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
+  [Event interface: new Event("foo") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
+  [Event interface: new CustomEvent("foo") must inherit property "returnValue" with the proper type]
+    expected: FAIL
+
   [Document interface: attribute origin]
     expected: FAIL
 
   [Document interface: new Document() must inherit property "origin" with the proper type]
     expected: FAIL
 
   [Document interface: xmlDoc must inherit property "origin" with the proper type]
     expected: FAIL