toolkit/crashreporter/test/unit/crasher_subprocess_head.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 // enable crash reporting first
     2 let cwd = Components.classes["@mozilla.org/file/directory_service;1"]
     3       .getService(Components.interfaces.nsIProperties)
     4       .get("CurWorkD", Components.interfaces.nsILocalFile);
     6 // get the temp dir
     7 let env = Components.classes["@mozilla.org/process/environment;1"].getService(Components.interfaces.nsIEnvironment);
     8 let _tmpd = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
     9 _tmpd.initWithPath(env.get("XPCSHELL_TEST_TEMP_DIR"));
    11 let crashReporter =
    12   Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
    13     .getService(Components.interfaces.nsICrashReporter);
    15 // We need to call this or crash events go in an undefined location.
    16 crashReporter.UpdateCrashEventsDir();
    18 // Setting the minidump path is not allowed in content processes
    19 let processType = Components.classes["@mozilla.org/xre/runtime;1"].
    20       getService(Components.interfaces.nsIXULRuntime).processType;
    21 if (processType == Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
    22   crashReporter.minidumpPath = _tmpd;
    23 }
    25 let ios = Components.classes["@mozilla.org/network/io-service;1"]
    26             .getService(Components.interfaces.nsIIOService);
    27 let protocolHandler = ios.getProtocolHandler("resource")
    28                         .QueryInterface(Components.interfaces.nsIResProtocolHandler);
    29 let curDirURI = ios.newFileURI(cwd);
    30 protocolHandler.setSubstitution("test", curDirURI);
    31 Components.utils.import("resource://test/CrashTestUtils.jsm");
    32 let crashType = CrashTestUtils.CRASH_INVALID_POINTER_DEREF;

mercurial