toolkit/components/crashmonitor/test/unit/test_invalid_json.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     4  * You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 /**
     7  * Test with sessionCheckpoints.json containing invalid JSON data
     8  */
     9 add_task(function test_invalid_file() {
    10   // Write bogus data to checkpoint file
    11   let data = "[}";
    12   yield OS.File.writeAtomic(sessionCheckpointsPath, data,
    13                             {tmpPath: sessionCheckpointsPath + ".tmp"});
    15   CrashMonitor.init();
    16   let checkpoints = yield CrashMonitor.previousCheckpoints;
    17   do_check_eq(checkpoints, null);
    18 });

mercurial