Backed out changesets 6be352955252 and 1bc459138617 (bug 770840) for Android nightly bustage (bug 870782).
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 10 May 2013 12:38:26 -0400
changeset 142427 2673016e7df4dc1fbad0b6ec93d8bdee917a888b
parent 142426 08be63954b6bce6e8aaa505352e11c4541d365c1
child 142463 1d7c615b4b6220629b8a3ca923e3952787dcc2d3
child 142464 9d7444c9f21b04684e0d73aa52ac9dca73a5fddb
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs770840, 870782
milestone23.0a1
backs out6be352955252d672cd4cadb6afd53eac616a8441
1bc459138617b42345ff7d27e01aa05776582993
first release with
nightly linux32
2673016e7df4 / 23.0a1 / 20130510094137 / files
nightly linux64
2673016e7df4 / 23.0a1 / 20130510094137 / files
nightly mac
2673016e7df4 / 23.0a1 / 20130510094137 / files
nightly win32
2673016e7df4 / 23.0a1 / 20130510094137 / files
nightly win64
2673016e7df4 / 23.0a1 / 20130510094137 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changesets 6be352955252 and 1bc459138617 (bug 770840) for Android nightly bustage (bug 870782). CLOSED TREE
js/xpconnect/src/XPCWrappedJS.cpp
js/xpconnect/tests/unit/test_bug608142.js
js/xpconnect/tests/unit/xpcshell.ini
--- a/js/xpconnect/src/XPCWrappedJS.cpp
+++ b/js/xpconnect/src/XPCWrappedJS.cpp
@@ -6,17 +6,16 @@
 
 /* Class that wraps JS objects to appear as XPCOM objects. */
 
 #include "xpcprivate.h"
 #include "nsAtomicRefcnt.h"
 #include "nsProxyRelease.h"
 #include "nsThreadUtils.h"
 #include "nsTextFormatter.h"
-#include "nsCycleCollectorUtils.h"
 
 // NOTE: much of the fancy footwork is done in xpcstubs.cpp
 
 NS_IMETHODIMP
 NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS)::TraverseImpl
    (NS_CYCLE_COLLECTION_CLASSNAME(nsXPCWrappedJS) *that, void *p,
     nsCycleCollectionTraversalCallback &cb)
 {
@@ -146,34 +145,30 @@ nsXPCWrappedJS::QueryInterface(REFNSIID 
 // collection. Code in XPCJSRuntime watches for JS gc to happen and will do
 // the final release on wrappers whose JSObjects get finalized. Note that
 // even after tranistioning to this refcount-of-one state callers might do
 // an addref and cause us to re-root the JSObject and continue on more normally.
 
 nsrefcnt
 nsXPCWrappedJS::AddRef(void)
 {
-    if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
-        MOZ_CRASH();
     nsrefcnt cnt = NS_AtomicIncrementRefcnt(mRefCnt);
     NS_LOG_ADDREF(this, cnt, "nsXPCWrappedJS", sizeof(*this));
 
     if (2 == cnt && IsValid()) {
         XPCJSRuntime* rt = mClass->GetRuntime();
         rt->AddWrappedJSRoot(this);
     }
 
     return cnt;
 }
 
 nsrefcnt
 nsXPCWrappedJS::Release(void)
 {
-    if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
-        MOZ_CRASH();
     NS_PRECONDITION(0 != mRefCnt, "dup release");
 
     if (mMainThreadOnly && !NS_IsMainThread()) {
         // We'd like to abort here, but this can happen if someone uses a proxy
         // for the nsXPCWrappedJS.
         nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
         // If we can't get the main thread anymore we just leak, but this really
         // shouldn't happen.
@@ -277,20 +272,16 @@ CheckMainThreadOnly(nsXPCWrappedJS *aWra
 // static
 nsresult
 nsXPCWrappedJS::GetNewOrUsed(JSContext* cx,
                              JSObject* aJSObj,
                              REFNSIID aIID,
                              nsISupports* aOuter,
                              nsXPCWrappedJS** wrapperResult)
 {
-    // Do a release-mode assert against accessing nsXPCWrappedJS off-main-thread.
-    if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
-        MOZ_CRASH();
-
     JS::RootedObject jsObj(cx, aJSObj);
     JSObject2WrappedJSMap* map;
     nsXPCWrappedJS* root = nullptr;
     nsXPCWrappedJS* wrapper = nullptr;
     nsXPCWrappedJSClass* clazz = nullptr;
     XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
     JSBool release_root = false;
 
@@ -563,20 +554,16 @@ nsXPCWrappedJS::GetInterfaceInfo(nsIInte
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXPCWrappedJS::CallMethod(uint16_t methodIndex,
                            const XPTMethodDescriptor* info,
                            nsXPTCMiniVariant* params)
 {
-    // Do a release-mode assert against accessing nsXPCWrappedJS off-main-thread.
-    if (!MOZ_LIKELY(NS_IsMainThread() || NS_IsCycleCollectorThread()))
-        MOZ_CRASH();
-
     if (!IsValid())
         return NS_ERROR_UNEXPECTED;
     if (NS_IsMainThread() != mMainThread) {
         NS_NAMED_LITERAL_STRING(kFmt, "Attempt to use JS function on a different thread calling %s.%s. JS objects may not be shared across threads.");
         PRUnichar* msg =
             nsTextFormatter::smprintf(kFmt.get(),
                                       GetClass()->GetInterfaceName(),
                                       info->name);
new file mode 100644
--- /dev/null
+++ b/js/xpconnect/tests/unit/test_bug608142.js
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ * vim: sw=4 ts=4 sts=4 et
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+function run_test() { 
+    var tm = Components.classes["@mozilla.org/thread-manager;1"].getService();
+    var thr = tm.newThread(0);
+
+    var foundThreadError = false;
+ 
+    var listener = {
+        observe: function(message) {
+            if (/JS function on a different thread/.test(message.message))
+                foundThreadError = true;
+        }
+    };
+
+    var cs = Components.classes["@mozilla.org/consoleservice;1"].
+        getService(Components.interfaces.nsIConsoleService);
+    cs.registerListener(listener);
+
+    thr.dispatch({
+        run: function() {
+            do_check_true(false);
+        }
+    }, Components.interfaces.nsIThread.DISPATCH_NORMAL);
+
+    thr.shutdown();
+
+    cs.unregisterListener(listener);
+    do_check_true(foundThreadError);
+}
+
--- a/js/xpconnect/tests/unit/xpcshell.ini
+++ b/js/xpconnect/tests/unit/xpcshell.ini
@@ -2,16 +2,17 @@
 head = 
 tail = 
 
 [test_bogus_files.js]
 [test_bug408412.js]
 [test_bug451678.js]
 [test_bug596580.js]
 [test_bug604362.js]
+[test_bug608142.js]
 [test_bug641378.js]
 [test_bug677864.js]
 [test_bug711404.js]
 [test_bug778409.js]
 [test_bug780370.js]
 [test_bug805807.js]
 [test_bug809652.js]
 [test_bug813901.js]