Permalink
Browse files

Flag nsISound.play (bug 683176)

  • Loading branch information...
1 parent e48fbb5 commit a30a07b10185bdbfb33639c81b271ce847c20d14 @mattbasta committed Jan 14, 2013
View
@@ -254,6 +254,20 @@ def test_xpcom_nsibrowsersearchservice():
""").failed()
+def test_nsisound_play():
+ """Test that nsISound.play is flagged."""
+
+ assert not _do_test_raw("""
+ var foo = Cc["foo"].getService(Components.interfaces.nsISound);
+ foo.bar("asdf");
+ """).failed()
+
+ assert _do_test_raw("""
+ var foo = Cc["foo"].getService(Components.interfaces.nsISound);
+ foo.play("asdf");
+ """).failed()
+
+
class TestnsIWindowWatcher(TestCase):
def _run_against_foo(self, script):
@@ -302,5 +316,3 @@ def test_uri(self, uri):
"data:asdf"]
for uri in uris:
yield test_uri, self, uri
-
-
@@ -156,6 +156,21 @@ def nsIDOMNSHTMLFrameElement(traverser):
tier=5)
+@register_entity("nsISound.play")
+def nsISoundPlay(traverser):
+ traverser.err.warning(
+ err_id=("testcases_javascript_entity_values",
+ "nsISound_play"),
+ warning="`nsISound.play` should not be used.",
+ description="The `nsISound.play` function is synchronous, and thus "
+ "freezes the interface while the sound is playing. It "
+ "be avoided in favor of the HTML5 audio APIs.",
+ filename=traverser.filename,
+ line=traverser.line,
+ column=traverser.position,
+ context=traverser.context)
+
+
@register_entity("nsIBrowserHistory.lastPageVisited")
def nsIBrowserHistory(traverser):
traverser.err.error(
@@ -259,6 +259,7 @@
entity("nsIRssIncomingServer.subscriptionsDataSourcePath"),
u"feedItemsDataSourcePath":
entity("nsIRssIncomingServer.feedItemsDataSourcePath")}},
+ u"nsISound": {"value": {"play": entity("nsISound.play")}},
u"nsIStringBundleService":
{"value":
{u"createStringBundle":

0 comments on commit a30a07b

Please sign in to comment.