Bug 695635: Unprefix websockets. r=sicking, sr=smaug
authorJason Duell <jduell.mcbugs@gmail.com>
Tue, 20 Dec 2011 00:20:12 -0800
changeset 84664 2afd7ae68e8b0ef9e1b56991005f2917a02022c3
parent 84663 384e5cb0ffa6efbb921b15aa6e5ecece975b9572
child 84672 127b20bb15309d3695580f3a5fe6a9faa8191165
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, smaug
bugs695635
milestone11.0a1
first release with
nightly linux32
2afd7ae68e8b / 11.0a1 / 20111220031159 / files
nightly linux64
2afd7ae68e8b / 11.0a1 / 20111220031159 / files
nightly mac
2afd7ae68e8b / 11.0a1 / 20111220031159 / files
nightly win32
2afd7ae68e8b / 11.0a1 / 20111220031159 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 695635: Unprefix websockets. r=sicking, sr=smaug
browser/devtools/webconsole/test/test-bug-603750-websocket.js
content/base/public/Makefile.in
content/base/public/nsIMozWebSocket.idl
content/base/public/nsIWebSocket.idl
content/base/src/nsWebSocket.cpp
content/base/src/nsWebSocket.h
content/base/test/test_websocket.html
content/base/test/test_websocket_basic.html
content/base/test/test_websocket_hello.html
content/base/test/websocket_hybi/test_receive-arraybuffer.html
content/base/test/websocket_hybi/test_receive-blob.html
content/base/test/websocket_hybi/test_send-arraybuffer.html
content/base/test/websocket_hybi/test_send-blob.html
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
js/xpconnect/src/dom_quickstubs.qsconf
--- a/browser/devtools/webconsole/test/test-bug-603750-websocket.js
+++ b/browser/devtools/webconsole/test/test-bug-603750-websocket.js
@@ -1,18 +1,18 @@
 /*
  * Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
 window.addEventListener("load", function () {
-  var ws1 = new MozWebSocket("ws://0.0.0.0:81");
+  var ws1 = new WebSocket("ws://0.0.0.0:81");
   ws1.onopen = function() {
     ws1.send("test 1");
     ws1.close();
   };
 
-  var ws2 = new window.frames[0].MozWebSocket("ws://0.0.0.0:82");
+  var ws2 = new window.frames[0].WebSocket("ws://0.0.0.0:82");
   ws2.onopen = function() {
     ws2.send("test 2");
     ws2.close();
   };
 }, false);
--- a/content/base/public/Makefile.in
+++ b/content/base/public/Makefile.in
@@ -112,14 +112,14 @@ XPIDLSRCS	= \
 		nsIScriptLoaderObserver.idl  \
 		nsIDroppedLinkHandler.idl \
 		nsIImageLoadingContent.idl \
 		nsIObjectLoadingContent.idl \
 		nsIFrameLoader.idl \
 		nsIXMLHttpRequest.idl \
 		nsIContentSecurityPolicy.idl \
 		nsIFrameMessageManager.idl \
-		nsIMozWebSocket.idl \
+		nsIWebSocket.idl \
 		nsIEventSource.idl \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
rename from content/base/public/nsIMozWebSocket.idl
rename to content/base/public/nsIWebSocket.idl
--- a/content/base/public/nsIMozWebSocket.idl
+++ b/content/base/public/nsIWebSocket.idl
@@ -48,24 +48,24 @@ interface nsIVariant;
 
 %{C++
 #include "nsTArray.h"
 class nsString;
 %}
 [ref] native nsStringTArrayRef(nsTArray<nsString>);
 
 /**
- * The nsIMozWebSocket interface enables Web applications to maintain
+ * The nsIWebSocket interface enables Web applications to maintain
  * bidirectional communications with server-side processes as described in:
  *
  * http://dev.w3.org/html5/websockets/
  *
  */
 [scriptable, uuid(f463b9b5-1408-4057-9224-e4f5bc33f17b)]
