Bug 1017762 - Remove the language argument to EventListenerManager::SetEventHandler; r=smaug
authorMs2ger <ms2ger@gmail.com>
Fri, 06 Jun 2014 10:06:26 +0200
changeset 207366 a84bd62d0b55923920e97285f7fa7b20f99e368a
parent 207365 5c269811a53e21686b158e6bda35c56c1b75685f
child 207367 9d393ad3c53933e2917241a9d9bdb2b7cf467625
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1017762
milestone32.0a1
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
Bug 1017762 - Remove the language argument to EventListenerManager::SetEventHandler; r=smaug
content/base/src/Element.cpp
dom/events/EventListenerManager.cpp
dom/events/EventListenerManager.h
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -1770,17 +1770,16 @@ Element::SetEventHandler(nsIAtom* aEvent
   EventListenerManager* manager =
     GetEventListenerManagerForAttr(aEventName, &defer);
   if (!manager) {
     return NS_OK;
   }
 
   defer = defer && aDefer; // only defer if everyone agrees...
   manager->SetEventHandler(aEventName, aValue,
-                           nsIProgrammingLanguage::JAVASCRIPT,
                            defer, !nsContentUtils::IsChromeDoc(ownerDoc),
                            this);
   return NS_OK;
 }
 
 
 //----------------------------------------------------------------------
 
--- a/dom/events/EventListenerManager.cpp
+++ b/dom/events/EventListenerManager.cpp
@@ -636,35 +636,20 @@ EventListenerManager::SetEventHandlerInt
   }
 
   return listener;
 }
 
 nsresult
 EventListenerManager::SetEventHandler(nsIAtom* aName,
                                       const nsAString& aBody,
-                                      uint32_t aLanguage,
                                       bool aDeferCompilation,
                                       bool aPermitUntrustedEvents,
                                       Element* aElement)
 {
-  NS_PRECONDITION(aLanguage != nsIProgrammingLanguage::UNKNOWN,
-                  "Must know the language for the script event listener");
-
-  // |aPermitUntrustedEvents| is set to False for chrome - events
-  // *generated* from an unknown source are not allowed.
-  // However, for script languages with no 'sandbox', we want to reject
-  // such scripts based on the source of their code, not just the source
-  // of the event.
-  if (aPermitUntrustedEvents && 
-      aLanguage != nsIProgrammingLanguage::JAVASCRIPT) {
-    NS_WARNING("Discarding non-JS event listener from untrusted source");
-    return NS_ERROR_FAILURE;
-  }
-
   nsCOMPtr<nsIDocument> doc;
   nsCOMPtr<nsIScriptGlobalObject> global =
     GetScriptGlobalAndDocument(getter_AddRefs(doc));
 
   if (!global) {
     // This can happen; for example this document might have been
     // loaded as data.
     return NS_OK;
--- a/dom/events/EventListenerManager.h
+++ b/dom/events/EventListenerManager.h
@@ -287,17 +287,16 @@ public:
    * mTarget later and compile lazily.
    *
    * aElement, if not null, is the element the string is associated with.
    */
   // XXXbz does that play correctly with nodes being adopted across
   // documents?  Need to double-check the spec here.
   nsresult SetEventHandler(nsIAtom *aName,
                            const nsAString& aFunc,
-                           uint32_t aLanguage,
                            bool aDeferCompilation,
                            bool aPermitUntrustedEvents,
                            dom::Element* aElement);
   /**
    * Remove the current "inline" event listener for aName.
    */
   void RemoveEventHandler(nsIAtom *aName, const nsAString& aTypeString);