Partially backed out changeset 2aa62db58f24 (bug 673919) due to Web compat. a=bajaj
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Thu, 01 Aug 2013 06:44:51 +0900
changeset 148207 4ea223de889cdefaa30c692d858ddee701ce949e
parent 148206 9b4384d3b3e9f02d9617c276db7a21588ca792ac
child 148208 fe11c9394b1446d526619d1ecd9d177a75382de4
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbajaj
bugs673919
milestone24.0a2
Partially backed out changeset 2aa62db58f24 (bug 673919) due to Web compat. a=bajaj
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/webidl/HTMLDocument.webidl
js/xpconnect/crashtests/806751.html
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -2235,16 +2235,34 @@ nsHTMLDocument::GetSelection(ErrorResult
     return nullptr;
   }
 
   nsCOMPtr<nsISelection> sel;
   rv = window->GetSelection(getter_AddRefs(sel));
   return sel.forget();
 }
 
+NS_IMETHODIMP
+nsHTMLDocument::CaptureEvents(int32_t aEventFlags)
+{
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLDocument::ReleaseEvents(int32_t aEventFlags)
+{
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt)
+{
+  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
@@ -6176,16 +6176,46 @@ nsGlobalWindow::SetInterval(int32_t *_re
 NS_IMETHODIMP
 nsGlobalWindow::SetResizable(bool aResizable)
 {
   // nop
 
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsGlobalWindow::CaptureEvents(int32_t aEventFlags)
+{
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsGlobalWindow::ReleaseEvents(int32_t aEventFlags)
+{
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsGlobalWindow::RouteEvent(nsIDOMEvent* aEvt)
+{
+  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(35b653f4-e679-4843-8391-89cb2f5a9ba4)]
+[scriptable, uuid(6652c4d2-6b49-424b-aaf9-91f91006fab7)]
 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(60e0e311-b9c7-4952-8e9c-d4974005e887)]
+[scriptable, uuid(fd76e045-8d97-4a97-ad75-eac5ae2f3ea4)]
 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/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');
 }