-interface nsIMozWebSocket : nsISupports
+interface nsIWebSocket : nsISupports
 {
   readonly attribute DOMString url;
   readonly attribute DOMString extensions;
   readonly attribute DOMString protocol;
 
   //ready state
   const unsigned short CONNECTING = 0;
   const unsigned short OPEN = 1;
--- a/content/base/src/nsWebSocket.cpp
+++ b/content/base/src/nsWebSocket.cpp
@@ -163,29 +163,29 @@ nsWebSocket::CloseConnection()
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
   if (mDisconnected)
     return NS_OK;
 
   // Disconnect() can release this object, so we keep a
   // reference until the end of the method
   nsRefPtr<nsWebSocket> kungfuDeathGrip = this;
 
-  if (mReadyState == nsIMozWebSocket::CONNECTING) {
-    SetReadyState(nsIMozWebSocket::CLOSED);
+  if (mReadyState == nsIWebSocket::CONNECTING) {
+    SetReadyState(nsIWebSocket::CLOSED);
     if (mChannel) {
       mChannel->Close(mClientReasonCode, mClientReason);
     }
     Disconnect();
     return NS_OK;
   }
 
-  SetReadyState(nsIMozWebSocket::CLOSING);
+  SetReadyState(nsIWebSocket::CLOSING);
 
   if (mDisconnected) {
-    SetReadyState(nsIMozWebSocket::CLOSED);
+    SetReadyState(nsIWebSocket::CLOSED);
     Disconnect();
     return NS_OK;
   }
 
   return mChannel->Close(mClientReasonCode, mClientReason);
 }
 
 nsresult
@@ -197,17 +197,17 @@ nsWebSocket::ConsoleError()
   nsCAutoString targetSpec;
   rv = mURI->GetSpec(targetSpec);
   if (NS_FAILED(rv)) {
     NS_WARNING("Failed to get targetSpec");
   } else {
     NS_ConvertUTF8toUTF16 specUTF16(targetSpec);
     const PRUnichar *formatStrings[] = { specUTF16.get() };
 
-    if (mReadyState < nsIMozWebSocket::OPEN) {
+    if (mReadyState < nsIWebSocket::OPEN) {
       PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
                           NS_LITERAL_STRING("connectionFailure").get(),
                           formatStrings, ArrayLength(formatStrings));
     } else {
       PrintErrorOnConsole("chrome://global/locale/appstrings.properties",
                           NS_LITERAL_STRING("netInterrupt").get(),
                           formatStrings, ArrayLength(formatStrings));
     }
@@ -262,26 +262,26 @@ nsWebSocket::Disconnect()
 //-----------------------------------------------------------------------------
 
 nsresult
 nsWebSocket::DoOnMessageAvailable(const nsACString & aMsg, bool isBinary)
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
   NS_ABORT_IF_FALSE(!mDisconnected, "Received message after disconnecting");
 
-  if (mReadyState == nsIMozWebSocket::OPEN) {
+  if (mReadyState == nsIWebSocket::OPEN) {
     // Dispatch New Message
     nsresult rv = CreateAndDispatchMessageEvent(aMsg, isBinary);
     if (NS_FAILED(rv)) {
       NS_WARNING("Failed to dispatch the message event");
     }
   } else {
     // CLOSING should be the only other state where it's possible to get msgs
     // from channel: Spec says to drop them.
-    NS_ASSERTION(mReadyState == nsIMozWebSocket::CLOSING,
+    NS_ASSERTION(mReadyState == nsIWebSocket::CLOSING,
                  "Received message while CONNECTING or CLOSED");
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWebSocket::OnMessageAvailable(nsISupports *aContext, const nsACString & aMsg)
@@ -305,43 +305,43 @@ nsWebSocket::OnStart(nsISupports *aConte
 
   if (!mRequestedProtocolList.IsEmpty()) {
     mChannel->GetProtocol(mEstablishedProtocol);
   }
 
   mChannel->GetExtensions(mEstablishedExtensions);
   UpdateURI();
 
-  SetReadyState(nsIMozWebSocket::OPEN);
+  SetReadyState(nsIWebSocket::OPEN);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWebSocket::OnStop(nsISupports *aContext, nsresult aStatusCode)
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
   if (mDisconnected)
     return NS_OK;
 
   mClosedCleanly = NS_SUCCEEDED(aStatusCode);
 
   if (aStatusCode == NS_BASE_STREAM_CLOSED &&
-      mReadyState >= nsIMozWebSocket::CLOSING) {
+      mReadyState >= nsIWebSocket::CLOSING) {
     // don't generate an error event just because of an unclean close
     aStatusCode = NS_OK;
   }
 
   if (NS_FAILED(aStatusCode)) {
     ConsoleError();
     nsresult rv = CreateAndDispatchSimpleEvent(NS_LITERAL_STRING("error"));
     if (NS_FAILED(rv))
       NS_WARNING("Failed to dispatch the error event");
   }
 
-  SetReadyState(nsIMozWebSocket::CLOSED);
+  SetReadyState(nsIWebSocket::CLOSED);
   Disconnect();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsWebSocket::OnAcknowledge(nsISupports *aContext, PRUint32 aSize)
 {
@@ -404,17 +404,17 @@ nsWebSocket::GetInterface(const nsIID &a
 
 nsWebSocket::nsWebSocket() : mKeepingAlive(false),
                              mCheckMustKeepAlive(true),
                              mTriggeredCloseEvent(false),
                              mClosedCleanly(false),
                              mDisconnected(false),
                              mClientReasonCode(0),
                              mServerReasonCode(nsIWebSocketChannel::CLOSE_ABNORMAL),
-                             mReadyState(nsIMozWebSocket::CONNECTING),
+                             mReadyState(nsIWebSocket::CONNECTING),
                              mOutgoingBufferedAmount(0),
                              mBinaryType(WS_BINARY_TYPE_BLOB),
                              mScriptLine(0),
                              mInnerWindowID(0)
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
   nsLayoutStatics::AddRef();
 }
@@ -447,25 +447,25 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_IN
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnMessageListener)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnCloseListener)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPrincipal)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mURI)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mChannel)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
-DOMCI_DATA(MozWebSocket, nsWebSocket)
+DOMCI_DATA(WebSocket, nsWebSocket)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsWebSocket)
-  NS_INTERFACE_MAP_ENTRY(nsIMozWebSocket)
+  NS_INTERFACE_MAP_ENTRY(nsIWebSocket)
   NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
   NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
   NS_INTERFACE_MAP_ENTRY(nsIWebSocketListener)
   NS_INTERFACE_MAP_ENTRY(nsIRequest)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MozWebSocket)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebSocket)
 NS_INTERFACE_MAP_END_INHERITING(nsDOMEventTargetWrapperCache)
 
 NS_IMPL_ADDREF_INHERITED(nsWebSocket, nsDOMEventTargetWrapperCache)
 NS_IMPL_RELEASE_INHERITED(nsWebSocket, nsDOMEventTargetWrapperCache)
 
 //-----------------------------------------------------------------------------
 // nsWebSocket::nsIJSNativeInitializer methods:
 //-----------------------------------------------------------------------------
