зеркало из https://github.com/mozilla/gecko-dev.git
Bug 703235 - Remove ConsoleStorage; r=msucan
This commit is contained in:
Родитель
acf09a337b
Коммит
3a60c3737c
|
@ -29,6 +29,7 @@
|
|||
* Mihai Șucan <mihai.sucan@gmail.com>
|
||||
* Michael Ratcliffe <mratcliffe@mozilla.com>
|
||||
* Joe Walker <jwalker@mozilla.com>
|
||||
* Sonny Piers <sonny.piers@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -284,6 +285,9 @@ const ERRORS = { LOG_MESSAGE_MISSING_ARGS:
|
|||
// The indent of a console group in pixels.
|
||||
const GROUP_INDENT = 12;
|
||||
|
||||
// The pref prefix for webconsole filters
|
||||
const PREFS_PREFIX = "devtools.webconsole.filter.";
|
||||
|
||||
/**
|
||||
* Implements the nsIStreamListener and nsIRequestObserver interface. Used
|
||||
* within the HS_httpObserverFactory function to get the response body of
|
||||
|
@ -1790,9 +1794,18 @@ HUD_SERVICE.prototype =
|
|||
if (!aHUDId){
|
||||
throw new Error(ERRORS.MISSING_ARGS);
|
||||
}
|
||||
this.filterPrefs[aHUDId] = this.defaultFilterPrefs;
|
||||
// init storage objects:
|
||||
this.storage.createDisplay(aHUDId);
|
||||
this.filterPrefs[aHUDId] = {
|
||||
network: Services.prefs.getBoolPref(PREFS_PREFIX + "network"),
|
||||
networkinfo: Services.prefs.getBoolPref(PREFS_PREFIX + "networkinfo"),
|
||||
csserror: Services.prefs.getBoolPref(PREFS_PREFIX + "csserror"),
|
||||
cssparser: Services.prefs.getBoolPref(PREFS_PREFIX + "cssparser"),
|
||||
exception: Services.prefs.getBoolPref(PREFS_PREFIX + "exception"),
|
||||
jswarn: Services.prefs.getBoolPref(PREFS_PREFIX + "jswarn"),
|
||||
error: Services.prefs.getBoolPref(PREFS_PREFIX + "error"),
|
||||
info: Services.prefs.getBoolPref(PREFS_PREFIX + "info"),
|
||||
warn: Services.prefs.getBoolPref(PREFS_PREFIX + "warn"),
|
||||
log: Services.prefs.getBoolPref(PREFS_PREFIX + "log"),
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1839,9 +1852,6 @@ HUD_SERVICE.prototype =
|
|||
|
||||
delete this.hudReferences[aHUDId];
|
||||
|
||||
// remove the related storage object
|
||||
this.storage.removeDisplay(aHUDId);
|
||||
|
||||
for (let windowID in this.windowIds) {
|
||||
if (this.windowIds[windowID] == aHUDId) {
|
||||
delete this.windowIds[windowID];
|
||||
|
@ -1882,10 +1892,6 @@ HUD_SERVICE.prototype =
|
|||
return;
|
||||
}
|
||||
|
||||
this.storage = new ConsoleStorage();
|
||||
this.defaultFilterPrefs = this.storage.defaultDisplayPrefs;
|
||||
this.defaultGlobalConsolePrefs = this.storage.defaultGlobalConsolePrefs;
|
||||
|
||||
// begin observing HTTP traffic
|
||||
this.startHTTPObservation();
|
||||
|
||||
|
@ -1911,10 +1917,7 @@ HUD_SERVICE.prototype =
|
|||
this.openRequests = {};
|
||||
this.openResponseHeaders = {};
|
||||
|
||||
// delete the storage as it holds onto channels
|
||||
delete this.storage;
|
||||
delete this.defaultFilterPrefs;
|
||||
delete this.defaultGlobalConsolePrefs;
|
||||
|
||||
delete this.lastFinishedRequestCallback;
|
||||
|
||||
|
@ -6331,175 +6334,6 @@ HeadsUpDisplayUICommands = {
|
|||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ConsoleStorage
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var prefs = Services.prefs;
|
||||
|
||||
const GLOBAL_STORAGE_INDEX_ID = "GLOBAL_CONSOLE";
|
||||
const PREFS_PREFIX = "devtools.webconsole.filter.";
|
||||
const PREFS = { network: PREFS_PREFIX + "network",
|
||||
networkinfo: PREFS_PREFIX + "networkinfo",
|
||||
csserror: PREFS_PREFIX + "csserror",
|
||||
cssparser: PREFS_PREFIX + "cssparser",
|
||||
exception: PREFS_PREFIX + "exception",
|
||||
jswarn: PREFS_PREFIX + "jswarn",
|
||||
error: PREFS_PREFIX + "error",
|
||||
info: PREFS_PREFIX + "info",
|
||||
warn: PREFS_PREFIX + "warn",
|
||||
log: PREFS_PREFIX + "log",
|
||||
};
|
||||
|
||||
function ConsoleStorage()
|
||||
{
|
||||
this.sequencer = null;
|
||||
this.consoleDisplays = {};
|
||||
// each display will have an index that tracks each ConsoleEntry
|
||||
this.displayIndexes = {};
|
||||
this.globalStorageIndex = [];
|
||||
this.globalDisplay = {};
|
||||
this.createDisplay(GLOBAL_STORAGE_INDEX_ID);
|
||||
// TODO: need to create a method that truncates the message
|
||||
// see bug 570543
|
||||
|
||||
this.defaultDisplayPrefs = {
|
||||
network: prefs.getBoolPref(PREFS.network),
|
||||
networkinfo: prefs.getBoolPref(PREFS.networkinfo),
|
||||
csserror: prefs.getBoolPref(PREFS.csserror),
|
||||
cssparser: prefs.getBoolPref(PREFS.cssparser),
|
||||
exception: prefs.getBoolPref(PREFS.exception),
|
||||
jswarn: prefs.getBoolPref(PREFS.jswarn),
|
||||
error: prefs.getBoolPref(PREFS.error),
|
||||
info: prefs.getBoolPref(PREFS.info),
|
||||
warn: prefs.getBoolPref(PREFS.warn),
|
||||
log: prefs.getBoolPref(PREFS.log),
|
||||
};
|
||||
}
|
||||
|
||||
ConsoleStorage.prototype = {
|
||||
|
||||
sequenceId: function CS_sequencerId()
|
||||
{
|
||||
if (!this.sequencer) {
|
||||
this.sequencer = this.createSequencer();
|
||||
}
|
||||
return this.sequencer.next();
|
||||
},
|
||||
|
||||
createSequencer: function CS_createSequencer()
|
||||
{
|
||||
function sequencer(aInt) {
|
||||
while(1) {
|
||||
aInt++;
|
||||
yield aInt;
|
||||
}
|
||||
}
|
||||
return sequencer(-1);
|
||||
},
|
||||
|
||||
globalStore: function CS_globalStore(aIndex)
|
||||
{
|
||||
return this.displayStore(GLOBAL_CONSOLE_DOM_NODE_ID);
|
||||
},
|
||||
|
||||
displayStore: function CS_displayStore(aId)
|
||||
{
|
||||
var self = this;
|
||||
var idx = -1;
|
||||
var id = aId;
|
||||
var aLength = self.displayIndexes[id].length;
|
||||
|
||||
function displayStoreGenerator(aInt, aLength)
|
||||
{
|
||||
// create a generator object to iterate through any of the display stores
|
||||
// from any index-starting-point
|
||||
while(1) {
|
||||
// throw if we exceed the length of displayIndexes?
|
||||
aInt++;
|
||||
var indexIt = self.displayIndexes[id];
|
||||
var index = indexIt[aInt];
|
||||
if (aLength < aInt) {
|
||||
// try to see if we have more entries:
|
||||
var newLength = self.displayIndexes[id].length;
|
||||
if (newLength > aLength) {
|
||||
aLength = newLength;
|
||||
}
|
||||
else {
|
||||
throw new StopIteration();
|
||||
}
|
||||
}
|
||||
var entry = self.consoleDisplays[id][index];
|
||||
yield entry;
|
||||
}
|
||||
}
|
||||
|
||||
return displayStoreGenerator(-1, aLength);
|
||||
},
|
||||
|
||||
recordEntries: function CS_recordEntries(aHUDId, aConfigArray)
|
||||
{
|
||||
var len = aConfigArray.length;
|
||||
for (var i = 0; i < len; i++){
|
||||
this.recordEntry(aHUDId, aConfigArray[i]);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
recordEntry: function CS_recordEntry(aHUDId, aConfig)
|
||||
{
|
||||
var id = this.sequenceId();
|
||||
|
||||
this.globalStorageIndex[id] = { hudId: aHUDId };
|
||||
|
||||
var displayStorage = this.consoleDisplays[aHUDId];
|
||||
|
||||
var displayIndex = this.displayIndexes[aHUDId];
|
||||
|
||||
if (displayStorage && displayIndex) {
|
||||
var entry = new ConsoleEntry(aConfig, id);
|
||||
displayIndex.push(entry.id);
|
||||
displayStorage[entry.id] = entry;
|
||||
return entry;
|
||||
}
|
||||
else {
|
||||
throw new Error("Cannot get displayStorage or index object for id " + aHUDId);
|
||||
}
|
||||
},
|
||||
|
||||
getEntry: function CS_getEntry(aId)
|
||||
{
|
||||
var display = this.globalStorageIndex[aId];
|
||||
var storName = display.hudId;
|
||||
return this.consoleDisplays[storName][aId];
|
||||
},
|
||||
|
||||
updateEntry: function CS_updateEntry(aUUID)
|
||||
{
|
||||
// update an individual entry
|
||||
// TODO: see bug 568634
|
||||
},
|
||||
|
||||
createDisplay: function CS_createdisplay(aId)
|
||||
{
|
||||
if (!this.consoleDisplays[aId]) {
|
||||
this.consoleDisplays[aId] = {};
|
||||
this.displayIndexes[aId] = [];
|
||||
}
|
||||
},
|
||||
|
||||
removeDisplay: function CS_removeDisplay(aId)
|
||||
{
|
||||
try {
|
||||
delete this.consoleDisplays[aId];
|
||||
delete this.displayIndexes[aId];
|
||||
}
|
||||
catch (ex) {
|
||||
Cu.reportError("Could not remove console display for id " + aId);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A Console log entry
|
||||
*
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
# Patrick Walton <pcwalton@mozilla.com>
|
||||
# Mihai Șucan <mihai.sucan@gmail.com>
|
||||
# Rob Campbell <rcampbell@mozilla.com>
|
||||
# Sonny Piers <sonny.piers@gmail.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -81,10 +82,6 @@ _BROWSER_TEST_FILES = \
|
|||
browser_webconsole_property_panel.js \
|
||||
browser_webconsole_property_provider.js \
|
||||
browser_webconsole_registries.js \
|
||||
browser_webconsole_storage_create_display.js \
|
||||
browser_webconsole_storage_iteration.js \
|
||||
browser_webconsole_storage_record_entry.js \
|
||||
browser_webconsole_storage_record_many_entries.js \
|
||||
browser_webconsole_bug_587617_output_copy.js \
|
||||
browser_webconsole_bug_585237_line_limit.js \
|
||||
browser_webconsole_bug_581231_close_button.js \
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is DevTools test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
* Patrick Walton <pcwalton@mozilla.com>
|
||||
* Julian Viereck <jviereck@mozilla.com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Tests that the console message store is initialized properly.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("DOMContentLoaded", testStorageCreateDisplay,
|
||||
false);
|
||||
}
|
||||
|
||||
function testStorageCreateDisplay() {
|
||||
browser.removeEventListener("DOMContentLoaded", testStorageCreateDisplay,
|
||||
false);
|
||||
|
||||
openConsole();
|
||||
|
||||
let cs = HUDService.storage;
|
||||
|
||||
ok(typeof cs.consoleDisplays == "object",
|
||||
"consoledisplays exist");
|
||||
ok(typeof cs.displayIndexes == "object",
|
||||
"console indexes exist");
|
||||
cs.createDisplay("foo");
|
||||
ok(typeof cs.consoleDisplays["foo"] == "object",
|
||||
"foo display exists");
|
||||
ok(typeof cs.displayIndexes["foo"] == "object",
|
||||
"foo index exists");
|
||||
|
||||
cs.removeDisplay("foo");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is DevTools test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
* Patrick Walton <pcwalton@mozilla.com>
|
||||
* Julian Viereck <jviereck@mozilla.com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Test that the iterator API of the console message store works.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("DOMContentLoaded", testStorageIteration, false);
|
||||
}
|
||||
|
||||
function testStorageIteration() {
|
||||
browser.removeEventListener("DOMContentLoaded", testStorageIteration,
|
||||
false);
|
||||
|
||||
openConsole();
|
||||
|
||||
let cs = HUDService.storage;
|
||||
|
||||
// Must have enough entries present to avoid exhausting the iterators below.
|
||||
cs.createDisplay("foo");
|
||||
for (let i = 0; i < 300; i++) {
|
||||
cs.recordEntry("foo", { logLevel: "network", message: "foo" });
|
||||
}
|
||||
|
||||
var id = "foo";
|
||||
var it = cs.displayStore(id);
|
||||
var entry = it.next();
|
||||
var entry2 = it.next();
|
||||
|
||||
let entries = [];
|
||||
for (var i = 0; i < 100; i++) {
|
||||
let _entry = it.next();
|
||||
entries.push(_entry);
|
||||
}
|
||||
|
||||
ok(entries.length == 100, "entries length == 100");
|
||||
|
||||
let entries2 = [];
|
||||
|
||||
for (var i = 0; i < 100; i++){
|
||||
let _entry = it.next();
|
||||
entries2.push(_entry);
|
||||
}
|
||||
|
||||
ok(entries[0].id != entries2[0].id,
|
||||
"two distinct pages of log entries");
|
||||
|
||||
cs.removeDisplay("foo");
|
||||
cs = null;
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is DevTools test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
* Patrick Walton <pcwalton@mozilla.com>
|
||||
* Julian Viereck <jviereck@mozilla.com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Tests that the recordEntry() method of the console store works.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("DOMContentLoaded", testStorageRecordEntry,
|
||||
false);
|
||||
}
|
||||
|
||||
function testStorageRecordEntry() {
|
||||
browser.removeEventListener("DOMContentLoaded", testStorageRecordEntry,
|
||||
false);
|
||||
openConsole();
|
||||
|
||||
let cs = HUDService.storage;
|
||||
|
||||
cs.createDisplay("foo");
|
||||
|
||||
var config = {
|
||||
logLevel: "network",
|
||||
message: "HumminaHummina!",
|
||||
activity: {
|
||||
stage: "barStage",
|
||||
data: "bar bar bar bar"
|
||||
}
|
||||
};
|
||||
var entry = cs.recordEntry("foo", config);
|
||||
var res = entry.id;
|
||||
ok(entry.id != null, "Entry.id is: " + res);
|
||||
ok(cs.displayIndexes["foo"].length == 1,
|
||||
"We added one entry.");
|
||||
entry = cs.getEntry(res);
|
||||
ok(entry.id > -1,
|
||||
"We got an entry through the global interface");
|
||||
|
||||
cs.removeDisplay("foo");
|
||||
cs = null;
|
||||
finishTest();
|
||||
}
|
||||
|
|
@ -1,83 +0,0 @@
|
|||
/* vim:set ts=2 sw=2 sts=2 et: */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is DevTools test code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* David Dahl <ddahl@mozilla.com>
|
||||
* Patrick Walton <pcwalton@mozilla.com>
|
||||
* Julian Viereck <jviereck@mozilla.com>
|
||||
* Mihai Sucan <mihai.sucan@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// Test that the recordManyEntries() method of the console store works.
|
||||
|
||||
const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test//browser/test-console.html";
|
||||
|
||||
function test() {
|
||||
addTab(TEST_URI);
|
||||
browser.addEventListener("DOMContentLoaded", testStorageRecordManyEntries,
|
||||
false);
|
||||
}
|
||||
|
||||
function testStorageRecordManyEntries() {
|
||||
browser.removeEventListener("DOMContentLoaded",
|
||||
testStorageRecordManyEntries, false);
|
||||
|
||||
openConsole();
|
||||
|
||||
let cs = HUDService.storage;
|
||||
|
||||
cs.createDisplay("foo");
|
||||
|
||||
var configArr = [];
|
||||
|
||||
for (var i = 0; i < 1000; i++){
|
||||
let config = {
|
||||
logLevel: "network",
|
||||
message: "HumminaHummina!",
|
||||
activity: {
|
||||
stage: "barStage",
|
||||
data: "bar bar bar bar"
|
||||
}
|
||||
};
|
||||
configArr.push(config);
|
||||
}
|
||||
|
||||
cs.recordEntries("foo", configArr);
|
||||
ok(cs.displayIndexes["foo"].length == 1000,
|
||||
"1000 entries in foo now");
|
||||
|
||||
cs.removeDisplay("foo");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
Загрузка…
Ссылка в новой задаче