Skip to content
Browse files

Flag nsIDNSService.resolve (bug 772264)

  • Loading branch information...
1 parent 4762dd3 commit a2d8ab7ac2ada87975db51f5b26bff6bad2b6d0a @mattbasta committed
View
14 tests/test_js_xpcom.py
@@ -268,6 +268,20 @@ def test_nsisound_play():
""").failed()
+def test_nsidnsservice_resolve():
+ """Test that nsIDNSService.resolve is flagged."""
+
+ assert not _do_test_raw("""
+ var foo = Cc["foo"].getService(Components.interfaces.nsIDNSService);
+ foo.asyncResolve("asdf");
+ """).failed()
+
+ assert _do_test_raw("""
+ var foo = Cc["foo"].getService(Components.interfaces.nsIDNSService);
+ foo.resolve("asdf");
+ """).failed()
+
+
class TestnsIWindowWatcher(TestCase):
def _run_against_foo(self, script):
View
16 validator/testcases/javascript/entity_values.py
@@ -120,6 +120,22 @@ def xmlStandalone(traverser):
tier=5)
+@register_entity("nsIDNSService.resolve")
+def nsIDNSServiceResolve(traverser):
+ traverser.err.warning(
+ err_id=("testcases_javascript_entity_values",
+ "nsIDNSServiceResolve"),
+ warning="`nsIDNSService.resolve()` should not be used.",
+ description="The `nsIDNSService.resolve` method performs a "
+ "synchronous DNS lookup, which will freeze the UI. This "
+ "can result in severe performance issues. "
+ "`nsIDNSService.asyncResolve()` should be used instead.",
+ filename=traverser.filename,
+ line=traverser.line,
+ column=traverser.position,
+ context=traverser.context)
+
+
@register_entity("nsIDOMNSHTMLElement")
def nsIDOMNSHTMLElement(traverser):
traverser.err.error(
View
1 validator/testcases/javascript/predefinedentities.py
@@ -102,6 +102,7 @@
"clean up any component registrations at shutdown."}}},
u"nsIDOMNSHTMLElement": entity("nsIDOMNSHTMLElement"),
u"nsIDOMNSHTMLFrameElement": entity("nsIDOMNSHTMLFrameElement"),
+ u"nsIDNSService": {"value": {u"resolve": entity("nsIDNSService.resolve")}},
u"nsIImapIncomingServer":
{"value":
{u"GetImapConnectionAndLoadUrl":

0 comments on commit a2d8ab7

Please sign in to comment.
Something went wrong with that request. Please try again.