@@ -845,43 +845,43 @@ nsWebSocket::SetReadyState(PRUint16 aNew
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
   nsresult rv;
 
   if (mReadyState == aNewReadyState) {
     return;
   }
 
-  NS_ABORT_IF_FALSE((aNewReadyState == nsIMozWebSocket::OPEN)    ||
-                    (aNewReadyState == nsIMozWebSocket::CLOSING) ||
-                    (aNewReadyState == nsIMozWebSocket::CLOSED),
+  NS_ABORT_IF_FALSE((aNewReadyState == nsIWebSocket::OPEN)    ||
+                    (aNewReadyState == nsIWebSocket::CLOSING) ||
+                    (aNewReadyState == nsIWebSocket::CLOSED),
                     "unexpected readyState");
 
-  if (aNewReadyState == nsIMozWebSocket::OPEN) {
-    NS_ABORT_IF_FALSE(mReadyState == nsIMozWebSocket::CONNECTING,
+  if (aNewReadyState == nsIWebSocket::OPEN) {
+    NS_ABORT_IF_FALSE(mReadyState == nsIWebSocket::CONNECTING,
                       "unexpected readyState transition");
     mReadyState = aNewReadyState;
 
     rv = CreateAndDispatchSimpleEvent(NS_LITERAL_STRING("open"));
     if (NS_FAILED(rv)) {
       NS_WARNING("Failed to dispatch the open event");
     }
     UpdateMustKeepAlive();
     return;
   }
 
-  if (aNewReadyState == nsIMozWebSocket::CLOSING) {
-    NS_ABORT_IF_FALSE((mReadyState == nsIMozWebSocket::CONNECTING) ||
-                      (mReadyState == nsIMozWebSocket::OPEN),
+  if (aNewReadyState == nsIWebSocket::CLOSING) {
+    NS_ABORT_IF_FALSE((mReadyState == nsIWebSocket::CONNECTING) ||
+                      (mReadyState == nsIWebSocket::OPEN),
                       "unexpected readyState transition");
     mReadyState = aNewReadyState;
     return;
   }
 
-  if (aNewReadyState == nsIMozWebSocket::CLOSED) {
+  if (aNewReadyState == nsIWebSocket::CLOSED) {
     mReadyState = aNewReadyState;
 
     // The close event must be dispatched asynchronously.
     rv = NS_DispatchToMainThread(new nsWSCloseEvent(this, mClosedCleanly,
                                                     mServerReasonCode,
                                                     mServerReason),
                                  NS_DISPATCH_NORMAL);
     if (NS_FAILED(rv)) {
@@ -988,40 +988,40 @@ nsWebSocket::UpdateMustKeepAlive()
     return;
   }
 
   bool shouldKeepAlive = false;
 
   if (mListenerManager) {
     switch (mReadyState)
     {
-      case nsIMozWebSocket::CONNECTING:
+      case nsIWebSocket::CONNECTING:
       {
         if (mListenerManager->HasListenersFor(NS_LITERAL_STRING("open")) ||
             mListenerManager->HasListenersFor(NS_LITERAL_STRING("message")) ||
             mListenerManager->HasListenersFor(NS_LITERAL_STRING("error")) ||
             mListenerManager->HasListenersFor(NS_LITERAL_STRING("close"))) {
           shouldKeepAlive = true;
         }
       }
       break;
 
-      case nsIMozWebSocket::OPEN:
-      case nsIMozWebSocket::CLOSING:
+      case nsIWebSocket::OPEN:
+      case nsIWebSocket::CLOSING:
       {
         if (mListenerManager->HasListenersFor(NS_LITERAL_STRING("message")) ||
             mListenerManager->HasListenersFor(NS_LITERAL_STRING("error")) ||
             mListenerManager->HasListenersFor(NS_LITERAL_STRING("close")) ||
             mOutgoingBufferedAmount != 0) {
           shouldKeepAlive = true;
         }
       }
       break;
 
-      case nsIMozWebSocket::CLOSED:
+      case nsIWebSocket::CLOSED:
       {
         shouldKeepAlive =
           (!mTriggeredCloseEvent &&
            mListenerManager->HasListenersFor(NS_LITERAL_STRING("close")));
       }
     }
   }
 
@@ -1096,17 +1096,17 @@ nsWebSocket::AddEventListener(const nsAS
                                                          optional_argc);
   if (NS_SUCCEEDED(rv)) {
     UpdateMustKeepAlive();
   }
   return rv;
 }
 
 //-----------------------------------------------------------------------------
-// nsWebSocket::nsIMozWebSocket methods:
+// nsWebSocket::nsIWebSocket methods:
 //-----------------------------------------------------------------------------
 
 NS_IMETHODIMP
 nsWebSocket::GetUrl(nsAString& aURL)
 {
   if (mEffectiveURL.IsEmpty()) {
     aURL = mOriginalURL;
   } else {
@@ -1212,36 +1212,36 @@ ContainsUnpairedSurrogates(const nsAStri
   return false;
 }
 
 NS_IMETHODIMP
 nsWebSocket::Send(nsIVariant *aData)
 {
   NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
 
-  if (mReadyState == nsIMozWebSocket::CONNECTING) {
+  if (mReadyState == nsIWebSocket::CONNECTING) {
     return NS_ERROR_DOM_INVALID_STATE_ERR;
   }
 
   nsCString msgString;
   nsCOMPtr<nsIInputStream> msgStream;
   bool isBinary;
   PRUint32 msgLen;
   nsresult rv = GetSendParams(aData, msgString, msgStream, isBinary, msgLen);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Always increment outgoing buffer len, even if closed
   mOutgoingBufferedAmount += msgLen;
 
-  if (mReadyState == nsIMozWebSocket::CLOSING ||
-      mReadyState == nsIMozWebSocket::CLOSED) {
+  if (mReadyState == nsIWebSocket::CLOSING ||
+      mReadyState == nsIWebSocket::CLOSED) {
     return NS_OK;
   }
 
-  NS_ASSERTION(mReadyState == nsIMozWebSocket::OPEN,
+  NS_ASSERTION(mReadyState == nsIWebSocket::OPEN,
                "Unknown state in nsWebSocket::Send");
 
   if (msgStream) {
     rv = mChannel->SendBinaryStream(msgStream, msgLen);
   } else {
     if (isBinary) {
       rv = mChannel->SendBinaryMsg(msgString);
     } else {
@@ -1405,31 +1405,31 @@ nsWebSocket::Close(PRUint16 code, const 
   }
 
   // Format checks for reason and code both passed, they can now be assigned.
   if (argc >= 1)
     mClientReasonCode = code;
   if (argc >= 2)
     mClientReason = utf8Reason;
   
-  if (mReadyState == nsIMozWebSocket::CLOSING ||
-      mReadyState == nsIMozWebSocket::CLOSED) {
+  if (mReadyState == nsIWebSocket::CLOSING ||
+      mReadyState == nsIWebSocket::CLOSED) {
     return NS_OK;
   }
 
-  if (mReadyState == nsIMozWebSocket::CONNECTING) {
+  if (mReadyState == nsIWebSocket::CONNECTING) {
     // FailConnection() can release the object, so we keep a reference
     // before calling it
     nsRefPtr<nsWebSocket> kungfuDeathGrip = this;
 
     FailConnection();
     return NS_OK;
   }
 
-  // mReadyState == nsIMozWebSocket::OPEN
+  // mReadyState == nsIWebSocket::OPEN
   CloseConnection();
 
   return NS_OK;
 }
 
 /**
  * This Init method should only be called by C++ consumers.
  */
--- a/content/base/src/nsWebSocket.h
+++ b/content/base/src/nsWebSocket.h
@@ -36,17 +36,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsWebSocket_h__
 #define nsWebSocket_h__
 
 #include "nsISupportsUtils.h"
-#include "nsIMozWebSocket.h"
+#include "nsIWebSocket.h"
 #include "nsCOMPtr.h"
 #include "nsString.h"
 #include "nsIJSNativeInitializer.h"
 #include "nsIPrincipal.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsIDOMEventListener.h"
 #include "nsDOMEventTargetWrapperCache.h"
 #include "nsAutoPtr.h"
@@ -65,32 +65,32 @@
  {0xbc, 0x1f, 0x41, 0xdd, 0xbe, 0x41, 0xf4, 0x6c} }
 
 #define NS_WEBSOCKET_CONTRACTID "@mozilla.org/websocket;1"
 
 class nsWSCloseEvent;
 class nsAutoCloseWS;
 
 class nsWebSocket: public nsDOMEventTargetWrapperCache,
-                   public nsIMozWebSocket,
+                   public nsIWebSocket,
                    public nsIJSNativeInitializer,
                    public nsIInterfaceRequestor,
                    public nsIWebSocketListener,
                    public nsIRequest
 {
 friend class nsWSCloseEvent;
 friend class nsAutoCloseWS;
 
 public:
   nsWebSocket();
   virtual ~nsWebSocket();
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsWebSocket,
                                            nsDOMEventTargetWrapperCache)
-  NS_DECL_NSIMOZWEBSOCKET
+  NS_DECL_NSIWEBSOCKET
   NS_DECL_NSIINTERFACEREQUESTOR
   NS_DECL_NSIWEBSOCKETLISTENER
   NS_DECL_NSIREQUEST
 
   // nsIJSNativeInitializer
   NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
                         JSObject* aObject, PRUint32 aArgc, jsval* aArgv);
 
--- a/content/base/test/test_websocket.html
+++ b/content/base/test/test_websocket.html
@@ -38,18 +38,17 @@
  * 16. client calls close() and tries to send a message;
  * 17. see bug 572975 - all event listeners set
  * 18. client tries to connect to an http resource;
  * 19. server closes the tcp connection before establishing the ws connection;
  * 20. see bug 572975 - only on error and onclose event listeners set
  * 21. see bug 572975 - same as test 17, but delete strong event listeners when
  *     receiving the message event;
  * 22. server takes too long to establish the ws connection;
- * 23. see bug 664692 - feature detection should detect MozWebSocket but not
- *     WebSocket on window object;
+ * 23. should detect WebSocket on window object;
  * 24. server rejects sub-protocol string
  * 25. ctor with valid empty sub-protocol array
  * 26. ctor with invalid sub-protocol array containing 1 empty element
  * 27. ctor with invalid sub-protocol array containing an empty element in list
  * 28. ctor using valid 1 element sub-protocol array
  * 29. ctor using all valid 5 element sub-protocol array
  * 30. ctor using valid 1 element sub-protocol array with element server will
  *     reject
@@ -122,19 +121,19 @@ function ignoreError(e)
 }
 
 function CreateTestWS(ws_location, ws_protocol, no_increment_test)
 {
   var ws;
 
   try {
     if (ws_protocol == undefined) {
-      ws = new MozWebSocket(ws_location);
+      ws = new WebSocket(ws_location);
     } else {
-      ws = new MozWebSocket(ws_location, ws_protocol);
+      ws = new WebSocket(ws_location, ws_protocol);
     }
 
 
     ws._testNumber = current_test;
     ws._receivedCloseEvent = false;
     ok(true, "Created websocket for test " + ws._testNumber +"\n");
 
     ws.onerror = function(e)
@@ -561,17 +560,17 @@ function test16()
 var status_test17 = "not started";
 
 var waitTest17 = false;
 
 window._test17 = function()
 {
   waitTest17 = true;
 
-  var local_ws = new MozWebSocket("ws://sub1.test2.example.org/tests/content/base/test/file_websocket", "test-17");
+  var local_ws = new WebSocket("ws://sub1.test2.example.org/tests/content/base/test/file_websocket", "test-17");
   local_ws._testNumber = "local17";
   local_ws._testNumber = current_test++;
 
   status_test17 = "started";
 
   local_ws.onopen = function(e)
   {
     status_test17 = "opened";
@@ -644,17 +643,17 @@ function test19()
 }
 
 var waitTest20 = false;
 
 window._test20 = function()
 {
   waitTest20 = true;
 
-  var local_ws = new MozWebSocket("ws://sub1.test1.example.org/tests/content/base/test/file_websocket", "test-20");
+  var local_ws = new WebSocket("ws://sub1.test1.example.org/tests/content/base/test/file_websocket", "test-20");
   local_ws._testNumber = "local20";
   local_ws._testNumber = current_test++;
 
   local_ws.onerror = function()
   {
     ok(false, "onerror called on test " + e.target._testNumber + "!");
   };
 
@@ -679,17 +678,17 @@ function test20()
 }
 
 var waitTest21 = false;
 
 window._test21 = function()
 {
   waitTest21 = true;
 
-  var local_ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test-21");
+  var local_ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test-21");
   local_ws._testNumber = current_test++;
   var received_message = false;
 
   local_ws.onopen = function(e)
   {
     e.target.send("client data");
     forcegc();
     e.target.onopen = null;
@@ -754,18 +753,17 @@ function test22()
 
   SpecialPowers.setIntPref(pref_open, oldpref_open_value);
   doTest(23);
 }
 
 function test23()
 {
   current_test++;
-  is(false, "WebSocket" in window, "WebSocket shouldn't be available on window object");
-  is(true, "MozWebSocket" in window, "MozWebSocket should be available on window object");
+  is(true, "WebSocket" in window, "WebSocket should be available on window object");
   doTest(24);
 }
 
 function test24()
 {
   var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test-does-not-exist");
   ws.onopen = shouldNotOpen;
   ws.onclose = function(e)
--- a/content/base/test/test_websocket_basic.html
+++ b/content/base/test/test_websocket_basic.html
@@ -26,17 +26,17 @@ function forcegc(){
 }
 
 function finishWSTest() {
     SimpleTest.finish();
 }
 
 function testWebSocket () {
   var url = "ws://mochi.test:8888/tests/content/base/test/file_websocket_basic";
-  ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
+  ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
   is(ws.url, url, "Wrong Websocket.url!");
   ws.onopen = function(e) {
     for (var i = 0; i < params.length; ++i) {
       document.getElementById('log').textContent += "sending " + params[i] + "\n";
       ws.send(params[i]);
     }
   }
   ws.onclose = function(e) {
@@ -51,17 +51,17 @@ function testWebSocket () {
   ws.onmessage = function(e) {
     document.getElementById('log').textContent += "\n" + e.data;
     is(e.data, results[0], "Unexpected message");
     results.shift();
   }
 }
 
 function testWebSocket2() {
-  ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
+  ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
   var testCount = 1000; // Send lots of messages
   var messageCount = 0;
   var testMessage = "test message";
   ws.onopen = function(e) {
     for (var i = 0; i < testCount; ++i) {
       ws.send(testMessage + (i + 1));
     }
     ws.send("end");
@@ -81,17 +81,17 @@ function testWebSocket2() {
     document.getElementById('log').textContent = messageCount;
     if (messageCount == testCount) {
       this.onmessage = null;
     }
   }
 }
 
 function testWebSocket3() {
-  ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
+  ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
   var testCount = 100; // Send lots of messages
   var messageCount = 0;
   var testMessage = "test message";
   ws.onopen = function(e) {
     for (var i = 0; i < testCount; ++i) {
       forcegc(); // Do something evil, call cycle collector a lot.
       ws.send(testMessage + (i + 1));
     }
@@ -113,17 +113,17 @@ function testWebSocket3() {
     document.getElementById('log').textContent = messageCount;
     if (messageCount == testCount) {
       this.onmessage = null;
     }
   }
 }
 
 function testWebSocket4() {
-  ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
+  ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
   // String length = (10,000 - 1) * 23 = 229,977 = almost 225 KiB.
   var longString = new Array(10000).join("-huge websocket message");
   ws.onopen = function(e) {
     is(this, ws, "'this' should point to the WebSocket. (1)");
     ws.send(longString);
   }
   ws.onclose = function(e) {
     is(this, ws, "'this' should point to the WebSocket. (2)");
@@ -140,17 +140,17 @@ function testWebSocket4() {
     is(e.data.length, longString.length, "Length of received message");
     ok(e.data == longString, "Content of received message");
     document.getElementById('log').textContent += "\nReceived the huge message";
     this.close();
   }
 }
 
 function testWebSocket5() {
-  ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
+  ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_basic", "test");
   ws.onopen = function(e) {
     this.close();
   }
   ws.onclose = function(e) {
     ok(e.wasClean, "Connection closed cleanly");
     is(this.bufferedAmount, 0, "Shouldn't have anything buffered");
     var msg = "some data";
     this.send(msg);
--- a/content/base/test/test_websocket_hello.html
+++ b/content/base/test/test_websocket_hello.html
@@ -13,17 +13,17 @@
 <div id="content" style="display: none">
 </div>
 <pre id="test">
 <script class="testbody" type="text/javascript">
 
 var ws;
 
 function testWebSocket () {
-  ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_hello");
+  ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket_hello");
   ws.onopen = function(e) {
     ws.send("data");
   }
   ws.onclose = function(e) {
   }
   ws.onerror = function(e) {
     ok(false, "onerror called!");
     SimpleTest.finish();
--- a/content/base/test/websocket_hybi/test_receive-arraybuffer.html
+++ b/content/base/test/websocket_hybi/test_receive-arraybuffer.html
@@ -34,17 +34,17 @@ function createEmptyArrayBuffer()
 function createArrayBufferContainingAllDistinctBytes()
 {
     var array = new Uint8Array(256);
     for (var i = 0; i < 256; ++i)
         array[i] = i;
     return array.buffer;
 }
 
-var ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_binary-frames");
+var ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_binary-frames");
 ws.binaryType = "arraybuffer";
 is(ws.binaryType, "arraybuffer", "should be equal to 'arraybuffer'");
 
 var closeEvent;
 var receivedMessages = [];
 var expectedValues = [createArrayBufferContainingHelloWorld(), createEmptyArrayBuffer(), createArrayBufferContainingAllDistinctBytes()];
 
 ws.onmessage = function(event)
--- a/content/base/test/websocket_hybi/test_receive-blob.html
+++ b/content/base/test/websocket_hybi/test_receive-blob.html
@@ -34,17 +34,17 @@ function createEmptyArrayBuffer()
 function createArrayBufferContainingAllDistinctBytes()
 {
     var array = new Uint8Array(256);
     for (var i = 0; i < 256; ++i)
         array[i] = i;
     return array.buffer;
 }
 
-var ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_binary-frames");
+var ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_binary-frames");
 is(ws.binaryType, "blob", "should be 'blob'");
 
 var closeEvent;
 var receivedMessages = [];
 var expectedValues = [createArrayBufferContainingHelloWorld(), createEmptyArrayBuffer(), createArrayBufferContainingAllDistinctBytes()];
 
 ws.onmessage = function(event)
 {
--- a/content/base/test/websocket_hybi/test_send-arraybuffer.html
+++ b/content/base/test/websocket_hybi/test_send-arraybuffer.html
@@ -39,17 +39,17 @@ function createEmptyArrayBuffer()
 function createArrayBufferContainingAllDistinctBytes()
 {
     var array = new Uint8Array(256);
     for (var i = 0; i < 256; ++i)
         array[i] = i;
     return array.buffer;
 }
 
-var ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_check-binary-messages");
+var ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_check-binary-messages");
 var closeEvent;
 
 ws.onopen = function()
 {
     ok(true, "onopen reached");
     ws.send(createArrayBufferContainingHelloWorld());
     ws.send(createEmptyArrayBuffer());
     ws.send(createArrayBufferContainingAllDistinctBytes());
--- a/content/base/test/websocket_hybi/test_send-blob.html
+++ b/content/base/test/websocket_hybi/test_send-blob.html
@@ -63,17 +63,17 @@ function createBlobContainingAllDistinct
     var array = new Array();
     for (var i = 0; i < 256; ++i)
         array[i] = i;
     // Concatenates chars into a single binary string 
     binaryString = String.fromCharCode.apply(null, array);
     return createDOMFile("allchars", binaryString);
 }
 
-var ws = new MozWebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_check-binary-messages");
+var ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/websocket_hybi/file_check-binary-messages");
 var closeEvent;
 
 ws.onopen = function()
 {
     ws.send(createBlobContainingHelloWorld());
     ws.send(createEmptyBlob());
     ws.send(createBlobContainingAllDistinctBytes());
 };
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1498,17 +1498,17 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(FormData, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(DesktopNotification, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(DesktopNotificationCenter, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
-  NS_DEFINE_CLASSINFO_DATA(MozWebSocket, nsEventTargetSH,
+  NS_DEFINE_CLASSINFO_DATA(WebSocket, nsEventTargetSH,
                            EVENTTARGET_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(CloseEvent, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(IDBFactory, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(IDBRequest, nsDOMGenericSH,
@@ -1564,17 +1564,17 @@ struct nsContractIDMapData
 
 static const nsContractIDMapData kConstructorMap[] =
 {
   NS_DEFINE_CONSTRUCTOR_DATA(DOMParser, NS_DOMPARSER_CONTRACTID)
   NS_DEFINE_CONSTRUCTOR_DATA(FileReader, NS_FILEREADER_CONTRACTID)
   NS_DEFINE_CONSTRUCTOR_DATA(FormData, NS_FORMDATA_CONTRACTID)
   NS_DEFINE_CONSTRUCTOR_DATA(XMLSerializer, NS_XMLSERIALIZER_CONTRACTID)
   NS_DEFINE_CONSTRUCTOR_DATA(XMLHttpRequest, NS_XMLHTTPREQUEST_CONTRACTID)
-  NS_DEFINE_CONSTRUCTOR_DATA(MozWebSocket, NS_WEBSOCKET_CONTRACTID)
+  NS_DEFINE_CONSTRUCTOR_DATA(WebSocket, NS_WEBSOCKET_CONTRACTID)
   NS_DEFINE_CONSTRUCTOR_DATA(XPathEvaluator, NS_XPATH_EVALUATOR_CONTRACTID)
   NS_DEFINE_CONSTRUCTOR_DATA(XSLTProcessor,
                              "@mozilla.org/document-transformer;1?type=xslt")
   NS_DEFINE_CONSTRUCTOR_DATA(EventSource, NS_EVENTSOURCE_CONTRACTID)
 };
 
 #define NS_DEFINE_EVENT_CTOR(_class)                        \
   nsresult                                                  \
@@ -4109,18 +4109,18 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(DesktopNotification, nsIDOMDesktopNotification)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMDesktopNotification)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(DesktopNotificationCenter, nsIDOMDesktopNotificationCenter)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMDesktopNotificationCenter)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(MozWebSocket, nsIMozWebSocket)
-    DOM_CLASSINFO_MAP_ENTRY(nsIMozWebSocket)
+  DOM_CLASSINFO_MAP_BEGIN(WebSocket, nsIWebSocket)
+    DOM_CLASSINFO_MAP_ENTRY(nsIWebSocket)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(CloseEvent, nsIDOMCloseEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMCloseEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
@@ -6269,17 +6269,17 @@ nsWindowSH::GlobalResolve(nsGlobalWindow
       name_struct->mType == nsGlobalNameStruct::eTypeExternalClassInfo) {
     // Don't expose chrome only constructors to content windows.
     if (name_struct->mChromeOnly &&
         !nsContentUtils::IsSystemPrincipal(aWin->GetPrincipal())) {
       return NS_OK;
     }
 
     // For now don't expose web sockets unless user has explicitly enabled them
-    if (name_struct->mDOMClassInfoID == eDOMClassInfo_MozWebSocket_id) {
+    if (name_struct->mDOMClassInfoID == eDOMClassInfo_WebSocket_id) {
       if (!nsWebSocket::PrefEnabled()) {
         return NS_OK;
       }
     }
 
     // For now don't expose server events unless user has explicitly enabled them
     if (name_struct->mDOMClassInfoID == eDOMClassInfo_EventSource_id) {
       if (!nsEventSource::PrefEnabled()) {
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -495,17 +495,17 @@ DOMCI_CLASS(AnimationEvent)
 DOMCI_CLASS(ContentFrameMessageManager)
 
 DOMCI_CLASS(FormData)
 
 DOMCI_CLASS(DesktopNotification)
 DOMCI_CLASS(DesktopNotificationCenter)
 
 // WebSocket
-DOMCI_CLASS(MozWebSocket)
+DOMCI_CLASS(WebSocket)
 DOMCI_CLASS(CloseEvent)
 
 DOMCI_CLASS(IDBFactory)
 DOMCI_CLASS(IDBRequest)
 DOMCI_CLASS(IDBDatabase)
 DOMCI_CLASS(IDBObjectStore)
 DOMCI_CLASS(IDBTransaction)
 DOMCI_CLASS(IDBCursor)
--- a/js/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/xpconnect/src/dom_quickstubs.qsconf
@@ -435,17 +435,17 @@ members = [
     '-nsIXMLHttpRequest.getResponseHeader',
     '-nsIXMLHttpRequest.setRequestHeader',
     '-nsIXMLHttpRequest.overrideMimeType',
     # nsIXMLHttpRequestUpload doesn't live in its own IDL file, so
     # can't be quickstubbed
     '-nsIXMLHttpRequest.upload',
 
     # WebSocket
-    'nsIMozWebSocket.*',
+    'nsIWebSocket.*',
 
     # webgl
     'nsIDOMWebGLRenderingContext.*',
     # getContextAttributes is directly manipulating its return value
     '-nsIDOMWebGLRenderingContext.getContextAttributes',
 
     # Audio
     'nsIDOMNotifyAudioAvailableEvent.frameBuffer',