Added new example using a TAR file. Also fixed a few bugs with the root directory. Should refactor that in a future patch so that the root directory handled more clearly.

This commit is contained in:
Alan Kligman 2012-12-13 20:24:07 -05:00
parent baf63c6055
commit ad3aa5eac8
10 changed files with 4063 additions and 21 deletions

BIN
examples/archive.tar Normal file

Binary file not shown.

97
examples/idbfs-test3.html Normal file
View File

@ -0,0 +1,97 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="stdout"></div>
</body>
<script src="../lib/require.js"></script>
<script>
require.config({
baseUrl: "../lib",
paths: {
"src": "../src"
}
});
function Archive(text) {
this.files = [];
this.offset = 0;
this.offset = this.parseTarChunk(text, this.offset)
}
Archive.prototype = {
parseTarNumber: function parseTarNumber(text) {
// if (text.charCodeAt(0) & 0x80 == 1) {
// GNU tar 8-byte binary big-endian number
// } else {
return parseInt(text, 8);
// }
},
parseTarHeader: function parseTarHeader(text, offset) {
var i = offset || 0;
var h = {};
h.filename = text.substring(i, i+=100).split("\0", 1)[0];
h.mode = text.substring(i, i+=8).split("\0", 1)[0];
h.uid = text.substring(i, i+=8).split("\0", 1)[0];
h.gid = text.substring(i, i+=8).split("\0", 1)[0];
h.length = this.parseTarNumber(text.substring(i, i+=12));
h.lastModified = text.substring(i, i+=12).split("\0", 1)[0];
h.checkSum = text.substring(i, i+=8).split("\0", 1)[0];
h.fileType = text.substring(i, i+=1).split("\0", 1)[0];
h.linkName = text.substring(i, i+=100).split("\0", 1)[0];
return h;
},
parseTarChunk: function parseTarChunk(text, offset) {
while (text.length >= offset + 512) {
var header = this.files.length == 0 ? null : this.files[this.files.length-1];
if (header && header.data == null) {
if (offset + header.length <= text.length) {
header.data = text.substring(offset, offset+header.length);
offset += 512 * Math.ceil(header.length / 512);
} else { // not loaded yet
break;
}
} else {
var header = this.parseTarHeader(text, offset);
if (header.length > 0 || header.filename != '') {
this.files.push(header);
offset += 512;
header.offset = offset;
} else { // empty header, stop processing
offset = text.length;
}
}
}
return offset;
}
};
require(["src/fs"], function(IDBFS) {
var xhr = new XMLHttpRequest();
xhr.open('GET', './archive.tar', true);
// xhr.responseType = 'arraybuffer';
xhr.overrideMimeType("text/plain; charset=x-user-defined");
xhr.setRequestHeader("Content-Type", "text/plain");
xhr.onload = function(e) {
// var uInt8Array = new Uint8Array(this.response);
var archive = new Archive(this.response);
archive.files.forEach(function(file) {
console.log(file.filename);
});
};
xhr.send(null);
function unpack(archive) {
}
});
</script>
</html>

160
examples/idbfs-test4.html Normal file
View File

@ -0,0 +1,160 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="stdout"></div>
</body>
<script src="../lib/require.js"></script>
<script>
require.config({
baseUrl: "../lib",
paths: {
"src": "../src"
}
});
require(["buffer", "src/fs"], function(Buffer, IDBFS) {
var LF_NORMAL = "0",
LF_LINK = "1",
LF_SYMLINK = "2",
LF_CHR = "3",
LF_BLK = "4",
LF_DIR = "5",
LF_FIFO = "6",
LF_CONTIG = "7";
function Archive(buffer) {
this.files = [];
this.offset = 0;
this.offset = this.parseTarChunk(buffer, this.offset)
}
Archive.prototype = {
parseTarHeader: function parseTarHeader(buffer) {
var text = new Buffer(buffer).toString();
var i = 0;
var h = {};
h.filename = text.substring(i, i+=100).split("\0", 1)[0];
h.mode = text.substring(i, i+=8).split("\0", 1)[0];
h.uid = text.substring(i, i+=8).split("\0", 1)[0];
h.gid = text.substring(i, i+=8).split("\0", 1)[0];
h.length = parseInt(text.substring(i, i+=12), 8);
h.lastModified = text.substring(i, i+=12).split("\0", 1)[0];
h.checkSum = text.substring(i, i+=8).split("\0", 1)[0];
h.fileType = text.substring(i, i+=1).split("\0", 1)[0];
h.linkName = text.substring(i, i+=100).split("\0", 1)[0];
return h;
},
parseTarChunk: function parseTarChunk(buffer, offset) {
while (buffer.length >= offset + 512) {
var header = this.files.length == 0 ? null : this.files[this.files.length-1];
if (header && header.data == null) {
if (offset + header.length <= buffer.length) {
header.data = buffer.subarray(offset, offset+header.length);
offset += 512 * Math.ceil(header.length / 512);
} else { // not loaded yet
break;
}
} else {
var header = this.parseTarHeader(buffer.subarray(offset, offset+512));
if (header.length > 0 || header.filename != '') {
this.files.push(header);
offset += 512;
header.offset = offset;
} else { // empty header, stop processing
offset = buffer.length;
}
}
}
return offset;
}
};
var xhr = new XMLHttpRequest();
xhr.open('GET', './archive.tar', true);
xhr.responseType = 'arraybuffer';
xhr.onload = function(e) {
var buffer = new Uint8Array(this.response);
var archive = new Archive(buffer);
IDBFS.mount("default", "format", function(error, fs) {
if(error) {
return console.error(error);
}
function stat(path) {
fs.stat(path, function(error, result) {
if(error) {
return console.error(error);
}
console.info("stat " + path, result);
});
}
function ls(dir) {
fs.open(dir, "", "R", function(error, fd) {
contents = [];
fd.readdir(contents, undefined, function(error, count, contents) {
if(error) {
return console.error(error);
}
console.info("ls " + dir, contents);
fs.close(fd);
});
});
}
var i = 0;
function createNextFile(error) {
if(error) {
return console.error(error);
} else if(i >= archive.files.length) {
stat("/");
ls("/");
stat("/archive");
ls("/archive");
stat("/archive/js");
ls("/archive/js");
stat("/archive/js/gl-matrix.js");
stat("/archive/img");
ls("/archive/img");
stat("/archive/img/firefox_logo-only_RGB-300dpi.jpg");
} else {
var file = archive.files[i ++];
if(LF_DIR == file.fileType) {
fs.mkdir(file.filename, createNextFile);
} else {
fs.open(file.filename, "CREATE", "RW", function(error, fd) {
if(error) {
return console.error(error);
}
fd.write(file.data, function(error, bytes_written, buffer) {
if(error) {
return console.error(error);
}
fs.close(fd, createNextFile);
});
});
}
}
}
createNextFile();
});
};
xhr.send(null);
function unpack(archive) {
}
});
</script>
</html>

