From 97e3e518cd01bdd57ab69637a3565617bc815832 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 28 Oct 2015 07:43:00 +0100 Subject: [PATCH] Bug 1216260 - Replace mozMatchesSelector with matches in add-on SDK. r=matteo --- .../source/lib/sdk/content/context-menu.js | 2 +- .../e10s-content/lib/test-content-script.js | 18 +++++++++--------- addon-sdk/source/test/test-content-script.js | 18 +++++++++--------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/addon-sdk/source/lib/sdk/content/context-menu.js b/addon-sdk/source/lib/sdk/content/context-menu.js index 449563873102..0e01230f6209 100644 --- a/addon-sdk/source/lib/sdk/content/context-menu.js +++ b/addon-sdk/source/lib/sdk/content/context-menu.js @@ -183,7 +183,7 @@ CONTEXTS.SelectorContext = Class({ let selector = this.selector; while (!(popupNode instanceof Ci.nsIDOMDocument)) { - if (popupNode.mozMatchesSelector(selector)) + if (popupNode.matches(selector)) return popupNode; popupNode = popupNode.parentNode; diff --git a/addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js b/addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js index 25db7d8940d5..77d1bf8c8c95 100644 --- a/addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js +++ b/addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js @@ -294,21 +294,21 @@ exports.testStringOverload = createProxyTest(html, function (helper, assert) { ); }); -exports["test MozMatchedSelector"] = createProxyTest("", function (helper) { +exports["test Element.matches()"] = createProxyTest("", function (helper) { helper.createWorker( 'new ' + function ContentScriptScope() { - // Check mozMatchesSelector XrayWrappers bug: - // mozMatchesSelector returns bad results when we are not calling it from the node itself - // SEE BUG 658909: mozMatchesSelector returns incorrect results with XrayWrappers - assert(document.createElement( "div" ).mozMatchesSelector("div"), - "mozMatchesSelector works while being called from the node"); - assert(document.documentElement.mozMatchesSelector.call( + // Check matches XrayWrappers bug (Bug 658909): + // Test that Element.matches() does not return bad results when we are + // not calling it from the node itself. + assert(document.createElement( "div" ).matches("div"), + "matches works while being called from the node"); + assert(document.documentElement.matches.call( document.createElement( "div" ), "div" ), - "mozMatchesSelector works while being called from a " + + "matches works while being called from a " + "function reference to " + - "document.documentElement.mozMatchesSelector.call"); + "document.documentElement.matches.call"); done(); } ); diff --git a/addon-sdk/source/test/test-content-script.js b/addon-sdk/source/test/test-content-script.js index f9564806d43b..1cd6ad78e0aa 100644 --- a/addon-sdk/source/test/test-content-script.js +++ b/addon-sdk/source/test/test-content-script.js @@ -294,21 +294,21 @@ exports.testStringOverload = createProxyTest(html, function (helper, assert) { ); }); -exports["test MozMatchedSelector"] = createProxyTest("", function (helper) { +exports["test Element.matches()"] = createProxyTest("", function (helper) { helper.createWorker( 'new ' + function ContentScriptScope() { - // Check mozMatchesSelector XrayWrappers bug: - // mozMatchesSelector returns bad results when we are not calling it from the node itself - // SEE BUG 658909: mozMatchesSelector returns incorrect results with XrayWrappers - assert(document.createElement( "div" ).mozMatchesSelector("div"), - "mozMatchesSelector works while being called from the node"); - assert(document.documentElement.mozMatchesSelector.call( + // Check matches XrayWrappers bug (Bug 658909): + // Test that Element.matches() does not return bad results when we are + // not calling it from the node itself. + assert(document.createElement( "div" ).matches("div"), + "matches works while being called from the node"); + assert(document.documentElement.matches.call( document.createElement( "div" ), "div" ), - "mozMatchesSelector works while being called from a " + + "matches works while being called from a " + "function reference to " + - "document.documentElement.mozMatchesSelector.call"); + "document.documentElement.matches.call"); done(); } );