merge mozilla-inbound to mozilla-central
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Thu, 19 Dec 2013 10:28:37 +0100
changeset 161197 35c6a9cd23b030b149e5bbd8ba6fbba9b67984f4
parent 161191 7d120481a6ae7c4714ca6c8e9880d492b7aaae53 (current diff)
parent 161196 85830cef2651e16a6df119918248e0f7843a1ec5 (diff)
child 161214 5c7fa2bfea8ba71fd4f3bae5c00266ccac55d284
push id25870
push usercbook@mozilla.com
push dateThu, 19 Dec 2013 09:28:59 +0000
treeherdermozilla-central@35c6a9cd23b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
merge mozilla-inbound to mozilla-central
--- a/accessible/src/base/EventQueue.cpp
+++ b/accessible/src/base/EventQueue.cpp
@@ -221,30 +221,31 @@ EventQueue::CoalesceReorderEvents(AccEve
         thisEvent->mEventRule = AccEvent::eDoNotEmit;
       }
 
       return;
     }
 
     // If tailEvent contains thisEvent
     // then
-    //   if show of tailEvent contains a grand parent of thisEvent
-    //   then assert
-    //   else if hide of tailEvent contains a grand parent of thisEvent
+    //   if show or hide of tailEvent contains a grand parent of thisEvent
     //   then ignore thisEvent and its show and hide events
     //   otherwise ignore thisEvent but not its show and hide events
     Accessible* thisParent = thisEvent->mAccessible;
     while (thisParent && thisParent != mDocument) {
       if (thisParent->Parent() == aTailEvent->mAccessible) {
         AccReorderEvent* tailReorder = downcast_accEvent(aTailEvent);
         uint32_t eventType = tailReorder->IsShowHideEventTarget(thisParent);
 
-        if (eventType == nsIAccessibleEvent::EVENT_SHOW) {
-           NS_ERROR("Accessible tree was created after it was modified! Huh?");
-        } else if (eventType == nsIAccessibleEvent::EVENT_HIDE) {
+        // Sometimes InvalidateChildren() and
+        // DocAccessible::CacheChildrenInSubtree() can conspire to reparent an
+        // accessible in this case no need for mutation events.  Se bug 883708
+        // for details.
+        if (eventType == nsIAccessibleEvent::EVENT_SHOW ||
+            eventType == nsIAccessibleEvent::EVENT_HIDE) {
           AccReorderEvent* thisReorder = downcast_accEvent(thisEvent);
           thisReorder->DoNotEmitAll();
         } else {
           thisEvent->mEventRule = AccEvent::eDoNotEmit;
         }
 
         return;
       }
--- a/accessible/tests/mochitest/treeupdate/a11y.ini
+++ b/accessible/tests/mochitest/treeupdate/a11y.ini
@@ -1,12 +1,13 @@
 [DEFAULT]
 
 [test_ariadialog.html]
 [test_bug852150.xhtml]
+[test_bug883708.xhtml]
 [test_bug895082.html]
 [test_canvas.html]
 [test_colorpicker.xul]
 [test_contextmenu.xul]
 [test_cssoverflow.html]
 [test_deck.xul]
 [test_doc.html]
 [test_gencontent.html]
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/treeupdate/test_bug883708.xhtml
@@ -0,0 +1,33 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+<script>
+
+function boom()
+{
+  var newSpan = document.createElementNS("http://www.w3.org/1999/xhtml", "span");
+  c.insertBefore(newSpan, d);
+  a.style.visibility = "visible";
+  ok(true, "test didn't crash or assert");
+  SimpleTest.finish();
+}
+
+</script>
+</head>
+
+<body onload="boom();">
+  <a target="_blank"
+     title="test reparenting accessible subtree when inaccessible element becomes accessible"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=883708">
+    Mozilla Bug 883708
+  </a>
+
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+<div style="visibility: collapse;" id="a"><div style="float: right; visibility: visible;"><div id="c"><td id="d"></td></div></div></div></body>
+</html>
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -1728,25 +1728,16 @@ RuntimeService::Init()
                                     PREF_MAX_SCRIPT_RUN_TIME_CHROME, -1))) {
     NS_WARNING("Failed to register timeout cache!");
   }
 
   int32_t maxPerDomain = Preferences::GetInt(PREF_WORKERS_MAX_PER_DOMAIN,
                                              MAX_WORKERS_PER_DOMAIN);
   gMaxWorkersPerDomain = std::max(0, maxPerDomain);
 