385
lib/buffer.js Normal file
View File

@ -0,0 +1,385 @@
/*
Copyright (c) 2012, Alan Kligman
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
Neither the name of the Mozilla Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
;(function(window, undefined) {
'use strict';
/** Detect free variable `exports` */
var freeExports = (typeof exports == 'object') && exports &&
(typeof global == 'object' && global && global == global.global && (window = global)) ? exports : undefined;
/**
* [source]http://closure-library.googlecode.com/svn/docs/closure_goog_crypt_crypt.js.source.html
* Converts a JS string to a UTF-8 "byte" array.
* @param {string} str 16-bit unicode string.
* @return {Array.<number>} UTF-8 byte array.
*/
function stringToUtf8ByteArray(string, offset, length, buffer) {
// TODO(user): Use native implementations if/when available
string = string.replace(/\r\n/g, '\n');
var p = 0;
for (var i = offset; i < string.length && p < length; i++) {
var c = string.charCodeAt(i);
if (c < 128) {
buffer[p++] = c;
} else if (c < 2048) {
buffer[p++] = (c >> 6) | 192;
buffer[p++] = (c & 63) | 128;
} else {
buffer[p++] = (c >> 12) | 224;
buffer[p++] = ((c >> 6) & 63) | 128;
buffer[p++] = (c & 63) | 128;
}
}
return buffer;
}
/**
* [source]http://closure-library.googlecode.com/svn/docs/closure_goog_crypt_crypt.js.source.html
* Converts a UTF-8 byte array to JavaScript's 16-bit Unicode.
* @param {Array.<number>} bytes UTF-8 byte array.
* @return {string} 16-bit Unicode string.
*/
function utf8ByteArrayToString(bytes) {
// TODO(user): Use native implementations if/when available
var out = [], pos = 0, c = 0;
var c1, c2, c3;
while (pos < bytes.length) {
c1 = bytes[pos++];
if (c1 < 128) {
out[c++] = String.fromCharCode(c1);
} else if (c1 > 191 && c1 < 224) {
c2 = bytes[pos++];
out[c++] = String.fromCharCode((c1 & 31) << 6 | c2 & 63);
} else {
c2 = bytes[pos++];
c3 = bytes[pos++];
out[c++] = String.fromCharCode(
(c1 & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
}
}
return out.join('');
}
function isTypedArray(object) {
return object instanceof ArrayBuffer ||
object instanceof Int8Array ||
object instanceof Uint8Array ||
object instanceof Int16Array ||
object instanceof Uint16Array ||
object instanceof Int32Array ||
object instanceof Uint32Array ||
object instanceof Float32Array ||
object instanceof Float64Array;
}
function BufferOverflowError(){ Error.apply(this, arguments); }
BufferOverflowError.prototype = new Error();
BufferOverflowError.prototype.name = "BufferOverflowError";
BufferOverflowError.prototype.constructor = BufferOverflowError;
function Buffer(arg, optArg) {
this.__bytes__ = undefined;
if(Array.isArray(arg) || isTypedArray(arg)) {
this.__bytes__ = new Uint8Array(arg);
} else if("string" === typeof arg) {
// FIXME: support other encodings
this.__bytes__ = new Uint8Array(Buffer.byteLength(arg));
this.write(arg);
} else if("number" === typeof arg) {
this.__bytes__ = new Uint8Array(arg);
} else {
// Do nothing!
}
this.__dataview__ = new DataView(this.__bytes__.buffer);
}
Buffer.BufferOverflowError = BufferOverflowError;
Buffer.isBuffer = function isBuffer(object) {
return object instanceof Buffer;
};
Buffer.isSupportedEncoding = function isSupportedEncoding(encoding) {
if("utf-8" === encoding) {
return true;
} else {
return false;
}
};
Buffer.byteLength = function byteLength(string, optEncoding) {
// FIXME: support other encodings
return window.unescape(encodeURIComponent(string)).length;
};
Buffer.concat = function concat(list, optTotalLength) {
var i, l;
if(undefined === optTotalLength) {
optTotalLength = 0;
for(i = 0, l = list.length; i < l; ++ i) {
optTotalLength += list[i].length();
}
}
var target = new Buffer(optTotalLength);
var offset = 0;
for(i = 0, l = list.length; i < l; ++ i) {
var source = list[i];
source.copy(target, offset);
offset += source.length();
}
return target;
};
Buffer.prototype.length = function length() {
return this.__bytes__.length;
};
Buffer.prototype.bytes = function bytes() {
return this.__bytes__;
};
Buffer.prototype.write = function write(string, optOffset, optLength, optEncoding) {
// FIXME: support other encodings
optOffset = (undefined === optOffset) ? 0 : optOffset;
optLength = (undefined === optLength) ? Buffer.byteLength(string) : optLength;
stringToUtf8ByteArray(string, optOffset, optLength, this.__bytes__);
};
Buffer.prototype.toString = function toString(optEncoding, optStart, optEnd) {
// FIXME: support other encodings
optStart = (undefined === optStart) ? 0 : optStart;
optEnd = (undefined === optEnd) ? this.__bytes__.length : optEnd;
var source;
if(optStart > 0 || optEnd < this.__bytes__.length) {
source = this.__bytes__.subarray(optStart, optEnd);
} else {
source = this.__bytes__;
}
return utf8ByteArrayToString(source);
};
Buffer.prototype.copy = function copy(targetBuffer, optTargetStart, optSourceStart, optSourceEnd) {
optTargetStart = (undefined === optTargetStart) ? 0 : optTargetStart;
optSourceStart = (undefined === optSourceStart) ? 0 : optSourceStart;
optSourceEnd = (undefined === optSourceEnd) ? this.__bytes__.length : optSourceEnd;
var source;
if(optSourceStart > 0 || optSourceEnd < this.__bytes__.length) {
source = this.__bytes__.subarray(optSourceStart, optSourceEnd);
} else {
source = this.__bytes__;
}
targetBuffer.__bytes__.set(source, optTargetStart);
};
Buffer.prototype.slice = function slice(optStart, optEnd) {
optStart = (undefined === optStart) ? 0 : optStart;
optEnd = (undefined === optEnd) ? this.__bytes__.length : optEnd;
var buffer = new Buffer(this.__bytes__.buffer);
buffer.__bytes__ = buffer.__bytes__.subarray(optStart, optEnd);
return buffer;
};
Buffer.prototype.readUInt8 = function readUInt8(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 1) {
throw new BufferOverflowError();
}
return this.__dataview__.getUint8(offset);
};
Buffer.prototype.readInt8 = function readInt8(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 1) {
throw new BufferOverflowError();
}
return this.__dataview__.getInt8(offset);
};
Buffer.prototype.writeUInt8 = function writeUInt8(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 1) {
throw new BufferOverflowError();
}
this.__dataview__.setUint8(offset, value);
};
Buffer.prototype.writeInt8 = function writeInt8(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 1) {
throw new BufferOverflowError();
}
return this.__dataview__.setInt8(offset, value);
};
Buffer.prototype.readUInt16BE = function readUInt16BE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
return this.__dataview__.getUint16(offset, false);
};
Buffer.prototype.readUInt16LE = function readUInt16LE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
return this.__dataview__.getUint16(offset, true);
};
Buffer.prototype.writeUInt16BE = function writeUInt16BE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
this.__dataview__.setUint16(offset, value, false);
};
Buffer.prototype.writeUInt16LE = function writeUInt16LE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
this.__dataview__.setUint16(offset, value, true);
};
Buffer.prototype.readInt16BE = function readInt16BE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
return this.__dataview__.getInt16(offset, false);
};
Buffer.prototype.readInt16LE = function readInt16LE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
return this.__dataview__.getInt16(offset, true);
};
Buffer.prototype.writeInt16BE = function writeInt16BE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
this.__dataview__.setInt16(offset, value, false);
};
Buffer.prototype.writeInt16LE = function writeInt16LE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 2) {
throw new BufferOverflowError();
}
this.__dataview__.setInt16(offset, value, true);
};
Buffer.prototype.readUInt32BE = function readUInt32BE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getUint32(offset, false);
};
Buffer.prototype.readUInt32LE = function readUInt32LE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getUint32(offset, true);
};
Buffer.prototype.writeUInt32BE = function writeUInt32BE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setUint32(offset, value, false);
};
Buffer.prototype.writeUInt32LE = function writeUInt32LE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setUint32(offset, value, true);
};
Buffer.prototype.readInt32BE = function readInt32BE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getInt32(offset, false);
};
Buffer.prototype.readInt32LE = function readInt32LE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getInt32(offset, true);
};
Buffer.prototype.writeInt32BE = function writeInt32BE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setInt32(offset, value, false);
};
Buffer.prototype.writeInt32LE = function writeInt32LE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setInt32(offset, value, true);
};
Buffer.prototype.readFloatBE = function readFloatBE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getFloat32(offset, false);
};
Buffer.prototype.readFloatLE = function readFloatLE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getFloat32(offset, true);
};
Buffer.prototype.writeFloatBE = function writeFloatBE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setFloat32(offset, value, false);
};
Buffer.prototype.writeFloatLE = function writeFloatLE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setFloat32(offset, value, true);
};
Buffer.prototype.readDoubleBE = function readDoubleBE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getFloat64(offset, false);
};
Buffer.prototype.readDoubleLE = function readDoubleLE(offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
return this.__dataview__.getFloat64(offset, true);
};
Buffer.prototype.writeDoubleBE = function writeDoubleBE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setFloat64(offset, value, false);
};
Buffer.prototype.writeDoubleLE = function writeDoubleLE(value, offset, optNoAssert) {
if(!optNoAssert && offset > this.__bytes__.length - 4) {
throw new BufferOverflowError();
}
this.__dataview__.setFloat64(offset, value, true);
};
/*--------------------------------------------------------------------------*/
// expose the API (borrowed from Lodash: https://raw.github.com/bestiejs/lodash/v0.6.1/lodash.js)
// some AMD build optimizers, like r.js, check for specific condition patterns like the following:
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
// Expose api to the global object even when an AMD loader is present in
// case Lo-Dash was injected by a third-party script and not intended to be
// loaded as a module. The global assignment can be reverted in the Lo-Dash
// module via its `noConflict()` method.
window.Buffer = Buffer;
// define as an anonymous module so, through path mapping, it can be
// referenced as the "underscore" module
define(function() {
return Buffer;
});
}
// check for `exports` after `define` in case a build optimizer adds an `exports` object
else if (freeExports) {
// in Node.js or RingoJS v0.8.0+
if (typeof module == 'object' && module && module.exports == freeExports) {
// FIXME: Hack for Node.js
var unescape = require("querystring").unescape;
(module.exports = Buffer).Buffer = Buffer;
}
// in Narwhal or RingoJS v0.7.0-
else {
freeExports.B = Buffer;
}
}
else {
// in a browser or Rhino
window.Buffer = Buffer;
}
}(this));

