Backed out changeset 2aa62db58f24 (bug 673919) due to Web compat
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 01 Aug 2013 06:44:51 +0900
changeset 153107 bd49d8389a9b6b9e12fd068b92809ec13e847c23
parent 153106 133bde40e6bcac97ac71cbb8697c18c826f25b6c
child 153108 b662cd70ea7570309daddcf9d40d81a182904b51
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs673919
milestone25.0a1
backs out2aa62db58f2488f67ee73980c5cc4b816272feca
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 2aa62db58f24 (bug 673919) due to Web compat
content/html/document/src/nsHTMLDocument.cpp
content/html/document/src/nsHTMLDocument.h
dom/base/nsGlobalWindow.cpp
dom/interfaces/base/nsIDOMJSWindow.idl
dom/interfaces/html/nsIDOMHTMLDocument.idl
dom/locales/en-US/chrome/dom/dom.properties
dom/webidl/HTMLDocument.webidl
js/xpconnect/crashtests/806751.html
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -140,16 +140,25 @@ static bool ConvertToMidasInternalComman
                                             bool& boolValue);
 
 static bool ConvertToMidasInternalCommand(const nsAString & inCommandID,
                                             nsACString& outCommandID);
 
 // ==================================================================
 // =
 // ==================================================================
+static void
+ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
+{
+  nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+                                  "DOM Events", aDoc,
+                                  nsContentUtils::eDOM_PROPERTIES,
+                                  aWarning);
+}
+
 static nsresult
 RemoveFromAgentSheets(nsCOMArray<nsIStyleSheet> &aAgentSheets, const nsAString& url)
 {
   nsCOMPtr<nsIURI> uri;
   nsresult rv = NS_NewURI(getter_AddRefs(uri), url);
   NS_ENSURE_SUCCESS(rv, rv);
 
   for (int32_t i = aAgentSheets.Count() - 1; i >= 0; --i) {
@@ -2233,16 +2242,37 @@ nsHTMLDocument::GetSelection(ErrorResult
     return nullptr;
   }
 
   nsCOMPtr<nsISelection> sel;
   rv = window->GetSelection(getter_AddRefs(sel));
   return sel.forget();
 }
 
+NS_IMETHODIMP
+nsHTMLDocument::CaptureEvents(int32_t aEventFlags)
+{
+  ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLDocument::ReleaseEvents(int32_t aEventFlags)
+{
+  ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt)
+{
+  ReportUseOfDeprecatedMethod(this, "UseOfRouteEventWarning");
+  return NS_OK;
+}
+
 // Mapped to document.embeds for NS4 compatibility
 NS_IMETHODIMP
 nsHTMLDocument::GetPlugins(nsIDOMHTMLCollection** aPlugins)
 {
   *aPlugins = nullptr;
 
   return GetEmbeds(aPlugins);
 }
--- a/content/html/document/src/nsHTMLDocument.h
+++ b/content/html/document/src/nsHTMLDocument.h
@@ -99,16 +99,21 @@ public:
   using nsDocument::GetMozFullScreenElement;
 
   // nsIDOMNode interface
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
 
   // nsIDOMHTMLDocument interface
   NS_DECL_NSIDOMHTMLDOCUMENT
 
+  void RouteEvent(nsDOMEvent& aEvent)
+  {
+    RouteEvent(&aEvent);
+  }
+
   /**
    * Returns the result of document.all[aID] which can either be a node
    * or a nodelist depending on if there are multiple nodes with the same
    * id.
    */
   nsISupports *GetDocumentAllResult(const nsAString& aID,
                                     nsWrapperCache **aCache,
                                     nsresult *aResult);
@@ -237,16 +242,19 @@ public:
   // The XPCOM Get/SetBgColor work OK for us, since they never throw.
   nsIHTMLCollection* Anchors();
   nsIHTMLCollection* Applets();
   void Clear() const
   {
     // Deprecated
   }
   already_AddRefed<nsISelection> GetSelection(mozilla::ErrorResult& rv);
+  // The XPCOM CaptureEvents works fine for us.
+  // The XPCOM ReleaseEvents works fine for us.
+  // The XPCOM RouteEvent works fine for us.
   // We're picking up GetLocation from Document
   already_AddRefed<nsIDOMLocation> GetLocation() const {
     return nsIDocument::GetLocation();
   }
 
   virtual nsHTMLDocument* AsHTMLDocument() MOZ_OVERRIDE { return this; }
 
 protected:
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -6227,16 +6227,59 @@ nsGlobalWindow::SetInterval(int32_t *_re
 NS_IMETHODIMP
 nsGlobalWindow::SetResizable(bool aResizable)
 {
   // nop
 
   return NS_OK;
 }
 
+static void
+ReportUseOfDeprecatedMethod(nsGlobalWindow* aWindow, const char* aWarning)
+{
+  nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
+  nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+                                  "DOM Events", doc,
+                                  nsContentUtils::eDOM_PROPERTIES,
+                                  aWarning);
+}
+
+NS_IMETHODIMP
+nsGlobalWindow::CaptureEvents(int32_t aEventFlags)
+{
+  ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsGlobalWindow::ReleaseEvents(int32_t aEventFlags)
+{
+  ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsGlobalWindow::RouteEvent(nsIDOMEvent* aEvt)
+{
+  ReportUseOfDeprecatedMethod(this, "UseOfRouteEventWarning");
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsGlobalWindow::EnableExternalCapture()
+{
+  return NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
+nsGlobalWindow::DisableExternalCapture()
+{
+  return NS_ERROR_FAILURE;
+}
+
 static
 bool IsPopupBlocked(nsIDocument* aDoc)
 {
   nsCOMPtr<nsIPopupWindowManager> pm =
     do_GetService(NS_POPUPWINDOWMANAGER_CONTRACTID);
 
   if (!pm) {
     return false;
--- a/dom/interfaces/base/nsIDOMJSWindow.idl
+++ b/dom/interfaces/base/nsIDOMJSWindow.idl
@@ -1,16 +1,16 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "domstubs.idl"
 
-[scriptable, uuid(f28c92a2-302a-4448-b589-46af599de352)]
+[scriptable, uuid(80adc1fe-c0a0-44f7-8a0e-d3d928e2ecc9)]
 interface nsIDOMJSWindow : nsISupports
 {
   void                      dump(in DOMString str);
 
   /**
    * These methods take typeless arguments and optional arguments, the
    * first argument is either a function or a string, the second
    * argument must be a number (ms) and the rest of the arguments (2
@@ -29,16 +29,26 @@ interface nsIDOMJSWindow : nsISupports
 
   /**
    * This method is here for backwards compatibility with 4.x only,
    * its implementation is a no-op
    */
   void                      setResizable(in boolean resizable);
 
   /**
+   * @deprecated These are old Netscape 4 methods. Do not use,
+   *             the implementation is no-op.
+   */
+  void                      captureEvents(in long eventFlags);
+  void                      releaseEvents(in long eventFlags);
+  void                      routeEvent(in nsIDOMEvent evt);
+  void                      enableExternalCapture();
+  void                      disableExternalCapture();
+
+  /**
    * This is the scriptable version of nsIDOMWindow::open()
    * that takes 3 optional arguments. Its binary name is OpenJS to
    * avoid colliding with nsIDOMWindow::open(), which has the
    * same signature. The reason we can't have that collision is that
    * the implementation needs to know whether it was called from JS or
    * not.
    *
    * IOW, DO NOT CALL THIS FROM C++
--- a/dom/interfaces/html/nsIDOMHTMLDocument.idl
+++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl
@@ -8,17 +8,17 @@
 /**
  * The nsIDOMHTMLDocument interface is the interface to a [X]HTML
  * document object.
  *
  * @see <http://www.whatwg.org/html/>
  */
 interface nsISelection;
 
-[scriptable, uuid(cb0cc619-5862-4e00-86d3-dca3c6ecc34b)]
+[scriptable, uuid(bd920ed4-ddc6-46db-bd4d-d1ddc0692ad4)]
 interface nsIDOMHTMLDocument : nsIDOMDocument
 {
            attribute DOMString            domain;
            attribute DOMString            cookie;
 
   readonly attribute nsIDOMHTMLHeadElement head;
            attribute nsIDOMHTMLElement    body;
 
@@ -83,9 +83,19 @@ interface nsIDOMHTMLDocument : nsIDOMDoc
   readonly attribute nsIDOMHTMLCollection anchors;
   readonly attribute nsIDOMHTMLCollection applets;
 
   void                      clear();
 
 
   // DOM Range
   nsISelection                getSelection();
+
+
+  // Mozilla extensions
+  /**
+   * @deprecated These are old Netscape 4 methods. Do not use,
+   *             the implementation is no-op.
+   */
+  void                      captureEvents(in long eventFlags);
+  void                      releaseEvents(in long eventFlags);
+  void                      routeEvent(in nsIDOMEvent evt);
 };
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -11,16 +11,19 @@ DebugScriptButton=Debug script
 WaitForScriptButton=Continue
 DontAskAgain=&Don't ask me again
 JSURLLoadBlockedWarning=Attempt to load a javascript: URL from one host\nin a window displaying content from another host\nwas blocked by the security manager.
 WindowCloseBlockedWarning=Scripts may not close windows that were not opened by script.
 OnBeforeUnloadTitle=Are you sure?
 OnBeforeUnloadMessage=This page is asking you to confirm that you want to leave - data you have entered may not be saved.
 OnBeforeUnloadStayButton=Stay on Page
 OnBeforeUnloadLeaveButton=Leave Page
+UseOfCaptureEventsWarning=Use of captureEvents() is deprecated. To upgrade your code, use the DOM 2 addEventListener() method. For more help http://developer.mozilla.org/en/docs/DOM:element.addEventListener
+UseOfReleaseEventsWarning=Use of releaseEvents() is deprecated. To upgrade your code, use the DOM 2 removeEventListener() method. For more help http://developer.mozilla.org/en/docs/DOM:element.removeEventListener
+UseOfRouteEventWarning=Use of routeEvent() is deprecated. To upgrade your code, use the DOM 2 dispatchEvent() method. For more help http://developer.mozilla.org/en/docs/DOM:element.dispatchEvent
 UseOfDOM3LoadMethodWarning=Use of Document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest
 UnexpectedCanvasVariantStyle=canvas: an attempt to set strokeStyle or fillStyle to a value that is neither a string, a CanvasGradient, or a CanvasPattern was ignored.
 EmptyGetElementByIdParam=Empty string passed to getElementById().
 LowMemoryTitle=Warning: Low memory
 LowMemoryMessage=A script on this page has been stopped due to a low memory condition.
 SpeculationFailed=An unbalanced tree was written using document.write() causing data from the network to be reparsed. For more information https://developer.mozilla.org/en/Optimizing_Your_Pages_for_Speculative_Parsing
 DocumentWriteIgnored=A call to document.write() from an asynchronously-loaded external script was ignored.
 FormValidationTextTooLong=Please shorten this text to %S characters or less (you are currently using %S characters).
--- a/dom/webidl/HTMLDocument.webidl
+++ b/dom/webidl/HTMLDocument.webidl
@@ -66,9 +66,16 @@ interface HTMLDocument : Document {
   void clear();
 
   [Throws]
   readonly attribute object all;
 
   // https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections
   [Throws]
   Selection getSelection();
+
+  // @deprecated These are old Netscape 4 methods. Do not use,
+  //             the implementation is no-op.
+  // XXXbz do we actually need these anymore?
+  void                      captureEvents(long eventFlags);
+  void                      releaseEvents(long eventFlags);
+  void                      routeEvent(Event evt);
 };
--- a/js/xpconnect/crashtests/806751.html
+++ b/js/xpconnect/crashtests/806751.html
@@ -3,17 +3,17 @@
 <head>
 <script>
 
 function boom()
 {
   var frame = document.getElementById("frame");
   var frameWin = frame.contentWindow;
   var frameWinner = Object.create(frameWin);
-  var v = frameWinner.clearTimeout.bind(frameWinner);
+  var v = frameWinner.captureEvents.bind(frameWinner);
   frame.src = "local-file-not-found";
   setTimeout(function() { setTimeout(finish); v(0); });
 }
 
 function finish() {
   document.documentElement.removeAttribute('class');
 }