-  mDetectorName = Preferences::GetLocalizedCString("intl.charset.detector");
-
-  nsCOMPtr<nsIPlatformCharset> platformCharset =
-    do_GetService(NS_PLATFORMCHARSET_CONTRACTID, &rv);
-  if (NS_SUCCEEDED(rv)) {
-    rv = platformCharset->GetCharset(kPlatformCharsetSel_PlainTextInFile,
-                                     mSystemCharset);
-  }
-
   rv = InitOSFileConstants();
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   return NS_OK;
 }
 
--- a/dom/workers/RuntimeService.h
+++ b/dom/workers/RuntimeService.h
@@ -91,19 +91,16 @@ private:
 
   // *Not* protected by mMutex.
   nsClassHashtable<nsPtrHashKey<nsPIDOMWindow>,
                    nsTArray<WorkerPrivate*> > mWindowMap;
 
   // Only used on the main thread.
   nsCOMPtr<nsITimer> mIdleThreadTimer;
 
-  nsCString mDetectorName;
-  nsCString mSystemCharset;
-
   static JSSettings sDefaultJSSettings;
   static bool sDefaultPreferences[WORKERPREF_COUNT];
 
 public:
   struct NavigatorStrings
   {
     nsString mAppName;
     nsString mAppVersion;
@@ -148,28 +145,16 @@ public:
   CreateSharedWorker(const GlobalObject& aGlobal,
                      const nsAString& aScriptURL,
                      const nsAString& aName,
                      SharedWorker** aSharedWorker);
 
   void
   ForgetSharedWorker(WorkerPrivate* aWorkerPrivate);
 
-  const nsACString&
-  GetDetectorName() const
-  {
-    return mDetectorName;
-  }
-
-  const nsACString&
-  GetSystemCharset() const
-  {
-    return mSystemCharset;
-  }
-
   const NavigatorStrings&
   GetNavigatorStrings() const
   {
     return mNavigatorStrings;
   }
 
   void
   NoteIdleThread(WorkerThread* aThread);
--- a/js/src/jit/BaselineIC.cpp
+++ b/js/src/jit/BaselineIC.cpp
@@ -7814,20 +7814,23 @@ TryAttachFunApplyStub(JSContext *cx, ICC
 static bool
 GetTemplateObjectForNative(JSContext *cx, HandleScript script, jsbytecode *pc,
                            Native native, const CallArgs &args, MutableHandleObject res)
 {
     // Check for natives to which template objects can be attached. This is
     // done to provide templates to Ion for inlining these natives later on.
 
     if (native == js_Array) {
+        // Note: the template array won't be used if its length is inaccurately
+        // computed here.  (We allocate here because compilation may occur on a
+        // separate thread where allocation is impossible.)
         size_t count = 0;
-        if (args.hasDefined(1))
+        if (args.length() != 1)
             count = args.length();
-        else if (args.hasDefined(0) && args[0].isInt32() && args[0].toInt32() > 0)
+        else if (args.length() == 1 && args[0].isInt32() && args[0].toInt32() >= 0)
             count = args[0].toInt32();
         res.set(NewDenseUnallocatedArray(cx, count, nullptr, TenuredObject));
         if (!res)
             return false;
 
         types::TypeObject *type = types::TypeScript::InitObject(cx, script, pc, JSProto_Array);
         if (!type)
             return false;
--- a/netwerk/cache2/CacheIOThread.cpp
+++ b/netwerk/cache2/CacheIOThread.cpp
@@ -117,18 +117,16 @@ void CacheIOThread::ThreadFunc()
     mXPCOMThread = NS_GetCurrentThread();
 
     threadInternal = do_QueryInterface(mXPCOMThread);
     if (threadInternal)
       threadInternal->SetObserver(this);
 
     lock.NotifyAll();
 
-    static PRIntervalTime const waitTime = PR_MillisecondsToInterval(5000);
-
     do {
 loopStart:
       // Reset the lowest level now, so that we can detect a new event on
       // a lower level (i.e. higher priority) has been scheduled while
       // executing any previously scheduled event.
       mLowestLevelWaiting = LAST_LEVEL;
 
       // Process xpcom events first
@@ -155,24 +153,27 @@ loopStart:
 
         LoopOneLevel(level);
 
         // Go to the first (lowest) level again
         goto loopStart;
       }
 
       if (EventsPending())
-        goto loopStart;
+        continue;
 
-      lock.Wait(waitTime);
+      if (mShutdown)
+        break;
+
+      lock.Wait(PR_INTERVAL_NO_TIMEOUT);
 
       if (EventsPending())
-        goto loopStart;
+        continue;
 
-    } while (!mShutdown);
+    } while (true);
 
     MOZ_ASSERT(!EventsPending());
   } // lock
 
   if (threadInternal)
     threadInternal->SetObserver(nullptr);
 }