View File

@ -16,7 +16,7 @@ define(function(require) {
var when = require("when");
var _ = require("lodash");
var Path = require("src/path");
var Path = require("src/path");
var guid = require("src/guid");
var error = require("src/error");
require("crypto-js/rollups/sha256"); var Crypto = CryptoJS;
@ -158,7 +158,14 @@ define(function(require) {
var parent = e.target.result;
var data = parent.data;
var file, filehandle;
if(!_(data).has(name)) {
if(name === fullpath) {
file = parent;
filehandle = parenthandle;
if(OM_RW === mode && DIRECTORY_MIME_TYPE === file.mode) {
runcallback(callback, new error.EIsDirectory());
}
_createFileDescriptor(filehandle, file, flags, mode);
} else if(!_(data).has(name)) {
if(_(flags).contains(OF_CREATE)) {
filehandle = data[name] = hash(guid());
++ parent.size;
@ -234,24 +241,28 @@ define(function(require) {
}, JSON_MIME_TYPE, 2);
++ directory.links;
var createDirectoryRequest = files.put(directory, directoryhandle);
createDirectoryRequest.onsuccess = function(e) {
var getParentRequest = files.get(parenthandle);
getParentRequest.onsuccess = function(e) {
var parent = e.target.result;
parent.data[Path.basename(fullpath)] = directoryhandle;
++ parent.size;
++ parent.version;
var updateParentRequest = files.put(parent, parenthandle);
updateParentRequest.onsuccess = function(e) {
runcallback(callback);
createDirectoryRequest.onsuccess = function(e) {
if(directoryhandle !== parenthandle) {
var getParentRequest = files.get(parenthandle);
getParentRequest.onsuccess = function(e) {
var parent = e.target.result;
parent.data[Path.basename(fullpath)] = directoryhandle;
++ parent.size;
++ parent.version;
var updateParentRequest = files.put(parent, parenthandle);
updateParentRequest.onsuccess = function(e) {
runcallback(callback);
};
updateParentRequest.onerror = function(e) {
runcallback(callback, e);
};
};
updateParentRequest.onerror = function(e) {
getParentRequest.onerror = function(e) {
runcallback(callback, e);
};
};
getParentRequest.onerror = function(e) {
runcallback(callback, e);
};
} else {
runcallback(callback);
}
};
createDirectoryRequest.onerror = function(e) {
runcallback(callback, e);
@ -323,19 +334,24 @@ define(function(require) {
var parentpath = Path.dirname(fullpath);
var parenthandle = hash(parentpath);
var getParentRequest = files.get(parenthandle);
var getParentRequest = files.get(parenthandle);
var stats, file;
getParentRequest.onsuccess = function(e) {
var parent = e.target.result;
var data = parent.data;
var name = Path.basename(fullpath);
if(!_(data).has(name)) {
if(name === fullpath) {
file = parent;
stats = new Stats(file.size, filehandle, file.atime, file.ctime, file.mtime, file.links);
runcallback(callback, null, stats);
} else if(!_(data).has(name)) {
runcallback(callback, new error.ENoEntry());
} else {
var filehandle = data[name];
var getFileRequest = files.get(filehandle);
getFileRequest.onsuccess = function(e) {
var file = e.target.result;
var stats = new Stats(file.size, filehandle, file.atime, file.ctime, file.mtime, file.links);
stats = new Stats(file.size, filehandle, file.atime, file.ctime, file.mtime, file.links);
runcallback(callback, null, stats);
};
getFileRequest.onerror = function(e) {
@ -637,6 +653,7 @@ define(function(require) {
getFileRequest.onsuccess = function(e) {
var file = e.target.result;
var names = _(file.data).keys().sort();
count = count || file.size;
count = (openfile._position + count > file.size) ? (file.size - openfile._position) : count;
for(var i = openfile._position, l = openfile._position + count; i < l; ++ i) {
buffer.push(names[i]);

View File

@ -110,7 +110,7 @@ define(function(require) {
if (ext && f.substr(-1 * ext.length) === ext) {
f = f.substr(0, f.length - ext.length);
}
return f;
return f === "" ? "/" : f;
};
function isAbsolute(path) {

View File

@ -0,0 +1,20 @@
Copyright (c) 2008-2011 Pivotal Labs
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@ -0,0 +1,681 @@
jasmine.HtmlReporterHelpers = {};
jasmine.HtmlReporterHelpers.createDom = function(type, attrs, childrenVarArgs) {
var el = document.createElement(type);
for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];
if (typeof child === 'string') {
el.appendChild(document.createTextNode(child));
} else {
if (child) {
el.appendChild(child);
}
}
}
for (var attr in attrs) {
if (attr == "className") {
el[attr] = attrs[attr];
} else {
el.setAttribute(attr, attrs[attr]);
}
}
return el;
};
jasmine.HtmlReporterHelpers.getSpecStatus = function(child) {
var results = child.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.skipped) {
status = 'skipped';
}
return status;
};
jasmine.HtmlReporterHelpers.appendToSummary = function(child, childElement) {
var parentDiv = this.dom.summary;
var parentSuite = (typeof child.parentSuite == 'undefined') ? 'suite' : 'parentSuite';
var parent = child[parentSuite];
if (parent) {
if (typeof this.views.suites[parent.id] == 'undefined') {
this.views.suites[parent.id] = new jasmine.HtmlReporter.SuiteView(parent, this.dom, this.views);
}
parentDiv = this.views.suites[parent.id].element;
}
parentDiv.appendChild(childElement);
};
jasmine.HtmlReporterHelpers.addHelpers = function(ctor) {
for(var fn in jasmine.HtmlReporterHelpers) {
ctor.prototype[fn] = jasmine.HtmlReporterHelpers[fn];
}
};
jasmine.HtmlReporter = function(_doc) {
var self = this;
var doc = _doc || window.document;
var reporterView;
var dom = {};
// Jasmine Reporter Public Interface
self.logRunningSpecs = false;
self.reportRunnerStarting = function(runner) {
var specs = runner.specs() || [];
if (specs.length == 0) {
return;
}
createReporterDom(runner.env.versionString());
doc.body.appendChild(dom.reporter);
setExceptionHandling();
reporterView = new jasmine.HtmlReporter.ReporterView(dom);
reporterView.addSpecs(specs, self.specFilter);
};
self.reportRunnerResults = function(runner) {
reporterView && reporterView.complete();
};
self.reportSuiteResults = function(suite) {
reporterView.suiteComplete(suite);
};
self.reportSpecStarting = function(spec) {
if (self.logRunningSpecs) {
self.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
}
};
self.reportSpecResults = function(spec) {
reporterView.specComplete(spec);
};
self.log = function() {
var console = jasmine.getGlobal().console;
if (console && console.log) {
if (console.log.apply) {
console.log.apply(console, arguments);
} else {
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
}
}
};
self.specFilter = function(spec) {
if (!focusedSpecName()) {
return true;
}
return spec.getFullName().indexOf(focusedSpecName()) === 0;
};
return self;
function focusedSpecName() {
var specName;
(function memoizeFocusedSpec() {
if (specName) {
return;
}
var paramMap = [];
var params = jasmine.HtmlReporter.parameters(doc);
for (var i = 0; i < params.length; i++) {
var p = params[i].split('=');
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
}
specName = paramMap.spec;
})();
return specName;
}
function createReporterDom(version) {
dom.reporter = self.createDom('div', { id: 'HTMLReporter', className: 'jasmine_reporter' },
dom.banner = self.createDom('div', { className: 'banner' },
self.createDom('span', { className: 'title' }, "Jasmine "),
self.createDom('span', { className: 'version' }, version)),
dom.symbolSummary = self.createDom('ul', {className: 'symbolSummary'}),
dom.alert = self.createDom('div', {className: 'alert'},
self.createDom('span', { className: 'exceptions' },
self.createDom('label', { className: 'label', for: 'no_try_catch' }, 'No try/catch'),
self.createDom('input', { id: 'no_try_catch', type: 'checkbox' }))),
dom.results = self.createDom('div', {className: 'results'},
dom.summary = self.createDom('div', { className: 'summary' }),
dom.details = self.createDom('div', { id: 'details' }))
);
}
function noTryCatch() {
return window.location.search.match(/catch=false/);
}
function searchWithCatch() {
var params = jasmine.HtmlReporter.parameters(window.document);
var removed = false;
var i = 0;
while (!removed && i < params.length) {
if (params[i].match(/catch=/)) {
params.splice(i, 1);
removed = true;
}
i++;
}
if (jasmine.CATCH_EXCEPTIONS) {
params.push("catch=false");
}
return params.join("&");
}
function setExceptionHandling() {
var chxCatch = document.getElementById('no_try_catch');
if (noTryCatch()) {
chxCatch.setAttribute('checked', true);
jasmine.CATCH_EXCEPTIONS = false;
}
chxCatch.onclick = function() {
window.location.search = searchWithCatch();
};
}
};
jasmine.HtmlReporter.parameters = function(doc) {
var paramStr = doc.location.search.substring(1);
var params = [];
if (paramStr.length > 0) {
params = paramStr.split('&');
}
return params;
}
jasmine.HtmlReporter.sectionLink = function(sectionName) {
var link = '?';
var params = [];
if (sectionName) {
params.push('spec=' + encodeURIComponent(sectionName));
}
if (!jasmine.CATCH_EXCEPTIONS) {
params.push("catch=false");
}
if (params.length > 0) {
link += params.join("&");
}
return link;
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter);
jasmine.HtmlReporter.ReporterView = function(dom) {
this.startedAt = new Date();
this.runningSpecCount = 0;
this.completeSpecCount = 0;
this.passedCount = 0;
this.failedCount = 0;
this.skippedCount = 0;
this.createResultsMenu = function() {
this.resultsMenu = this.createDom('span', {className: 'resultsMenu bar'},
this.summaryMenuItem = this.createDom('a', {className: 'summaryMenuItem', href: "#"}, '0 specs'),
' | ',
this.detailsMenuItem = this.createDom('a', {className: 'detailsMenuItem', href: "#"}, '0 failing'));
this.summaryMenuItem.onclick = function() {
dom.reporter.className = dom.reporter.className.replace(/ showDetails/g, '');
};
this.detailsMenuItem.onclick = function() {
showDetails();
};
};
this.addSpecs = function(specs, specFilter) {
this.totalSpecCount = specs.length;
this.views = {
specs: {},
suites: {}
};
for (var i = 0; i < specs.length; i++) {
var spec = specs[i];
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom, this.views);
if (specFilter(spec)) {
this.runningSpecCount++;
}
}
};
this.specComplete = function(spec) {
this.completeSpecCount++;
if (isUndefined(this.views.specs[spec.id])) {
this.views.specs[spec.id] = new jasmine.HtmlReporter.SpecView(spec, dom);
}
var specView = this.views.specs[spec.id];
switch (specView.status()) {
case 'passed':
this.passedCount++;
break;
case 'failed':
this.failedCount++;
break;
case 'skipped':
this.skippedCount++;
break;
}
specView.refresh();
this.refresh();
};
this.suiteComplete = function(suite) {
var suiteView = this.views.suites[suite.id];
if (isUndefined(suiteView)) {
return;
}
suiteView.refresh();
};
this.refresh = function() {
if (isUndefined(this.resultsMenu)) {
this.createResultsMenu();
}
// currently running UI
if (isUndefined(this.runningAlert)) {
this.runningAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "runningAlert bar" });
dom.alert.appendChild(this.runningAlert);
}
this.runningAlert.innerHTML = "Running " + this.completeSpecCount + " of " + specPluralizedFor(this.totalSpecCount);
// skipped specs UI
if (isUndefined(this.skippedAlert)) {
this.skippedAlert = this.createDom('a', { href: jasmine.HtmlReporter.sectionLink(), className: "skippedAlert bar" });
}
this.skippedAlert.innerHTML = "Skipping " + this.skippedCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
if (this.skippedCount === 1 && isDefined(dom.alert)) {
dom.alert.appendChild(this.skippedAlert);
}
// passing specs UI
if (isUndefined(this.passedAlert)) {
this.passedAlert = this.createDom('span', { href: jasmine.HtmlReporter.sectionLink(), className: "passingAlert bar" });
}
this.passedAlert.innerHTML = "Passing " + specPluralizedFor(this.passedCount);
// failing specs UI
if (isUndefined(this.failedAlert)) {
this.failedAlert = this.createDom('span', {href: "?", className: "failingAlert bar"});
}
this.failedAlert.innerHTML = "Failing " + specPluralizedFor(this.failedCount);
if (this.failedCount === 1 && isDefined(dom.alert)) {
dom.alert.appendChild(this.failedAlert);
dom.alert.appendChild(this.resultsMenu);
}
// summary info
this.summaryMenuItem.innerHTML = "" + specPluralizedFor(this.runningSpecCount);
this.detailsMenuItem.innerHTML = "" + this.failedCount + " failing";
};
this.complete = function() {
dom.alert.removeChild(this.runningAlert);
this.skippedAlert.innerHTML = "Ran " + this.runningSpecCount + " of " + specPluralizedFor(this.totalSpecCount) + " - run all";
if (this.failedCount === 0) {
dom.alert.appendChild(this.createDom('span', {className: 'passingAlert bar'}, "Passing " + specPluralizedFor(this.passedCount)));
} else {
showDetails();
}
dom.banner.appendChild(this.createDom('span', {className: 'duration'}, "finished in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s"));
};
return this;
function showDetails() {
if (dom.reporter.className.search(/showDetails/) === -1) {
dom.reporter.className += " showDetails";
}
}
function isUndefined(obj) {
return typeof obj === 'undefined';
}
function isDefined(obj) {
return !isUndefined(obj);
}
function specPluralizedFor(count) {
var str = count + " spec";
if (count > 1) {
str += "s"
}
return str;
}
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.ReporterView);
jasmine.HtmlReporter.SpecView = function(spec, dom, views) {
this.spec = spec;
this.dom = dom;
this.views = views;
this.symbol = this.createDom('li', { className: 'pending' });
this.dom.symbolSummary.appendChild(this.symbol);
this.summary = this.createDom('div', { className: 'specSummary' },
this.createDom('a', {
className: 'description',
href: jasmine.HtmlReporter.sectionLink(this.spec.getFullName()),
title: this.spec.getFullName()
}, this.spec.description)
);
this.detail = this.createDom('div', { className: 'specDetail' },
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(this.spec.getFullName()),
title: this.spec.getFullName()
}, this.spec.getFullName())
);
};
jasmine.HtmlReporter.SpecView.prototype.status = function() {
return this.getSpecStatus(this.spec);
};
jasmine.HtmlReporter.SpecView.prototype.refresh = function() {
this.symbol.className = this.status();
switch (this.status()) {
case 'skipped':
break;
case 'passed':
this.appendSummaryToSuiteDiv();
break;
case 'failed':
this.appendSummaryToSuiteDiv();
this.appendFailureDetail();
break;
}
};
jasmine.HtmlReporter.SpecView.prototype.appendSummaryToSuiteDiv = function() {
this.summary.className += ' ' + this.status();
this.appendToSummary(this.spec, this.summary);
};
jasmine.HtmlReporter.SpecView.prototype.appendFailureDetail = function() {
this.detail.className += ' ' + this.status();
var resultItems = this.spec.results().getItems();
var messagesDiv = this.createDom('div', { className: 'messages' });
for (var i = 0; i < resultItems.length; i++) {
var result = resultItems[i];
if (result.type == 'log') {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
} else if (result.type == 'expect' && result.passed && !result.passed()) {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
if (result.trace.stack) {
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
}
}
}
if (messagesDiv.childNodes.length > 0) {
this.detail.appendChild(messagesDiv);
this.dom.details.appendChild(this.detail);
}
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SpecView);jasmine.HtmlReporter.SuiteView = function(suite, dom, views) {
this.suite = suite;
this.dom = dom;
this.views = views;
this.element = this.createDom('div', { className: 'suite' },
this.createDom('a', { className: 'description', href: jasmine.HtmlReporter.sectionLink(this.suite.getFullName()) }, this.suite.description)
);
this.appendToSummary(this.suite, this.element);
};
jasmine.HtmlReporter.SuiteView.prototype.status = function() {
return this.getSpecStatus(this.suite);
};
jasmine.HtmlReporter.SuiteView.prototype.refresh = function() {
this.element.className += " " + this.status();
};
jasmine.HtmlReporterHelpers.addHelpers(jasmine.HtmlReporter.SuiteView);
/* @deprecated Use jasmine.HtmlReporter instead
*/
jasmine.TrivialReporter = function(doc) {
this.document = doc || document;
this.suiteDivs = {};
this.logRunningSpecs = false;
};
jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
var el = document.createElement(type);
for (var i = 2; i < arguments.length; i++) {
var child = arguments[i];
if (typeof child === 'string') {
el.appendChild(document.createTextNode(child));
} else {
if (child) { el.appendChild(child); }
}
}
for (var attr in attrs) {
if (attr == "className") {
el[attr] = attrs[attr];
} else {
el.setAttribute(attr, attrs[attr]);
}
}
return el;
};
jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
var showPassed, showSkipped;
this.outerDiv = this.createDom('div', { id: 'TrivialReporter', className: 'jasmine_reporter' },
this.createDom('div', { className: 'banner' },
this.createDom('div', { className: 'logo' },
this.createDom('span', { className: 'title' }, "Jasmine"),
this.createDom('span', { className: 'version' }, runner.env.versionString())),
this.createDom('div', { className: 'options' },
"Show ",
showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
)
),
this.runnerDiv = this.createDom('div', { className: 'runner running' },
this.createDom('a', { className: 'run_spec', href: '?' }, "run all"),
this.runnerMessageSpan = this.createDom('span', {}, "Running..."),
this.finishedAtSpan = this.createDom('span', { className: 'finished-at' }, ""))
);
this.document.body.appendChild(this.outerDiv);
var suites = runner.suites();
for (var i = 0; i < suites.length; i++) {
var suite = suites[i];
var suiteDiv = this.createDom('div', { className: 'suite' },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, "run"),
this.createDom('a', { className: 'description', href: '?spec=' + encodeURIComponent(suite.getFullName()) }, suite.description));
this.suiteDivs[suite.id] = suiteDiv;
var parentDiv = this.outerDiv;
if (suite.parentSuite) {
parentDiv = this.suiteDivs[suite.parentSuite.id];
}
parentDiv.appendChild(suiteDiv);
}
this.startedAt = new Date();
var self = this;
showPassed.onclick = function(evt) {
if (showPassed.checked) {
self.outerDiv.className += ' show-passed';
} else {
self.outerDiv.className = self.outerDiv.className.replace(/ show-passed/, '');
}
};
showSkipped.onclick = function(evt) {
if (showSkipped.checked) {
self.outerDiv.className += ' show-skipped';
} else {
self.outerDiv.className = self.outerDiv.className.replace(/ show-skipped/, '');
}
};
};
jasmine.TrivialReporter.prototype.reportRunnerResults = function(runner) {
var results = runner.results();
var className = (results.failedCount > 0) ? "runner failed" : "runner passed";
this.runnerDiv.setAttribute("class", className);
//do it twice for IE
this.runnerDiv.setAttribute("className", className);
var specs = runner.specs();
var specCount = 0;
for (var i = 0; i < specs.length; i++) {
if (this.specFilter(specs[i])) {
specCount++;
}
}
var message = "" + specCount + " spec" + (specCount == 1 ? "" : "s" ) + ", " + results.failedCount + " failure" + ((results.failedCount == 1) ? "" : "s");
message += " in " + ((new Date().getTime() - this.startedAt.getTime()) / 1000) + "s";
this.runnerMessageSpan.replaceChild(this.createDom('a', { className: 'description', href: '?'}, message), this.runnerMessageSpan.firstChild);
this.finishedAtSpan.appendChild(document.createTextNode("Finished at " + new Date().toString()));
};
jasmine.TrivialReporter.prototype.reportSuiteResults = function(suite) {
var results = suite.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.totalCount === 0) { // todo: change this to check results.skipped
status = 'skipped';
}
this.suiteDivs[suite.id].className += " " + status;
};
jasmine.TrivialReporter.prototype.reportSpecStarting = function(spec) {
if (this.logRunningSpecs) {
this.log('>> Jasmine Running ' + spec.suite.description + ' ' + spec.description + '...');
}
};
jasmine.TrivialReporter.prototype.reportSpecResults = function(spec) {
var results = spec.results();
var status = results.passed() ? 'passed' : 'failed';
if (results.skipped) {
status = 'skipped';
}
var specDiv = this.createDom('div', { className: 'spec ' + status },
this.createDom('a', { className: 'run_spec', href: '?spec=' + encodeURIComponent(spec.getFullName()) }, "run"),
this.createDom('a', {
className: 'description',
href: '?spec=' + encodeURIComponent(spec.getFullName()),
title: spec.getFullName()
}, spec.description));
var resultItems = results.getItems();
var messagesDiv = this.createDom('div', { className: 'messages' });
for (var i = 0; i < resultItems.length; i++) {
var result = resultItems[i];
if (result.type == 'log') {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage log'}, result.toString()));
} else if (result.type == 'expect' && result.passed && !result.passed()) {
messagesDiv.appendChild(this.createDom('div', {className: 'resultMessage fail'}, result.message));
if (result.trace.stack) {
messagesDiv.appendChild(this.createDom('div', {className: 'stackTrace'}, result.trace.stack));
}
}
}
if (messagesDiv.childNodes.length > 0) {
specDiv.appendChild(messagesDiv);
}
this.suiteDivs[spec.suite.id].appendChild(specDiv);
};
jasmine.TrivialReporter.prototype.log = function() {
var console = jasmine.getGlobal().console;
if (console && console.log) {
if (console.log.apply) {
console.log.apply(console, arguments);
} else {
console.log(arguments); // ie fix: console.log.apply doesn't exist on ie
}
}
};
jasmine.TrivialReporter.prototype.getLocation = function() {
return this.document.location;
};
jasmine.TrivialReporter.prototype.specFilter = function(spec) {
var paramMap = {};
var params = this.getLocation().search.substring(1).split('&');
for (var i = 0; i < params.length; i++) {
var p = params[i].split('=');
paramMap[decodeURIComponent(p[0])] = decodeURIComponent(p[1]);
}
if (!paramMap.spec) {
return true;
}
return spec.getFullName().indexOf(paramMap.spec) === 0;
};

View File

@ -0,0 +1,82 @@
body { background-color: #eeeeee; padding: 0; margin: 5px; overflow-y: scroll; }
#HTMLReporter { font-size: 11px; font-family: Monaco, "Lucida Console", monospace; line-height: 14px; color: #333333; }
#HTMLReporter a { text-decoration: none; }
#HTMLReporter a:hover { text-decoration: underline; }
#HTMLReporter p, #HTMLReporter h1, #HTMLReporter h2, #HTMLReporter h3, #HTMLReporter h4, #HTMLReporter h5, #HTMLReporter h6 { margin: 0; line-height: 14px; }
#HTMLReporter .banner, #HTMLReporter .symbolSummary, #HTMLReporter .summary, #HTMLReporter .resultMessage, #HTMLReporter .specDetail .description, #HTMLReporter .alert .bar, #HTMLReporter .stackTrace { padding-left: 9px; padding-right: 9px; }
#HTMLReporter #jasmine_content { position: fixed; right: 100%; }
#HTMLReporter .version { color: #aaaaaa; }
#HTMLReporter .banner { margin-top: 14px; }
#HTMLReporter .duration { color: #aaaaaa; float: right; }
#HTMLReporter .symbolSummary { overflow: hidden; *zoom: 1; margin: 14px 0; }
#HTMLReporter .symbolSummary li { display: block; float: left; height: 7px; width: 14px; margin-bottom: 7px; font-size: 16px; }
#HTMLReporter .symbolSummary li.passed { font-size: 14px; }
#HTMLReporter .symbolSummary li.passed:before { color: #5e7d00; content: "\02022"; }
#HTMLReporter .symbolSummary li.failed { line-height: 9px; }
#HTMLReporter .symbolSummary li.failed:before { color: #b03911; content: "x"; font-weight: bold; margin-left: -1px; }
#HTMLReporter .symbolSummary li.skipped { font-size: 14px; }
#HTMLReporter .symbolSummary li.skipped:before { color: #bababa; content: "\02022"; }
#HTMLReporter .symbolSummary li.pending { line-height: 11px; }
#HTMLReporter .symbolSummary li.pending:before { color: #aaaaaa; content: "-"; }
#HTMLReporter .exceptions { color: #fff; float: right; margin-top: 5px; margin-right: 5px; }
#HTMLReporter .bar { line-height: 28px; font-size: 14px; display: block; color: #eee; }
#HTMLReporter .runningAlert { background-color: #666666; }
#HTMLReporter .skippedAlert { background-color: #aaaaaa; }
#HTMLReporter .skippedAlert:first-child { background-color: #333333; }
#HTMLReporter .skippedAlert:hover { text-decoration: none; color: white; text-decoration: underline; }
#HTMLReporter .passingAlert { background-color: #a6b779; }
#HTMLReporter .passingAlert:first-child { background-color: #5e7d00; }
#HTMLReporter .failingAlert { background-color: #cf867e; }
#HTMLReporter .failingAlert:first-child { background-color: #b03911; }
#HTMLReporter .results { margin-top: 14px; }
#HTMLReporter #details { display: none; }
#HTMLReporter .resultsMenu, #HTMLReporter .resultsMenu a { background-color: #fff; color: #333333; }
#HTMLReporter.showDetails .summaryMenuItem { font-weight: normal; text-decoration: inherit; }
#HTMLReporter.showDetails .summaryMenuItem:hover { text-decoration: underline; }
#HTMLReporter.showDetails .detailsMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter.showDetails .summary { display: none; }
#HTMLReporter.showDetails #details { display: block; }
#HTMLReporter .summaryMenuItem { font-weight: bold; text-decoration: underline; }
#HTMLReporter .summary { margin-top: 14px; }
#HTMLReporter .summary .suite .suite, #HTMLReporter .summary .specSummary { margin-left: 14px; }
#HTMLReporter .summary .specSummary.passed a { color: #5e7d00; }
#HTMLReporter .summary .specSummary.failed a { color: #b03911; }
#HTMLReporter .description + .suite { margin-top: 0; }
#HTMLReporter .suite { margin-top: 14px; }
#HTMLReporter .suite a { color: #333333; }
#HTMLReporter #details .specDetail { margin-bottom: 28px; }
#HTMLReporter #details .specDetail .description { display: block; color: white; background-color: #b03911; }
#HTMLReporter .resultMessage { padding-top: 14px; color: #333333; }
#HTMLReporter .resultMessage span.result { display: block; }
#HTMLReporter .stackTrace { margin: 5px 0 0 0; max-height: 224px; overflow: auto; line-height: 18px; color: #666666; border: 1px solid #ddd; background: white; white-space: pre; }
#TrivialReporter { padding: 8px 13px; position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow-y: scroll; background-color: white; font-family: "Helvetica Neue Light", "Lucida Grande", "Calibri", "Arial", sans-serif; /*.resultMessage {*/ /*white-space: pre;*/ /*}*/ }
#TrivialReporter a:visited, #TrivialReporter a { color: #303; }
#TrivialReporter a:hover, #TrivialReporter a:active { color: blue; }
#TrivialReporter .run_spec { float: right; padding-right: 5px; font-size: .8em; text-decoration: none; }
#TrivialReporter .banner { color: #303; background-color: #fef; padding: 5px; }
#TrivialReporter .logo { float: left; font-size: 1.1em; padding-left: 5px; }
#TrivialReporter .logo .version { font-size: .6em; padding-left: 1em; }
#TrivialReporter .runner.running { background-color: yellow; }
#TrivialReporter .options { text-align: right; font-size: .8em; }
#TrivialReporter .suite { border: 1px outset gray; margin: 5px 0; padding-left: 1em; }
#TrivialReporter .suite .suite { margin: 5px; }
#TrivialReporter .suite.passed { background-color: #dfd; }
#TrivialReporter .suite.failed { background-color: #fdd; }
#TrivialReporter .spec { margin: 5px; padding-left: 1em; clear: both; }
#TrivialReporter .spec.failed, #TrivialReporter .spec.passed, #TrivialReporter .spec.skipped { padding-bottom: 5px; border: 1px solid gray; }
#TrivialReporter .spec.failed { background-color: #fbb; border-color: red; }
#TrivialReporter .spec.passed { background-color: #bfb; border-color: green; }
#TrivialReporter .spec.skipped { background-color: #bbb; }
#TrivialReporter .messages { border-left: 1px dashed gray; padding-left: 1em; padding-right: 1em; }
#TrivialReporter .passed { background-color: #cfc; display: none; }
#TrivialReporter .failed { background-color: #fbb; }
#TrivialReporter .skipped { color: #777; background-color: #eee; display: none; }
#TrivialReporter .resultMessage span.result { display: block; line-height: 2em; color: black; }
#TrivialReporter .resultMessage .mismatch { color: black; }
#TrivialReporter .stackTrace { white-space: pre; font-size: .8em; margin-left: 10px; max-height: 5em; overflow: auto; border: 1px inset red; padding: 1em; background: #eef; }
#TrivialReporter .finished-at { padding-left: 1em; font-size: .6em; }
#TrivialReporter.show-passed .passed, #TrivialReporter.show-skipped .skipped { display: block; }
#TrivialReporter #jasmine_content { position: fixed; right: 100%; }
#TrivialReporter .runner { border: 1px solid gray; display: block; margin: 5px 0; padding: 2px 0 2px 10px; }

File diff suppressed because it is too large Load Diff