Bug 1222087: Part 2 - Ignore NS_ERROR_NO_INTERFACE exceptions when pausing on exceptions. r=fitzgen
authorKris Maglione <maglione.k@gmail.com>
Mon, 22 Feb 2016 14:52:27 -0800
changeset 321678 c96b93b4d7c0d16b3ae95c4fff365df9d3564adc
parent 321677 a8dd21de7df752056c99883ecd1e4cd19f65e82c
child 321679 e86f91dd77be96bc473c02acf581a4a19d3073ef
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfitzgen
bugs1222087
milestone47.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 1222087: Part 2 - Ignore NS_ERROR_NO_INTERFACE exceptions when pausing on exceptions. r=fitzgen MozReview-Commit-ID: Ao5Xpth3Txh
devtools/server/actors/script.js
devtools/server/tests/unit/test_ignore_no_interface_exceptions.js
devtools/server/tests/unit/xpcshell.ini
--- a/devtools/server/actors/script.js
+++ b/devtools/server/actors/script.js
@@ -2,17 +2,17 @@
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* 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/. */
 
 "use strict";
 
 const Services = require("Services");
-const { Cc, Ci, Cu, components, ChromeWorker } = require("chrome");
+const { Cc, Ci, Cu, Cr, components, ChromeWorker } = require("chrome");
 const { ActorPool, OriginalLocation, GeneratedLocation } = require("devtools/server/actors/common");
 const { BreakpointActor } = require("devtools/server/actors/breakpoint");
 const { FrameActor } = require("devtools/server/actors/frame");
 const { ObjectActor, createValueGrip, longStringGrip } = require("devtools/server/actors/object");
 const { DebuggerServer } = require("devtools/server/main");
 const DevToolsUtils = require("devtools/shared/DevToolsUtils");
 const { assert, dumpn, update, fetch } = DevToolsUtils;
 const { dirname, joinURI } = require("devtools/shared/path");
@@ -1841,16 +1841,23 @@ ThreadActor.prototype = {
         break;
       }
     }
 
     if (willBeCaught && this._options.ignoreCaughtExceptions) {
       return undefined;
     }
 
+    // NS_ERROR_NO_INTERFACE exceptions are a special case in browser code,
+    // since they're almost always thrown by QueryInterface functions, and
+    // handled cleanly by native code.
+    if (aValue == Cr.NS_ERROR_NO_INTERFACE) {
+      return undefined;
+    }
+
     const generatedLocation = this.sources.getFrameLocation(aFrame);
     const { originalSourceActor } = this.unsafeSynchronize(this.sources.getOriginalLocation(
       generatedLocation));
     const url = originalSourceActor ? originalSourceActor.url : null;
 
     if (this.sources.isBlackBoxed(url)) {
       return undefined;
     }
copy from devtools/server/tests/unit/test_pause_exceptions-02.js
copy to devtools/server/tests/unit/test_ignore_no_interface_exceptions.js
--- a/devtools/server/tests/unit/test_pause_exceptions-02.js
+++ b/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js
@@ -1,27 +1,28 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /**
- * Test that setting pauseOnExceptions to true when the debugger isn't in a
- * paused state will cause the debuggee to pause when an exceptions is thrown.
+ * Test that the debugger automatically ignores NS_ERROR_NO_INTERFACE
+ * exceptions, but not normal ones.
  */
 
+
 var gDebuggee;
 var gClient;
 var gThreadClient;
 
 function run_test()
 {
   initTestDebuggerServer();
-  gDebuggee = addTestGlobal("test-stack");
+  gDebuggee = addTestGlobal("test-no-interface");
   gClient = new DebuggerClient(DebuggerServer.connectPipe());
   gClient.connect().then(function() {
-    attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) {
+    attachTestTabAndResume(gClient, "test-no-interface", function(aResponse, aTabClient, aThreadClient) {
       gThreadClient = aThreadClient;
       test_pause_frame();
     });
   });
   do_test_pending();
 }
 
 function test_pause_frame()
@@ -31,17 +32,23 @@ function test_pause_frame()
       do_check_eq(aPacket.why.type, "exception");
       do_check_eq(aPacket.why.exception, 42);
       gThreadClient.resume(function () {
         finishClient(gClient);
       });
     });
 
     gDebuggee.eval("(" + function() {
+      function QueryInterface() {
+        throw Components.results.NS_ERROR_NO_INTERFACE;
+      }
       function stopMe() {
         throw 42;
       };
       try {
+        QueryInterface();
+      } catch (e) {}
+      try {
         stopMe();
       } catch (e) {}
     } + ")()");
   });
 }
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -234,16 +234,17 @@ reason = bug 820380
 [test_profiler_events-01.js]
 [test_profiler_events-02.js]
 [test_profiler_getbufferinfo.js]
 [test_profiler_getfeatures.js]
 [test_profiler_getsharedlibraryinformation.js]
 [test_unsafeDereference.js]
 [test_add_actors.js]
 [test_ignore_caught_exceptions.js]
+[test_ignore_no_interface_exceptions.js]
 [test_requestTypes.js]
 reason = bug 937197
 [test_layout-reflows-observer.js]
 [test_protocolSpec.js]
 [test_registerClient.js]
 [test_client_request.js]
 [test_monitor_actor.js]
 [test_symbols-01.js]