Bug 797297 - Remove hasAttribute check from outer loop of BrowserElementChild::_contextMenuHandler. r=jlebar
authorDale Harvey <dale@arandomurl.com>
Sat, 13 Oct 2012 20:27:00 -0400
changeset 110237 574ec568513b51210d5f0e97643405f1b06a979a
parent 110236 78022080a795fbe19558b35474dc24a3b04b71a7
child 110238 1949f7d5c6ed2b6c04cffc03f3309967f491d3f1
push id23680
push useremorley@mozilla.com
push dateTue, 16 Oct 2012 08:09:24 +0000
treeherdermozilla-central@8f145599e4bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs797297
milestone19.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 797297 - Remove hasAttribute check from outer loop of BrowserElementChild::_contextMenuHandler. r=jlebar
dom/browser-element/BrowserElementChild.js
dom/browser-element/mochitest/browserElement_ContextmenuEvents.js
--- a/dom/browser-element/BrowserElementChild.js
+++ b/dom/browser-element/BrowserElementChild.js
@@ -396,26 +396,26 @@ BrowserElementChild.prototype = {
 
     this._ctxCounter++;
     this._ctxHandlers = {};
 
     var elem = e.target;
     var menuData = {systemTargets: [], contextmenu: null};
     var ctxMenuId = null;
 
-    while (elem && elem.hasAttribute) {
+    while (elem && elem.parentNode) {
       var ctxData = this._getSystemCtxMenuData(elem);
       if (ctxData) {
         menuData.systemTargets.push({
           nodeName: elem.nodeName,
           data: ctxData
         });
       }
 
-      if (!ctxMenuId && elem.hasAttribute('contextmenu')) {
+      if (!ctxMenuId && 'hasAttribute' in elem && elem.hasAttribute('contextmenu')) {
         ctxMenuId = elem.getAttribute('contextmenu');
       }
       elem = elem.parentNode;
     }
 
     if (ctxMenuId) {
       var menu = e.target.ownerDocument.getElementById(ctxMenuId);
       if (menu) {
--- a/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js
+++ b/dom/browser-element/mochitest/browserElement_ContextmenuEvents.js
@@ -15,17 +15,17 @@ var iframeScript = function() {
   };
 
   XPCNativeWrapper.unwrap(content).onerror = function(e) {
     sendAsyncMessage('test:errorTriggered', {data: e});
   };
 
   content.fireContextMenu(content.document.body);
   content.fireContextMenu(content.document.getElementById('menu1-trigger'));
-  content.fireContextMenu(content.document.getElementById('inner-link'));
+  content.fireContextMenu(content.document.getElementById('inner-link').childNodes[0]);
   content.fireContextMenu(content.document.getElementById('menu2-trigger'));
 }
 
 var trigger1 = function() {
   content.fireContextMenu(content.document.getElementById('menu1-trigger'));
 };
 
 function runTest() {