Bug 937006 - No crash when IDRequest fails to get filename and line number, r=bholley
authorAndrea Marchesini <amarchesini@mozilla.com>
Sat, 23 Nov 2013 19:25:18 +0000
changeset 157210 125b1813b9da1c526b4714a07fdab628c74c67bb
parent 157209 5dd26577d0935184f84bc15cfccffd6174f3e5c7
child 157211 ade5c649dd272a1dca423492aadc2d016f0d6d56
push id36652
push useramarchesini@mozilla.com
push dateSat, 23 Nov 2013 19:25:32 +0000
treeherdermozilla-inbound@125b1813b9da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs937006
milestone28.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
Bug 937006 - No crash when IDRequest fails to get filename and line number, r=bholley
dom/indexedDB/IDBRequest.cpp
dom/indexedDB/test/mochitest.ini
dom/indexedDB/test/test_bug937006.html
--- a/dom/indexedDB/IDBRequest.cpp
+++ b/dom/indexedDB/IDBRequest.cpp
@@ -273,17 +273,17 @@ IDBRequest::GetJSContext()
 void
 IDBRequest::CaptureCaller()
 {
   AutoJSContext cx;
 
   const char* filename = nullptr;
   uint32_t lineNo = 0;
   if (!nsJSUtils::GetCallingLocation(cx, &filename, &lineNo)) {
-    MOZ_CRASH("Failed to get caller.");
+    NS_WARNING("Failed to get caller.");
     return;
   }
 
   mFilename.Assign(NS_ConvertUTF8toUTF16(filename));
   mLineNo = lineNo;
 }
 
 void
--- a/dom/indexedDB/test/mochitest.ini
+++ b/dom/indexedDB/test/mochitest.ini
@@ -107,8 +107,9 @@ support-files =
 [test_transaction_abort_hang.html]
 [test_transaction_lifetimes.html]
 [test_transaction_lifetimes_nested.html]
 [test_transaction_ordering.html]
 [test_unique_index_update.html]
 [test_webapp_clearBrowserData_inproc_inproc.html]
 [test_webapp_clearBrowserData_inproc_oop.html]
 [test_webapp_clearBrowserData_oop_inproc.html]
+[test_bug937006.html]
new file mode 100644
--- /dev/null
+++ b/dom/indexedDB/test/test_bug937006.html
@@ -0,0 +1,37 @@
+<!--
+  Any copyright is dedicated to the Public Domain.
+  http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE html>
+<html>
+<head>
+  <title>Bug 937006 - "Hit MOZ_CRASH(Failed to get caller.)" using setTimeout on IndexedDB call</title>
+
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+
+</head>
+<body onload="runTest();">
+  <script type="text/javascript;version=1.7">
+
+  function runTest() {
+    if (!SpecialPowers.isMainProcess()) {
+      window.runTest = function() {
+        todo(false, "Figure out this test for child processes!");
+        SimpleTest.finish();
+        return;
+      }
+    }
+
+    // doing this IDBRequest should not be able to retrieve the filename and
+    // line number.
+    //setTimeout(indexedDB.deleteDatabase.bind(indexedDB), 0, 'x');
+    setTimeout(function() {
+      ok(true, "Still alive");
+      SimpleTest.finish();
+    }, 10);
+  }
+
+  </script>
+</body>
+</html>