Clean up JavaScript files to better follow coding standard.
Multiline conditionals must use braces. Semicolons are not optional. Review URL: http://codereview.chromium.org/8701006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10074 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
ad356bd5ad
commit
c7fccff9af
17
src/array.js
17
src/array.js
@ -328,8 +328,9 @@ function SimpleSlice(array, start_i, del_count, len, deleted_elements) {
|
||||
// would be the appropriate test. We follow KJS in consulting the
|
||||
// prototype.
|
||||
var current = array[index];
|
||||
if (!IS_UNDEFINED(current) || index in array)
|
||||
if (!IS_UNDEFINED(current) || index in array) {
|
||||
deleted_elements[i] = current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,12 +496,12 @@ function SparseReverse(array, len) {
|
||||
|
||||
if (j_complement <= i) {
|
||||
high = j;
|
||||
while (keys[--high_counter] == j);
|
||||
while (keys[--high_counter] == j) { }
|
||||
low = j_complement;
|
||||
}
|
||||
if (j_complement >= i) {
|
||||
low = i;
|
||||
while (keys[++low_counter] == i);
|
||||
while (keys[++low_counter] == i) { }
|
||||
high = len - i - 1;
|
||||
}
|
||||
|
||||
@ -576,10 +577,11 @@ function ArrayShift() {
|
||||
|
||||
var first = this[0];
|
||||
|
||||
if (IS_ARRAY(this))
|
||||
if (IS_ARRAY(this)) {
|
||||
SmartMove(this, 0, 1, len, 0);
|
||||
else
|
||||
} else {
|
||||
SimpleMove(this, 0, 1, len, 0);
|
||||
}
|
||||
|
||||
this.length = len - 1;
|
||||
|
||||
@ -596,10 +598,11 @@ function ArrayUnshift(arg1) { // length == 1
|
||||
var len = TO_UINT32(this.length);
|
||||
var num_arguments = %_ArgumentsLength();
|
||||
|
||||
if (IS_ARRAY(this))
|
||||
if (IS_ARRAY(this)) {
|
||||
SmartMove(this, 0, 0, len, num_arguments);
|
||||
else
|
||||
} else {
|
||||
SimpleMove(this, 0, 0, len, num_arguments);
|
||||
}
|
||||
|
||||
for (var i = 0; i < num_arguments; i++) {
|
||||
this[i] = %_Arguments(i);
|
||||
|
109
src/d8.js
109
src/d8.js
@ -26,10 +26,11 @@
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
String.prototype.startsWith = function (str) {
|
||||
if (str.length > this.length)
|
||||
if (str.length > this.length) {
|
||||
return false;
|
||||
}
|
||||
return this.substr(0, str.length) == str;
|
||||
}
|
||||
};
|
||||
|
||||
function log10(num) {
|
||||
return Math.log(num)/Math.log(10);
|
||||
@ -52,8 +53,9 @@ function GetCompletions(global, last, full) {
|
||||
for (var i = 0; i < parts.length; i++) {
|
||||
var part = parts[i];
|
||||
var next = current[part];
|
||||
if (!next)
|
||||
if (!next) {
|
||||
return [];
|
||||
}
|
||||
current = next;
|
||||
}
|
||||
var result = [];
|
||||
@ -63,8 +65,9 @@ function GetCompletions(global, last, full) {
|
||||
var properties = mirror.properties();
|
||||
for (var i = 0; i < properties.length; i++) {
|
||||
var name = properties[i].name();
|
||||
if (typeof name === 'string' && name.startsWith(last))
|
||||
if (typeof name === 'string' && name.startsWith(last)) {
|
||||
result.push(name);
|
||||
}
|
||||
}
|
||||
current = ToInspectableObject(current.__proto__);
|
||||
}
|
||||
@ -114,7 +117,7 @@ Debug.State = {
|
||||
displaySourceStartLine: -1,
|
||||
displaySourceEndLine: -1,
|
||||
currentSourceLine: -1
|
||||
}
|
||||
};
|
||||
var trace_compile = false; // Tracing all compile events?
|
||||
var trace_debug_json = false; // Tracing all debug json packets?
|
||||
var last_cmd_line = '';
|
||||
@ -150,7 +153,7 @@ function DebugMessageDetails(message) {
|
||||
}
|
||||
|
||||
function DebugEventDetails(response) {
|
||||
details = {text:'', running:false}
|
||||
details = {text:'', running:false};
|
||||
|
||||
// Get the running state.
|
||||
details.running = response.running();
|
||||
@ -217,7 +220,7 @@ function DebugEventDetails(response) {
|
||||
|
||||
case 'afterCompile':
|
||||
if (trace_compile) {
|
||||
result = 'Source ' + body.script.name + ' compiled:\n'
|
||||
result = 'Source ' + body.script.name + ' compiled:\n';
|
||||
var source = body.script.source;
|
||||
if (!(source[source.length - 1] == '\n')) {
|
||||
result += source;
|
||||
@ -237,7 +240,7 @@ function DebugEventDetails(response) {
|
||||
}
|
||||
|
||||
return details;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function SourceInfo(body) {
|
||||
@ -279,7 +282,7 @@ function SourceUnderline(source_text, position) {
|
||||
|
||||
// Return the source line text with the underline beneath.
|
||||
return source_text + '\n' + underline;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Converts a text command to a JSON request.
|
||||
@ -289,7 +292,7 @@ function DebugCommandToJSONRequest(cmd_line) {
|
||||
print("sending: '" + result + "'");
|
||||
}
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function DebugRequest(cmd_line) {
|
||||
@ -514,7 +517,7 @@ function DebugRequest(cmd_line) {
|
||||
|
||||
DebugRequest.prototype.JSONRequest = function() {
|
||||
return this.request_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function RequestPacket(command) {
|
||||
@ -536,14 +539,14 @@ RequestPacket.prototype.toJSONProtocol = function() {
|
||||
json += ',"arguments":';
|
||||
// Encode the arguments part.
|
||||
if (this.arguments.toJSONProtocol) {
|
||||
json += this.arguments.toJSONProtocol()
|
||||
json += this.arguments.toJSONProtocol();
|
||||
} else {
|
||||
json += SimpleObjectToJSON_(this.arguments);
|
||||
}
|
||||
}
|
||||
json += '}';
|
||||
return json;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugRequest.prototype.createRequest = function(command) {
|
||||
@ -1310,7 +1313,7 @@ DebugRequest.prototype.lolMakeListRequest =
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function extractObjId(args) {
|
||||
@ -1499,7 +1502,7 @@ DebugRequest.prototype.traceCommand_ = function(args) {
|
||||
} else {
|
||||
throw new Error('Invalid trace arguments.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Handle the help command.
|
||||
DebugRequest.prototype.helpCommand_ = function(args) {
|
||||
@ -1608,7 +1611,7 @@ DebugRequest.prototype.helpCommand_ = function(args) {
|
||||
print('');
|
||||
print('disconnect|exit|quit - disconnects and quits the debugger');
|
||||
print('help - prints this help information');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function formatHandleReference_(value) {
|
||||
@ -1623,7 +1626,7 @@ function formatHandleReference_(value) {
|
||||
function formatObject_(value, include_properties) {
|
||||
var result = '';
|
||||
result += formatHandleReference_(value);
|
||||
result += ', type: object'
|
||||
result += ', type: object';
|
||||
result += ', constructor ';
|
||||
var ctor = value.constructorFunctionValue();
|
||||
result += formatHandleReference_(ctor);
|
||||
@ -1943,7 +1946,7 @@ function roundNumber(num, length) {
|
||||
|
||||
// Convert a JSON response to text for display in a text based debugger.
|
||||
function DebugResponseDetails(response) {
|
||||
details = {text:'', running:false}
|
||||
details = { text: '', running: false };
|
||||
|
||||
try {
|
||||
if (!response.success()) {
|
||||
@ -2308,7 +2311,7 @@ function DebugResponseDetails(response) {
|
||||
}
|
||||
|
||||
return details;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -2334,7 +2337,7 @@ function ProtocolPackage(json) {
|
||||
*/
|
||||
ProtocolPackage.prototype.type = function() {
|
||||
return this.packet_.type;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2343,7 +2346,7 @@ ProtocolPackage.prototype.type = function() {
|
||||
*/
|
||||
ProtocolPackage.prototype.event = function() {
|
||||
return this.packet_.event;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2352,7 +2355,7 @@ ProtocolPackage.prototype.event = function() {
|
||||
*/
|
||||
ProtocolPackage.prototype.requestSeq = function() {
|
||||
return this.packet_.request_seq;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2361,27 +2364,27 @@ ProtocolPackage.prototype.requestSeq = function() {
|
||||
*/
|
||||
ProtocolPackage.prototype.running = function() {
|
||||
return this.packet_.running ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.success = function() {
|
||||
return this.packet_.success ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.message = function() {
|
||||
return this.packet_.message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.command = function() {
|
||||
return this.packet_.command;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.body = function() {
|
||||
return this.packet_.body;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.bodyValue = function(index) {
|
||||
@ -2390,12 +2393,12 @@ ProtocolPackage.prototype.bodyValue = function(index) {
|
||||
} else {
|
||||
return new ProtocolValue(this.packet_.body, this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.body = function() {
|
||||
return this.packet_.body;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.lookup = function(handle) {
|
||||
@ -2405,12 +2408,12 @@ ProtocolPackage.prototype.lookup = function(handle) {
|
||||
} else {
|
||||
return new ProtocolReference(handle);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolPackage.prototype.raw_json = function() {
|
||||
return this.raw_json_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function ProtocolValue(value, packet) {
|
||||
@ -2425,7 +2428,7 @@ function ProtocolValue(value, packet) {
|
||||
*/
|
||||
ProtocolValue.prototype.type = function() {
|
||||
return this.value_.type;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2434,7 +2437,7 @@ ProtocolValue.prototype.type = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.field = function(name) {
|
||||
return this.value_[name];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2444,7 +2447,7 @@ ProtocolValue.prototype.field = function(name) {
|
||||
ProtocolValue.prototype.isPrimitive = function() {
|
||||
return this.isUndefined() || this.isNull() || this.isBoolean() ||
|
||||
this.isNumber() || this.isString();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2453,7 +2456,7 @@ ProtocolValue.prototype.isPrimitive = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.handle = function() {
|
||||
return this.value_.handle;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2462,7 +2465,7 @@ ProtocolValue.prototype.handle = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.isUndefined = function() {
|
||||
return this.value_.type == 'undefined';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2471,7 +2474,7 @@ ProtocolValue.prototype.isUndefined = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.isNull = function() {
|
||||
return this.value_.type == 'null';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2480,7 +2483,7 @@ ProtocolValue.prototype.isNull = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.isBoolean = function() {
|
||||
return this.value_.type == 'boolean';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2489,7 +2492,7 @@ ProtocolValue.prototype.isBoolean = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.isNumber = function() {
|
||||
return this.value_.type == 'number';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2498,7 +2501,7 @@ ProtocolValue.prototype.isNumber = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.isString = function() {
|
||||
return this.value_.type == 'string';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2508,7 +2511,7 @@ ProtocolValue.prototype.isString = function() {
|
||||
ProtocolValue.prototype.isObject = function() {
|
||||
return this.value_.type == 'object' || this.value_.type == 'function' ||
|
||||
this.value_.type == 'error' || this.value_.type == 'regexp';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2518,7 +2521,7 @@ ProtocolValue.prototype.isObject = function() {
|
||||
ProtocolValue.prototype.constructorFunctionValue = function() {
|
||||
var ctor = this.value_.constructorFunction;
|
||||
return this.packet_.lookup(ctor.ref);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2528,7 +2531,7 @@ ProtocolValue.prototype.constructorFunctionValue = function() {
|
||||
ProtocolValue.prototype.protoObjectValue = function() {
|
||||
var proto = this.value_.protoObject;
|
||||
return this.packet_.lookup(proto.ref);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2537,7 +2540,7 @@ ProtocolValue.prototype.protoObjectValue = function() {
|
||||
*/
|
||||
ProtocolValue.prototype.propertyCount = function() {
|
||||
return this.value_.properties ? this.value_.properties.length : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2547,7 +2550,7 @@ ProtocolValue.prototype.propertyCount = function() {
|
||||
ProtocolValue.prototype.propertyName = function(index) {
|
||||
var property = this.value_.properties[index];
|
||||
return property.name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2562,7 +2565,7 @@ ProtocolValue.prototype.propertyIndex = function(name) {
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2572,7 +2575,7 @@ ProtocolValue.prototype.propertyIndex = function(name) {
|
||||
ProtocolValue.prototype.propertyValue = function(index) {
|
||||
var property = this.value_.properties[index];
|
||||
return this.packet_.lookup(property.ref);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2581,12 +2584,12 @@ ProtocolValue.prototype.propertyValue = function(index) {
|
||||
*/
|
||||
ProtocolValue.prototype.value = function() {
|
||||
return this.value_.value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolValue.prototype.valueString = function() {
|
||||
return this.value_.text;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function ProtocolReference(handle) {
|
||||
@ -2596,7 +2599,7 @@ function ProtocolReference(handle) {
|
||||
|
||||
ProtocolReference.prototype.handle = function() {
|
||||
return this.handle_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function MakeJSONPair_(name, value) {
|
||||
@ -2667,7 +2670,7 @@ function StringToJSON_(value) {
|
||||
// Convert control character to unicode escape sequence.
|
||||
return '\\u00' +
|
||||
'0' + // TODO %NumberToRadixString(Math.floor(mapped / 16), 16) +
|
||||
'0' // TODO %NumberToRadixString(mapped % 16, 16);
|
||||
'0'; // TODO %NumberToRadixString(mapped % 16, 16)
|
||||
})
|
||||
+ '"';
|
||||
}
|
||||
@ -2738,7 +2741,7 @@ function SimpleObjectToJSON_(object) {
|
||||
if (property_value === null) {
|
||||
property_value_json = 'null';
|
||||
} else if (typeof property_value.toJSONProtocol == 'function') {
|
||||
property_value_json = property_value.toJSONProtocol(true)
|
||||
property_value_json = property_value.toJSONProtocol(true);
|
||||
} else if (property_value.constructor.name == 'Array'){
|
||||
property_value_json = SimpleArrayToJSON_(property_value);
|
||||
} else {
|
||||
@ -2789,7 +2792,7 @@ function SimpleArrayToJSON_(array) {
|
||||
}
|
||||
var elem = array[i];
|
||||
if (elem.toJSONProtocol) {
|
||||
json += elem.toJSONProtocol(true)
|
||||
json += elem.toJSONProtocol(true);
|
||||
} else if (typeof(elem) === 'object') {
|
||||
json += SimpleObjectToJSON_(elem);
|
||||
} else if (typeof(elem) === 'boolean') {
|
||||
|
35
src/date.js
35
src/date.js
@ -304,7 +304,7 @@ function YearFromTime(t) {
|
||||
}
|
||||
|
||||
%DateYMDFromTime(t, ymd_from_time_cache);
|
||||
ymd_from_time_cached_time = t
|
||||
ymd_from_time_cached_time = t;
|
||||
}
|
||||
|
||||
return ymd_from_time_cache[0];
|
||||
@ -316,7 +316,7 @@ function MonthFromTime(t) {
|
||||
return $NaN;
|
||||
}
|
||||
%DateYMDFromTime(t, ymd_from_time_cache);
|
||||
ymd_from_time_cached_time = t
|
||||
ymd_from_time_cached_time = t;
|
||||
}
|
||||
|
||||
return ymd_from_time_cache[1];
|
||||
@ -329,7 +329,7 @@ function DateFromTime(t) {
|
||||
}
|
||||
|
||||
%DateYMDFromTime(t, ymd_from_time_cache);
|
||||
ymd_from_time_cached_time = t
|
||||
ymd_from_time_cached_time = t;
|
||||
}
|
||||
|
||||
return ymd_from_time_cache[2];
|
||||
@ -445,8 +445,9 @@ var Date_cache = {
|
||||
minutes = argc > 4 ? ToNumber(minutes) : 0;
|
||||
seconds = argc > 5 ? ToNumber(seconds) : 0;
|
||||
ms = argc > 6 ? ToNumber(ms) : 0;
|
||||
year = (!NUMBER_IS_NAN(year) && 0 <= TO_INTEGER(year) && TO_INTEGER(year) <= 99)
|
||||
? 1900 + TO_INTEGER(year) : year;
|
||||
year = (!NUMBER_IS_NAN(year) &&
|
||||
0 <= TO_INTEGER(year) &&
|
||||
TO_INTEGER(year) <= 99) ? 1900 + TO_INTEGER(year) : year;
|
||||
var day = MakeDay(year, month, date);
|
||||
var time = MakeTime(hours, minutes, seconds, ms);
|
||||
value = TimeClip(UTC(MakeDate(day, time)));
|
||||
@ -459,7 +460,8 @@ var Date_cache = {
|
||||
|
||||
|
||||
var WeekDays = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
||||
var Months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
var Months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
||||
|
||||
|
||||
function TwoDigitString(value) {
|
||||
@ -475,8 +477,10 @@ function DateString(time) {
|
||||
}
|
||||
|
||||
|
||||
var LongWeekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
var LongMonths = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
||||
var LongWeekDays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday',
|
||||
'Thursday', 'Friday', 'Saturday'];
|
||||
var LongMonths = ['January', 'February', 'March', 'April', 'May', 'June',
|
||||
'July', 'August', 'September', 'October', 'November', 'December'];
|
||||
|
||||
|
||||
function LongDateString(time) {
|
||||
@ -556,8 +560,9 @@ function DateUTC(year, month, date, hours, minutes, seconds, ms) {
|
||||
minutes = argc > 4 ? ToNumber(minutes) : 0;
|
||||
seconds = argc > 5 ? ToNumber(seconds) : 0;
|
||||
ms = argc > 6 ? ToNumber(ms) : 0;
|
||||
year = (!NUMBER_IS_NAN(year) && 0 <= TO_INTEGER(year) && TO_INTEGER(year) <= 99)
|
||||
? 1900 + TO_INTEGER(year) : year;
|
||||
year = (!NUMBER_IS_NAN(year) &&
|
||||
0 <= TO_INTEGER(year) &&
|
||||
TO_INTEGER(year) <= 99) ? 1900 + TO_INTEGER(year) : year;
|
||||
var day = MakeDay(year, month, date);
|
||||
var time = MakeTime(hours, minutes, seconds, ms);
|
||||
return %_SetValueOf(this, TimeClip(MakeDate(day, time)));
|
||||
@ -777,7 +782,10 @@ function DateSetTime(ms) {
|
||||
function DateSetMilliseconds(ms) {
|
||||
var t = LocalTime(DATE_VALUE(this));
|
||||
ms = ToNumber(ms);
|
||||
var time = MakeTime(HOUR_FROM_TIME(t), MIN_FROM_TIME(t), SEC_FROM_TIME(t), ms);
|
||||
var time = MakeTime(HOUR_FROM_TIME(t),
|
||||
MIN_FROM_TIME(t),
|
||||
SEC_FROM_TIME(t),
|
||||
ms);
|
||||
return %_SetValueOf(this, TimeClip(UTC(MakeDate(DAY(t), time))));
|
||||
}
|
||||
|
||||
@ -786,7 +794,10 @@ function DateSetMilliseconds(ms) {
|
||||
function DateSetUTCMilliseconds(ms) {
|
||||
var t = DATE_VALUE(this);
|
||||
ms = ToNumber(ms);
|
||||
var time = MakeTime(HOUR_FROM_TIME(t), MIN_FROM_TIME(t), SEC_FROM_TIME(t), ms);
|
||||
var time = MakeTime(HOUR_FROM_TIME(t),
|
||||
MIN_FROM_TIME(t),
|
||||
SEC_FROM_TIME(t),
|
||||
ms);
|
||||
return %_SetValueOf(this, TimeClip(MakeDate(DAY(t), time)));
|
||||
}
|
||||
|
||||
|
@ -286,7 +286,7 @@ ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) {
|
||||
copy.condition_ = this.condition_;
|
||||
copy.ignoreCount_ = this.ignoreCount_;
|
||||
return copy;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ScriptBreakPoint.prototype.number = function() {
|
||||
@ -335,13 +335,13 @@ ScriptBreakPoint.prototype.actual_locations = function() {
|
||||
locations.push(this.break_points_[i].actual_location);
|
||||
}
|
||||
return locations;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ScriptBreakPoint.prototype.update_positions = function(line, column) {
|
||||
this.line_ = line;
|
||||
this.column_ = column;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ScriptBreakPoint.prototype.hit_count = function() {
|
||||
@ -477,9 +477,10 @@ ScriptBreakPoint.prototype.clear = function () {
|
||||
// break points set in this script.
|
||||
function UpdateScriptBreakPoints(script) {
|
||||
for (var i = 0; i < script_break_points.length; i++) {
|
||||
if (script_break_points[i].type() == Debug.ScriptBreakPointType.ScriptName &&
|
||||
script_break_points[i].matchesScript(script)) {
|
||||
script_break_points[i].set(script);
|
||||
var break_point = script_break_points[i];
|
||||
if ((break_point.type() == Debug.ScriptBreakPointType.ScriptName) &&
|
||||
break_point.matchesScript(script)) {
|
||||
break_point.set(script);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -585,7 +586,7 @@ Debug.findFunctionSourceLocation = function(func, opt_line, opt_column) {
|
||||
var script = %FunctionGetScript(func);
|
||||
var script_offset = %FunctionGetScriptSourcePosition(func);
|
||||
return script.locationFromLine(opt_line, opt_column, script_offset);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Returns the character position in a script based on a line number and an
|
||||
@ -593,7 +594,7 @@ Debug.findFunctionSourceLocation = function(func, opt_line, opt_column) {
|
||||
Debug.findScriptSourcePosition = function(script, opt_line, opt_column) {
|
||||
var location = script.locationFromLine(opt_line, opt_column);
|
||||
return location ? location.position : null;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Debug.findBreakPoint = function(break_point_number, remove) {
|
||||
@ -627,7 +628,7 @@ Debug.findBreakPointActualLocations = function(break_point_number) {
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
Debug.setBreakPoint = function(func, opt_line, opt_column, opt_condition) {
|
||||
if (!IS_FUNCTION(func)) throw new Error('Parameters have wrong types.');
|
||||
@ -677,8 +678,9 @@ Debug.setBreakPointByScriptIdAndPosition = function(script_id, position,
|
||||
{
|
||||
break_point = MakeBreakPoint(position);
|
||||
break_point.setCondition(condition);
|
||||
if (!enabled)
|
||||
if (!enabled) {
|
||||
break_point.disable();
|
||||
}
|
||||
var scripts = this.scripts();
|
||||
for (var i = 0; i < scripts.length; i++) {
|
||||
if (script_id == scripts[i].id) {
|
||||
@ -771,7 +773,7 @@ Debug.findScriptBreakPoint = function(break_point_number, remove) {
|
||||
}
|
||||
}
|
||||
return script_break_point;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Sets a breakpoint in a script identified through id or name at the
|
||||
@ -799,7 +801,7 @@ Debug.setScriptBreakPoint = function(type, script_id_or_name,
|
||||
}
|
||||
|
||||
return script_break_point.number();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Debug.setScriptBreakPointById = function(script_id,
|
||||
@ -808,7 +810,7 @@ Debug.setScriptBreakPointById = function(script_id,
|
||||
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId,
|
||||
script_id, opt_line, opt_column,
|
||||
opt_condition, opt_groupId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Debug.setScriptBreakPointByName = function(script_name,
|
||||
@ -817,7 +819,7 @@ Debug.setScriptBreakPointByName = function(script_name,
|
||||
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptName,
|
||||
script_name, opt_line, opt_column,
|
||||
opt_condition, opt_groupId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Debug.setScriptBreakPointByRegExp = function(script_regexp,
|
||||
@ -826,7 +828,7 @@ Debug.setScriptBreakPointByRegExp = function(script_regexp,
|
||||
return this.setScriptBreakPoint(Debug.ScriptBreakPointType.ScriptRegExp,
|
||||
script_regexp, opt_line, opt_column,
|
||||
opt_condition, opt_groupId);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Debug.enableScriptBreakPoint = function(break_point_number) {
|
||||
@ -841,13 +843,15 @@ Debug.disableScriptBreakPoint = function(break_point_number) {
|
||||
};
|
||||
|
||||
|
||||
Debug.changeScriptBreakPointCondition = function(break_point_number, condition) {
|
||||
Debug.changeScriptBreakPointCondition = function(
|
||||
break_point_number, condition) {
|
||||
var script_break_point = this.findScriptBreakPoint(break_point_number, false);
|
||||
script_break_point.setCondition(condition);
|
||||
};
|
||||
|
||||
|
||||
Debug.changeScriptBreakPointIgnoreCount = function(break_point_number, ignoreCount) {
|
||||
Debug.changeScriptBreakPointIgnoreCount = function(
|
||||
break_point_number, ignoreCount) {
|
||||
if (ignoreCount < 0) {
|
||||
throw new Error('Invalid argument');
|
||||
}
|
||||
@ -858,12 +862,12 @@ Debug.changeScriptBreakPointIgnoreCount = function(break_point_number, ignoreCou
|
||||
|
||||
Debug.scriptBreakPoints = function() {
|
||||
return script_break_points;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Debug.clearStepping = function() {
|
||||
%ClearStepping();
|
||||
}
|
||||
};
|
||||
|
||||
Debug.setBreakOnException = function() {
|
||||
return %ChangeBreakOnException(Debug.ExceptionBreak.Caught, true);
|
||||
@ -940,7 +944,7 @@ ExecutionState.prototype.prepareStep = function(opt_action, opt_count) {
|
||||
var count = opt_count ? %ToNumber(opt_count) : 1;
|
||||
|
||||
return %PrepareStep(this.break_id, action, count);
|
||||
}
|
||||
};
|
||||
|
||||
ExecutionState.prototype.evaluateGlobal = function(source, disable_break,
|
||||
opt_additional_context) {
|
||||
@ -960,8 +964,9 @@ ExecutionState.prototype.threadCount = function() {
|
||||
ExecutionState.prototype.frame = function(opt_index) {
|
||||
// If no index supplied return the selected frame.
|
||||
if (opt_index == null) opt_index = this.selected_frame;
|
||||
if (opt_index < 0 || opt_index >= this.frameCount())
|
||||
if (opt_index < 0 || opt_index >= this.frameCount()) {
|
||||
throw new Error('Illegal frame index.');
|
||||
}
|
||||
return new FrameMirror(this.break_id, opt_index);
|
||||
};
|
||||
|
||||
@ -1088,12 +1093,12 @@ ExceptionEvent.prototype.eventType = function() {
|
||||
|
||||
ExceptionEvent.prototype.exception = function() {
|
||||
return this.exception_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ExceptionEvent.prototype.uncaught = function() {
|
||||
return this.uncaught_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ExceptionEvent.prototype.func = function() {
|
||||
@ -1185,7 +1190,7 @@ CompileEvent.prototype.toJSONProtocol = function() {
|
||||
o.body.script = this.script_;
|
||||
|
||||
return o.toJSONProtocol();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function MakeNewFunctionEvent(func) {
|
||||
@ -1241,7 +1246,7 @@ ScriptCollectedEvent.prototype.toJSONProtocol = function() {
|
||||
o.body = {};
|
||||
o.body.script = { id: this.id() };
|
||||
return o.toJSONProtocol();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function MakeScriptObject_(script, include_source) {
|
||||
@ -1258,18 +1263,18 @@ function MakeScriptObject_(script, include_source) {
|
||||
o.source = script.source();
|
||||
}
|
||||
return o;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function DebugCommandProcessor(exec_state, opt_is_running) {
|
||||
this.exec_state_ = exec_state;
|
||||
this.running_ = opt_is_running || false;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.processDebugRequest = function (request) {
|
||||
return this.processDebugJSONRequest(request);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
function ProtocolMessage(request) {
|
||||
@ -1297,13 +1302,13 @@ ProtocolMessage.prototype.setOption = function(name, value) {
|
||||
this.options_ = {};
|
||||
}
|
||||
this.options_[name] = value;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolMessage.prototype.failed = function(message) {
|
||||
this.success = false;
|
||||
this.message = message;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ProtocolMessage.prototype.toJSONProtocol = function() {
|
||||
@ -1351,7 +1356,7 @@ ProtocolMessage.prototype.toJSONProtocol = function() {
|
||||
}
|
||||
json.running = this.running;
|
||||
return JSON.stringify(json);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.createResponse = function(request) {
|
||||
@ -1359,7 +1364,8 @@ DebugCommandProcessor.prototype.createResponse = function(request) {
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request) {
|
||||
DebugCommandProcessor.prototype.processDebugJSONRequest = function(
|
||||
json_request) {
|
||||
var request; // Current request.
|
||||
var response; // Generated response.
|
||||
try {
|
||||
@ -1646,7 +1652,7 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
|
||||
|
||||
// Add the break point number to the response.
|
||||
response.body = { type: type,
|
||||
breakpoint: break_point_number }
|
||||
breakpoint: break_point_number };
|
||||
|
||||
// Add break point information to the response.
|
||||
if (break_point instanceof ScriptBreakPoint) {
|
||||
@ -1660,7 +1666,8 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
|
||||
response.body.type = 'scriptRegExp';
|
||||
response.body.script_regexp = break_point.script_regexp_object().source;
|
||||
} else {
|
||||
throw new Error("Internal error: Unexpected breakpoint type: " + break_point.type());
|
||||
throw new Error("Internal error: Unexpected breakpoint type: " +
|
||||
break_point.type());
|
||||
}
|
||||
response.body.line = break_point.line();
|
||||
response.body.column = break_point.column();
|
||||
@ -1672,7 +1679,8 @@ DebugCommandProcessor.prototype.setBreakPointRequest_ =
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(request, response) {
|
||||
DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(
|
||||
request, response) {
|
||||
// Check for legal request.
|
||||
if (!request.arguments) {
|
||||
response.failed('Missing arguments');
|
||||
@ -1709,10 +1717,11 @@ DebugCommandProcessor.prototype.changeBreakPointRequest_ = function(request, res
|
||||
if (!IS_UNDEFINED(ignoreCount)) {
|
||||
Debug.changeBreakPointIgnoreCount(break_point, ignoreCount);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(request, response) {
|
||||
DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(
|
||||
request, response) {
|
||||
// Check for legal request.
|
||||
if (!request.arguments) {
|
||||
response.failed('Missing arguments');
|
||||
@ -1743,10 +1752,11 @@ DebugCommandProcessor.prototype.clearBreakPointGroupRequest_ = function(request,
|
||||
|
||||
// Add the cleared break point numbers to the response.
|
||||
response.body = { breakpoints: cleared_break_points };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(request, response) {
|
||||
DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(
|
||||
request, response) {
|
||||
// Check for legal request.
|
||||
if (!request.arguments) {
|
||||
response.failed('Missing arguments');
|
||||
@ -1766,11 +1776,12 @@ DebugCommandProcessor.prototype.clearBreakPointRequest_ = function(request, resp
|
||||
Debug.clearBreakPoint(break_point);
|
||||
|
||||
// Add the cleared break point number to the response.
|
||||
response.body = { breakpoint: break_point }
|
||||
}
|
||||
response.body = { breakpoint: break_point };
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(request, response) {
|
||||
DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(
|
||||
request, response) {
|
||||
var array = [];
|
||||
for (var i = 0; i < script_break_points.length; i++) {
|
||||
var break_point = script_break_points[i];
|
||||
@ -1785,7 +1796,7 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(request, resp
|
||||
condition: break_point.condition(),
|
||||
ignoreCount: break_point.ignoreCount(),
|
||||
actual_locations: break_point.actual_locations()
|
||||
}
|
||||
};
|
||||
|
||||
if (break_point.type() == Debug.ScriptBreakPointType.ScriptId) {
|
||||
description.type = 'scriptId';
|
||||
@ -1797,7 +1808,8 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(request, resp
|
||||
description.type = 'scriptRegExp';
|
||||
description.script_regexp = break_point.script_regexp_object().source;
|
||||
} else {
|
||||
throw new Error("Internal error: Unexpected breakpoint type: " + break_point.type());
|
||||
throw new Error("Internal error: Unexpected breakpoint type: " +
|
||||
break_point.type());
|
||||
}
|
||||
array.push(description);
|
||||
}
|
||||
@ -1806,15 +1818,15 @@ DebugCommandProcessor.prototype.listBreakpointsRequest_ = function(request, resp
|
||||
breakpoints: array,
|
||||
breakOnExceptions: Debug.isBreakOnException(),
|
||||
breakOnUncaughtExceptions: Debug.isBreakOnUncaughtException()
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.disconnectRequest_ =
|
||||
function(request, response) {
|
||||
Debug.disableAllBreakPoints();
|
||||
this.continueRequest_(request, response);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.setExceptionBreakRequest_ =
|
||||
@ -1859,10 +1871,11 @@ DebugCommandProcessor.prototype.setExceptionBreakRequest_ =
|
||||
|
||||
// Add the cleared break point number to the response.
|
||||
response.body = { 'type': type, 'enabled': enabled };
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response) {
|
||||
DebugCommandProcessor.prototype.backtraceRequest_ = function(
|
||||
request, response) {
|
||||
// Get the number of frames.
|
||||
var total_frames = this.exec_state_.frameCount();
|
||||
|
||||
@ -1870,12 +1883,12 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response)
|
||||
if (total_frames == 0) {
|
||||
response.body = {
|
||||
totalFrames: total_frames
|
||||
}
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
||||
// Default frame range to include in backtrace.
|
||||
var from_index = 0
|
||||
var from_index = 0;
|
||||
var to_index = kDefaultBacktraceLength;
|
||||
|
||||
// Get the range from the arguments.
|
||||
@ -1888,7 +1901,7 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response)
|
||||
}
|
||||
if (request.arguments.bottom) {
|
||||
var tmp_index = total_frames - from_index;
|
||||
from_index = total_frames - to_index
|
||||
from_index = total_frames - to_index;
|
||||
to_index = tmp_index;
|
||||
}
|
||||
if (from_index < 0 || to_index < 0) {
|
||||
@ -1914,7 +1927,7 @@ DebugCommandProcessor.prototype.backtraceRequest_ = function(request, response)
|
||||
toFrame: to_index,
|
||||
totalFrames: total_frames,
|
||||
frames: frames
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -1938,8 +1951,8 @@ DebugCommandProcessor.prototype.frameRequest_ = function(request, response) {
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.frameForScopeRequest_ = function(request) {
|
||||
// Get the frame for which the scope or scopes are requested. With no frameNumber
|
||||
// argument use the currently selected frame.
|
||||
// Get the frame for which the scope or scopes are requested.
|
||||
// With no frameNumber argument use the currently selected frame.
|
||||
if (request.arguments && !IS_UNDEFINED(request.arguments.frameNumber)) {
|
||||
frame_index = request.arguments.frameNumber;
|
||||
if (frame_index < 0 || this.exec_state_.frameCount() <= frame_index) {
|
||||
@ -1949,7 +1962,7 @@ DebugCommandProcessor.prototype.frameForScopeRequest_ = function(request) {
|
||||
} else {
|
||||
return this.exec_state_.frame();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.scopesRequest_ = function(request, response) {
|
||||
@ -1972,7 +1985,7 @@ DebugCommandProcessor.prototype.scopesRequest_ = function(request, response) {
|
||||
toScope: total_scopes,
|
||||
totalScopes: total_scopes,
|
||||
scopes: scopes
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -2217,7 +2230,8 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) {
|
||||
if (!IS_UNDEFINED(request.arguments.types)) {
|
||||
types = %ToNumber(request.arguments.types);
|
||||
if (isNaN(types) || types < 0) {
|
||||
return response.failed('Invalid types "' + request.arguments.types + '"');
|
||||
return response.failed('Invalid types "' +
|
||||
request.arguments.types + '"');
|
||||
}
|
||||
}
|
||||
|
||||
@ -2286,7 +2300,7 @@ DebugCommandProcessor.prototype.threadsRequest_ = function(request, response) {
|
||||
var details = %GetThreadDetails(this.exec_state_.break_id, i);
|
||||
var thread_info = { current: details[0],
|
||||
id: details[1]
|
||||
}
|
||||
};
|
||||
threads.push(thread_info);
|
||||
}
|
||||
|
||||
@ -2294,7 +2308,7 @@ DebugCommandProcessor.prototype.threadsRequest_ = function(request, response) {
|
||||
response.body = {
|
||||
totalThreads: total_threads,
|
||||
threads: threads
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -2306,7 +2320,7 @@ DebugCommandProcessor.prototype.suspendRequest_ = function(request, response) {
|
||||
DebugCommandProcessor.prototype.versionRequest_ = function(request, response) {
|
||||
response.body = {
|
||||
V8Version: %GetV8Version()
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -2322,7 +2336,8 @@ DebugCommandProcessor.prototype.profileRequest_ = function(request, response) {
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response) {
|
||||
DebugCommandProcessor.prototype.changeLiveRequest_ = function(
|
||||
request, response) {
|
||||
if (!Debug.LiveEdit) {
|
||||
return response.failed('LiveEdit feature is not supported');
|
||||
}
|
||||
@ -2393,7 +2408,7 @@ DebugCommandProcessor.prototype.debuggerFlagsRequest_ = function(request,
|
||||
response.body.flags.push({ name: name, value: value });
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.v8FlagsRequest_ = function(request, response) {
|
||||
@ -2499,7 +2514,7 @@ DebugCommandProcessor.prototype.lolPrintRequest_ = function(request, response) {
|
||||
// running.
|
||||
DebugCommandProcessor.prototype.isRunning = function() {
|
||||
return this.running_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
DebugCommandProcessor.prototype.systemBreak = function(cmd, args) {
|
||||
@ -2515,7 +2530,7 @@ function NumberToHex8Str(n) {
|
||||
n = n >>> 4;
|
||||
}
|
||||
return r;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -2591,7 +2606,7 @@ function ValueToProtocolValue_(value, mirror_serializer) {
|
||||
case 'string':
|
||||
case 'number':
|
||||
json = value;
|
||||
break
|
||||
break;
|
||||
|
||||
default:
|
||||
json = null;
|
||||
|
@ -345,4 +345,4 @@ function SetUpJSON() {
|
||||
));
|
||||
}
|
||||
|
||||
SetUpJSON()
|
||||
SetUpJSON();
|
||||
|
@ -325,9 +325,10 @@ Debug.LiveEdit = new function() {
|
||||
if (old_node.children[i].live_shared_function_infos) {
|
||||
old_node.children[i].live_shared_function_infos.
|
||||
forEach(function (old_child_info) {
|
||||
%LiveEditReplaceRefToNestedFunction(old_info.info,
|
||||
corresponding_child_info,
|
||||
old_child_info.info);
|
||||
%LiveEditReplaceRefToNestedFunction(
|
||||
old_info.info,
|
||||
corresponding_child_info,
|
||||
old_child_info.info);
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -381,7 +382,7 @@ Debug.LiveEdit = new function() {
|
||||
position: break_point_position,
|
||||
line: break_point.line(),
|
||||
column: break_point.column()
|
||||
}
|
||||
};
|
||||
break_point_old_positions.push(old_position_description);
|
||||
}
|
||||
|
||||
@ -418,7 +419,7 @@ Debug.LiveEdit = new function() {
|
||||
position: updated_position,
|
||||
line: new_location.line,
|
||||
column: new_location.column
|
||||
}
|
||||
};
|
||||
|
||||
break_point.set(original_script);
|
||||
|
||||
@ -428,7 +429,7 @@ Debug.LiveEdit = new function() {
|
||||
new_positions: new_position_description
|
||||
} );
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -465,7 +466,7 @@ Debug.LiveEdit = new function() {
|
||||
}
|
||||
PosTranslator.prototype.GetChunks = function() {
|
||||
return this.chunks;
|
||||
}
|
||||
};
|
||||
|
||||
PosTranslator.prototype.Translate = function(pos, inside_chunk_handler) {
|
||||
var array = this.chunks;
|
||||
@ -492,18 +493,18 @@ Debug.LiveEdit = new function() {
|
||||
inside_chunk_handler = PosTranslator.DefaultInsideChunkHandler;
|
||||
}
|
||||
return inside_chunk_handler(pos, chunk);
|
||||
}
|
||||
};
|
||||
|
||||
PosTranslator.DefaultInsideChunkHandler = function(pos, diff_chunk) {
|
||||
Assert(false, "Cannot translate position in changed area");
|
||||
}
|
||||
};
|
||||
|
||||
PosTranslator.ShiftWithTopInsideChunkHandler =
|
||||
function(pos, diff_chunk) {
|
||||
// We carelessly do not check whether we stay inside the chunk after
|
||||
// translation.
|
||||
return pos - diff_chunk.pos1 + diff_chunk.pos2;
|
||||
}
|
||||
};
|
||||
|
||||
var FunctionStatus = {
|
||||
// No change to function or its inner functions; however its positions
|
||||
@ -517,7 +518,7 @@ Debug.LiveEdit = new function() {
|
||||
CHANGED: "changed",
|
||||
// Function is changed but cannot be patched.
|
||||
DAMAGED: "damaged"
|
||||
}
|
||||
};
|
||||
|
||||
function CodeInfoTreeNode(code_info, children, array_index) {
|
||||
this.info = code_info;
|
||||
@ -585,14 +586,14 @@ Debug.LiveEdit = new function() {
|
||||
var chunk_it = new function() {
|
||||
var chunk_index = 0;
|
||||
var pos_diff = 0;
|
||||
this.current = function() { return chunks[chunk_index]; }
|
||||
this.current = function() { return chunks[chunk_index]; };
|
||||
this.next = function() {
|
||||
var chunk = chunks[chunk_index];
|
||||
pos_diff = chunk.pos2 + chunk.len2 - (chunk.pos1 + chunk.len1);
|
||||
chunk_index++;
|
||||
}
|
||||
this.done = function() { return chunk_index >= chunks.length; }
|
||||
this.TranslatePos = function(pos) { return pos + pos_diff; }
|
||||
};
|
||||
this.done = function() { return chunk_index >= chunks.length; };
|
||||
this.TranslatePos = function(pos) { return pos + pos_diff; };
|
||||
};
|
||||
|
||||
// A recursive function that processes internals of a function and all its
|
||||
@ -946,16 +947,16 @@ Debug.LiveEdit = new function() {
|
||||
BLOCKED_ON_OTHER_STACK: 3,
|
||||
BLOCKED_UNDER_NATIVE_CODE: 4,
|
||||
REPLACED_ON_ACTIVE_STACK: 5
|
||||
}
|
||||
};
|
||||
|
||||
FunctionPatchabilityStatus.SymbolName = function(code) {
|
||||
var enum = FunctionPatchabilityStatus;
|
||||
for (name in enum) {
|
||||
if (enum[name] == code) {
|
||||
var enumeration = FunctionPatchabilityStatus;
|
||||
for (name in enumeration) {
|
||||
if (enumeration[name] == code) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// A logical failure in liveedit process. This means that change_log
|
||||
@ -968,7 +969,7 @@ Debug.LiveEdit = new function() {
|
||||
|
||||
Failure.prototype.toString = function() {
|
||||
return "LiveEdit Failure: " + this.message;
|
||||
}
|
||||
};
|
||||
|
||||
// A testing entry.
|
||||
function GetPcFromSourcePos(func, source_pos) {
|
||||
@ -1078,5 +1079,5 @@ Debug.LiveEdit = new function() {
|
||||
PosTranslator: PosTranslator,
|
||||
CompareStrings: CompareStrings,
|
||||
ApplySingleChunkPatch: ApplySingleChunkPatch
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
@ -394,7 +394,7 @@ function ScriptLocationFromPosition(position,
|
||||
}
|
||||
|
||||
return new SourceLocation(this, position, line, column, start, end);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -424,7 +424,7 @@ function ScriptLocationFromLine(opt_line, opt_column, opt_offset_position) {
|
||||
// resource.
|
||||
var column = opt_column || 0;
|
||||
if (line == 0) {
|
||||
column -= this.column_offset
|
||||
column -= this.column_offset;
|
||||
}
|
||||
|
||||
var offset_position = opt_offset_position || 0;
|
||||
@ -439,7 +439,8 @@ function ScriptLocationFromLine(opt_line, opt_column, opt_offset_position) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return this.locationFromPosition(this.line_ends[offset_line + line - 1] + 1 + column); // line > 0 here.
|
||||
return this.locationFromPosition(
|
||||
this.line_ends[offset_line + line - 1] + 1 + column); // line > 0 here.
|
||||
}
|
||||
}
|
||||
|
||||
@ -455,8 +456,10 @@ function ScriptLocationFromLine(opt_line, opt_column, opt_offset_position) {
|
||||
* invalid
|
||||
*/
|
||||
function ScriptSourceSlice(opt_from_line, opt_to_line) {
|
||||
var from_line = IS_UNDEFINED(opt_from_line) ? this.line_offset : opt_from_line;
|
||||
var to_line = IS_UNDEFINED(opt_to_line) ? this.line_offset + this.lineCount() : opt_to_line
|
||||
var from_line = IS_UNDEFINED(opt_from_line) ? this.line_offset
|
||||
: opt_from_line;
|
||||
var to_line = IS_UNDEFINED(opt_to_line) ? this.line_offset + this.lineCount()
|
||||
: opt_to_line;
|
||||
|
||||
// Adjust according to the offset within the resource.
|
||||
from_line -= this.line_offset;
|
||||
@ -476,8 +479,10 @@ function ScriptSourceSlice(opt_from_line, opt_to_line) {
|
||||
var to_position = to_line == 0 ? 0 : line_ends[to_line - 1] + 1;
|
||||
|
||||
// Return a source slice with line numbers re-adjusted to the resource.
|
||||
return new SourceSlice(this, from_line + this.line_offset, to_line + this.line_offset,
|
||||
from_position, to_position);
|
||||
return new SourceSlice(this,
|
||||
from_line + this.line_offset,
|
||||
to_line + this.line_offset,
|
||||
from_position, to_position);
|
||||
}
|
||||
|
||||
|
||||
@ -510,7 +515,7 @@ function ScriptSourceLine(opt_line) {
|
||||
function ScriptLineCount() {
|
||||
// Return number of source lines.
|
||||
return this.line_ends.length;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -575,10 +580,10 @@ SetUpLockedPrototype(Script,
|
||||
* position : position within the source
|
||||
* start : position of start of source context (inclusive)
|
||||
* end : position of end of source context (not inclusive)
|
||||
* Source text for the source context is the character interval [start, end[. In
|
||||
* most cases end will point to a newline character. It might point just past
|
||||
* the final position of the source if the last source line does not end with a
|
||||
* newline character.
|
||||
* Source text for the source context is the character interval
|
||||
* [start, end[. In most cases end will point to a newline character.
|
||||
* It might point just past the final position of the source if the last
|
||||
* source line does not end with a newline character.
|
||||
* @param {Script} script The Script object for which this is a location
|
||||
* @param {number} position Source position for the location
|
||||
* @param {number} line The line number for the location
|
||||
@ -645,7 +650,7 @@ function SourceLocationRestrict(opt_limit, opt_before) {
|
||||
this.end = this.start + limit;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@ -654,8 +659,11 @@ function SourceLocationRestrict(opt_limit, opt_before) {
|
||||
* Source text for this location.
|
||||
*/
|
||||
function SourceLocationSourceText() {
|
||||
return %_CallFunction(this.script.source, this.start, this.end, StringSubstring);
|
||||
};
|
||||
return %_CallFunction(this.script.source,
|
||||
this.start,
|
||||
this.end,
|
||||
StringSubstring);
|
||||
}
|
||||
|
||||
|
||||
SetUpLockedPrototype(SourceLocation,
|
||||
@ -663,7 +671,7 @@ SetUpLockedPrototype(SourceLocation,
|
||||
$Array(
|
||||
"restrict", SourceLocationRestrict,
|
||||
"sourceText", SourceLocationSourceText
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -703,7 +711,7 @@ function SourceSliceSourceText() {
|
||||
this.from_position,
|
||||
this.to_position,
|
||||
StringSubstring);
|
||||
};
|
||||
}
|
||||
|
||||
SetUpLockedPrototype(SourceSlice,
|
||||
$Array("script", "from_line", "to_line", "from_position", "to_position"),
|
||||
@ -762,7 +770,7 @@ function CallSite(receiver, fun, pos) {
|
||||
|
||||
function CallSiteGetThis() {
|
||||
return this.receiver;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetTypeName() {
|
||||
var constructor = this.receiver.constructor;
|
||||
@ -774,33 +782,33 @@ function CallSiteGetTypeName() {
|
||||
return %_CallFunction(this.receiver, ObjectToString);
|
||||
}
|
||||
return constructorName;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteIsToplevel() {
|
||||
if (this.receiver == null) {
|
||||
return true;
|
||||
}
|
||||
return IS_GLOBAL(this.receiver);
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteIsEval() {
|
||||
var script = %FunctionGetScript(this.fun);
|
||||
return script && script.compilation_type == COMPILATION_TYPE_EVAL;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetEvalOrigin() {
|
||||
var script = %FunctionGetScript(this.fun);
|
||||
return FormatEvalOrigin(script);
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetScriptNameOrSourceURL() {
|
||||
var script = %FunctionGetScript(this.fun);
|
||||
return script ? script.nameOrSourceURL() : null;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetFunction() {
|
||||
return this.fun;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetFunctionName() {
|
||||
// See if the function knows its own name
|
||||
@ -816,15 +824,19 @@ function CallSiteGetFunctionName() {
|
||||
return "eval";
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetMethodName() {
|
||||
// See if we can find a unique property on the receiver that holds
|
||||
// this function.
|
||||
var ownName = this.fun.name;
|
||||
if (ownName && this.receiver &&
|
||||
(%_CallFunction(this.receiver, ownName, ObjectLookupGetter) === this.fun ||
|
||||
%_CallFunction(this.receiver, ownName, ObjectLookupSetter) === this.fun ||
|
||||
(%_CallFunction(this.receiver,
|
||||
ownName,
|
||||
ObjectLookupGetter) === this.fun ||
|
||||
%_CallFunction(this.receiver,
|
||||
ownName,
|
||||
ObjectLookupSetter) === this.fun ||
|
||||
this.receiver[ownName] === this.fun)) {
|
||||
// To handle DontEnum properties we guess that the method has
|
||||
// the same name as the function.
|
||||
@ -834,7 +846,8 @@ function CallSiteGetMethodName() {
|
||||
for (var prop in this.receiver) {
|
||||
if (this.receiver.__lookupGetter__(prop) === this.fun ||
|
||||
this.receiver.__lookupSetter__(prop) === this.fun ||
|
||||
(!this.receiver.__lookupGetter__(prop) && this.receiver[prop] === this.fun)) {
|
||||
(!this.receiver.__lookupGetter__(prop) &&
|
||||
this.receiver[prop] === this.fun)) {
|
||||
// If we find more than one match bail out to avoid confusion.
|
||||
if (name) {
|
||||
return null;
|
||||
@ -846,12 +859,12 @@ function CallSiteGetMethodName() {
|
||||
return name;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetFileName() {
|
||||
var script = %FunctionGetScript(this.fun);
|
||||
return script ? script.name : null;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetLineNumber() {
|
||||
if (this.pos == -1) {
|
||||
@ -863,7 +876,7 @@ function CallSiteGetLineNumber() {
|
||||
location = script.locationFromPosition(this.pos, true);
|
||||
}
|
||||
return location ? location.line + 1 : null;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetColumnNumber() {
|
||||
if (this.pos == -1) {
|
||||
@ -875,16 +888,16 @@ function CallSiteGetColumnNumber() {
|
||||
location = script.locationFromPosition(this.pos, true);
|
||||
}
|
||||
return location ? location.column + 1: null;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteIsNative() {
|
||||
var script = %FunctionGetScript(this.fun);
|
||||
return script ? (script.type == TYPE_NATIVE) : false;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteGetPosition() {
|
||||
return this.pos;
|
||||
};
|
||||
}
|
||||
|
||||
function CallSiteIsConstructor() {
|
||||
var constructor = this.receiver ? this.receiver.constructor : null;
|
||||
@ -892,7 +905,7 @@ function CallSiteIsConstructor() {
|
||||
return false;
|
||||
}
|
||||
return this.fun === constructor;
|
||||
};
|
||||
}
|
||||
|
||||
SetUpLockedPrototype(CallSite, $Array("receiver", "fun", "pos"), $Array(
|
||||
"getThis", CallSiteGetThis,
|
||||
@ -935,12 +948,13 @@ function FormatEvalOrigin(script) {
|
||||
// eval script originated from "real" source.
|
||||
if (eval_from_script.name) {
|
||||
eval_origin += " (" + eval_from_script.name;
|
||||
var location = eval_from_script.locationFromPosition(script.eval_from_script_position, true);
|
||||
var location = eval_from_script.locationFromPosition(
|
||||
script.eval_from_script_position, true);
|
||||
if (location) {
|
||||
eval_origin += ":" + (location.line + 1);
|
||||
eval_origin += ":" + (location.column + 1);
|
||||
}
|
||||
eval_origin += ")"
|
||||
eval_origin += ")";
|
||||
} else {
|
||||
eval_origin += " (unknown source)";
|
||||
}
|
||||
@ -948,7 +962,7 @@ function FormatEvalOrigin(script) {
|
||||
}
|
||||
|
||||
return eval_origin;
|
||||
};
|
||||
}
|
||||
|
||||
function FormatSourcePosition(frame) {
|
||||
var fileName;
|
||||
@ -957,8 +971,9 @@ function FormatSourcePosition(frame) {
|
||||
fileLocation = "native";
|
||||
} else if (frame.isEval()) {
|
||||
fileName = frame.getScriptNameOrSourceURL();
|
||||
if (!fileName)
|
||||
if (!fileName) {
|
||||
fileLocation = frame.getEvalOrigin();
|
||||
}
|
||||
} else {
|
||||
fileName = frame.getFileName();
|
||||
}
|
||||
@ -1067,7 +1082,7 @@ function captureStackTrace(obj, cons_opt) {
|
||||
DefineOneShotAccessor(obj, 'stack', function (obj) {
|
||||
return FormatRawStackTrace(obj, raw_stack);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function SetUpError() {
|
||||
@ -1157,7 +1172,7 @@ function ErrorToStringDetectCycle(error) {
|
||||
if (!%PushIfAbsent(visited_errors, error)) throw cyclic_error_marker;
|
||||
try {
|
||||
var type = error.type;
|
||||
var name = error.name
|
||||
var name = error.name;
|
||||
name = IS_UNDEFINED(name) ? "Error" : TO_STRING_INLINE(name);
|
||||
var message = error.message;
|
||||
var hasMessage = %_CallFunction(error, "message", ObjectHasOwnProperty);
|
||||
|
@ -225,7 +225,7 @@ ScopeType = { Global: 0,
|
||||
*/
|
||||
function Mirror(type) {
|
||||
this.type_ = type;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Mirror.prototype.type = function() {
|
||||
@ -239,7 +239,7 @@ Mirror.prototype.type = function() {
|
||||
*/
|
||||
Mirror.prototype.isValue = function() {
|
||||
return this instanceof ValueMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -248,7 +248,7 @@ Mirror.prototype.isValue = function() {
|
||||
*/
|
||||
Mirror.prototype.isUndefined = function() {
|
||||
return this instanceof UndefinedMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -257,7 +257,7 @@ Mirror.prototype.isUndefined = function() {
|
||||
*/
|
||||
Mirror.prototype.isNull = function() {
|
||||
return this instanceof NullMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -266,7 +266,7 @@ Mirror.prototype.isNull = function() {
|
||||
*/
|
||||
Mirror.prototype.isBoolean = function() {
|
||||
return this instanceof BooleanMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -275,7 +275,7 @@ Mirror.prototype.isBoolean = function() {
|
||||
*/
|
||||
Mirror.prototype.isNumber = function() {
|
||||
return this instanceof NumberMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -284,7 +284,7 @@ Mirror.prototype.isNumber = function() {
|
||||
*/
|
||||
Mirror.prototype.isString = function() {
|
||||
return this instanceof StringMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -293,7 +293,7 @@ Mirror.prototype.isString = function() {
|
||||
*/
|
||||
Mirror.prototype.isObject = function() {
|
||||
return this instanceof ObjectMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -302,7 +302,7 @@ Mirror.prototype.isObject = function() {
|
||||
*/
|
||||
Mirror.prototype.isFunction = function() {
|
||||
return this instanceof FunctionMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -311,7 +311,7 @@ Mirror.prototype.isFunction = function() {
|
||||
*/
|
||||
Mirror.prototype.isUnresolvedFunction = function() {
|
||||
return this instanceof UnresolvedFunctionMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -320,7 +320,7 @@ Mirror.prototype.isUnresolvedFunction = function() {
|
||||
*/
|
||||
Mirror.prototype.isArray = function() {
|
||||
return this instanceof ArrayMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -329,7 +329,7 @@ Mirror.prototype.isArray = function() {
|
||||
*/
|
||||
Mirror.prototype.isDate = function() {
|
||||
return this instanceof DateMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -338,7 +338,7 @@ Mirror.prototype.isDate = function() {
|
||||
*/
|
||||
Mirror.prototype.isRegExp = function() {
|
||||
return this instanceof RegExpMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -347,7 +347,7 @@ Mirror.prototype.isRegExp = function() {
|
||||
*/
|
||||
Mirror.prototype.isError = function() {
|
||||
return this instanceof ErrorMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -356,7 +356,7 @@ Mirror.prototype.isError = function() {
|
||||
*/
|
||||
Mirror.prototype.isProperty = function() {
|
||||
return this instanceof PropertyMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -365,7 +365,7 @@ Mirror.prototype.isProperty = function() {
|
||||
*/
|
||||
Mirror.prototype.isFrame = function() {
|
||||
return this instanceof FrameMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -374,7 +374,7 @@ Mirror.prototype.isFrame = function() {
|
||||
*/
|
||||
Mirror.prototype.isScript = function() {
|
||||
return this instanceof ScriptMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -383,7 +383,7 @@ Mirror.prototype.isScript = function() {
|
||||
*/
|
||||
Mirror.prototype.isContext = function() {
|
||||
return this instanceof ContextMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -392,7 +392,7 @@ Mirror.prototype.isContext = function() {
|
||||
*/
|
||||
Mirror.prototype.isScope = function() {
|
||||
return this instanceof ScopeMirror;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -400,7 +400,7 @@ Mirror.prototype.isScope = function() {
|
||||
*/
|
||||
Mirror.prototype.allocateHandle_ = function() {
|
||||
this.handle_ = next_handle_++;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -409,13 +409,13 @@ Mirror.prototype.allocateHandle_ = function() {
|
||||
*/
|
||||
Mirror.prototype.allocateTransientHandle_ = function() {
|
||||
this.handle_ = next_transient_handle_--;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Mirror.prototype.toText = function() {
|
||||
// Simpel to text which is used when on specialization in subclass.
|
||||
return "#<" + this.constructor.name + ">";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -480,7 +480,7 @@ inherits(UndefinedMirror, ValueMirror);
|
||||
|
||||
UndefinedMirror.prototype.toText = function() {
|
||||
return 'undefined';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -496,7 +496,7 @@ inherits(NullMirror, ValueMirror);
|
||||
|
||||
NullMirror.prototype.toText = function() {
|
||||
return 'null';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -513,7 +513,7 @@ inherits(BooleanMirror, ValueMirror);
|
||||
|
||||
BooleanMirror.prototype.toText = function() {
|
||||
return this.value_ ? 'true' : 'false';
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -530,7 +530,7 @@ inherits(NumberMirror, ValueMirror);
|
||||
|
||||
NumberMirror.prototype.toText = function() {
|
||||
return %NumberToString(this.value_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -555,11 +555,11 @@ StringMirror.prototype.getTruncatedValue = function(maxLength) {
|
||||
'... (length: ' + this.length() + ')';
|
||||
}
|
||||
return this.value_;
|
||||
}
|
||||
};
|
||||
|
||||
StringMirror.prototype.toText = function() {
|
||||
return this.getTruncatedValue(kMaxProtocolStringLength);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -898,7 +898,7 @@ FunctionMirror.prototype.constructedBy = function(opt_max_instances) {
|
||||
|
||||
FunctionMirror.prototype.toText = function() {
|
||||
return this.source();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -951,7 +951,7 @@ UnresolvedFunctionMirror.prototype.inferredName = function() {
|
||||
|
||||
UnresolvedFunctionMirror.prototype.propertyNames = function(kind, limit) {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -971,7 +971,8 @@ ArrayMirror.prototype.length = function() {
|
||||
};
|
||||
|
||||
|
||||
ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, opt_to_index) {
|
||||
ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index,
|
||||
opt_to_index) {
|
||||
var from_index = opt_from_index || 0;
|
||||
var to_index = opt_to_index || this.length() - 1;
|
||||
if (from_index > to_index) return new Array();
|
||||
@ -987,7 +988,7 @@ ArrayMirror.prototype.indexedPropertiesFromRange = function(opt_from_index, opt_
|
||||
values[i - from_index] = value;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1005,7 +1006,7 @@ inherits(DateMirror, ObjectMirror);
|
||||
DateMirror.prototype.toText = function() {
|
||||
var s = JSON.stringify(this.value_);
|
||||
return s.substring(1, s.length - 1); // cut quotes
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1059,7 +1060,7 @@ RegExpMirror.prototype.multiline = function() {
|
||||
RegExpMirror.prototype.toText = function() {
|
||||
// Simpel to text which is used when on specialization in subclass.
|
||||
return "/" + this.source() + "/";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1092,7 +1093,7 @@ ErrorMirror.prototype.toText = function() {
|
||||
str = '#<Error>';
|
||||
}
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1110,7 +1111,7 @@ function PropertyMirror(mirror, name, details) {
|
||||
this.value_ = details[0];
|
||||
this.details_ = details[1];
|
||||
if (details.length > 2) {
|
||||
this.exception_ = details[2]
|
||||
this.exception_ = details[2];
|
||||
this.getter_ = details[3];
|
||||
this.setter_ = details[4];
|
||||
}
|
||||
@ -1120,22 +1121,22 @@ inherits(PropertyMirror, Mirror);
|
||||
|
||||
PropertyMirror.prototype.isReadOnly = function() {
|
||||
return (this.attributes() & PropertyAttribute.ReadOnly) != 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.isEnum = function() {
|
||||
return (this.attributes() & PropertyAttribute.DontEnum) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.canDelete = function() {
|
||||
return (this.attributes() & PropertyAttribute.DontDelete) == 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.name = function() {
|
||||
return this.name_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.isIndexed = function() {
|
||||
@ -1145,12 +1146,12 @@ PropertyMirror.prototype.isIndexed = function() {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.value = function() {
|
||||
return MakeMirror(this.value_, false);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1159,22 +1160,22 @@ PropertyMirror.prototype.value = function() {
|
||||
*/
|
||||
PropertyMirror.prototype.isException = function() {
|
||||
return this.exception_ ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.attributes = function() {
|
||||
return %DebugPropertyAttributesFromDetails(this.details_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.propertyType = function() {
|
||||
return %DebugPropertyTypeFromDetails(this.details_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
PropertyMirror.prototype.insertionIndex = function() {
|
||||
return %DebugPropertyIndexFromDetails(this.details_);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1183,7 +1184,7 @@ PropertyMirror.prototype.insertionIndex = function() {
|
||||
*/
|
||||
PropertyMirror.prototype.hasGetter = function() {
|
||||
return this.getter_ ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1192,7 +1193,7 @@ PropertyMirror.prototype.hasGetter = function() {
|
||||
*/
|
||||
PropertyMirror.prototype.hasSetter = function() {
|
||||
return this.setter_ ? true : false;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1206,7 +1207,7 @@ PropertyMirror.prototype.getter = function() {
|
||||
} else {
|
||||
return GetUndefinedMirror();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1220,7 +1221,7 @@ PropertyMirror.prototype.setter = function() {
|
||||
} else {
|
||||
return GetUndefinedMirror();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1233,7 +1234,7 @@ PropertyMirror.prototype.isNative = function() {
|
||||
return (this.propertyType() == PropertyType.Interceptor) ||
|
||||
((this.propertyType() == PropertyType.Callbacks) &&
|
||||
!this.hasGetter() && !this.hasSetter());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const kFrameDetailsFrameIdIndex = 0;
|
||||
@ -1284,63 +1285,63 @@ function FrameDetails(break_id, index) {
|
||||
FrameDetails.prototype.frameId = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsFrameIdIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.receiver = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsReceiverIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.func = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsFunctionIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.isConstructCall = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsConstructCallIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.isAtReturn = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsAtReturnIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.isDebuggerFrame = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
var f = kFrameDetailsFlagDebuggerFrameMask;
|
||||
return (this.details_[kFrameDetailsFlagsIndex] & f) == f;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.isOptimizedFrame = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
var f = kFrameDetailsFlagOptimizedFrameMask;
|
||||
return (this.details_[kFrameDetailsFlagsIndex] & f) == f;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.isInlinedFrame = function() {
|
||||
return this.inlinedFrameIndex() > 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.inlinedFrameIndex = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
var f = kFrameDetailsFlagInlinedFrameIndexMask;
|
||||
return (this.details_[kFrameDetailsFlagsIndex] & f) >> 2
|
||||
}
|
||||
return (this.details_[kFrameDetailsFlagsIndex] & f) >> 2;
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.argumentCount = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsArgumentCountIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.argumentName = function(index) {
|
||||
@ -1348,9 +1349,9 @@ FrameDetails.prototype.argumentName = function(index) {
|
||||
if (index >= 0 && index < this.argumentCount()) {
|
||||
return this.details_[kFrameDetailsFirstDynamicIndex +
|
||||
index * kFrameDetailsNameValueSize +
|
||||
kFrameDetailsNameIndex]
|
||||
kFrameDetailsNameIndex];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.argumentValue = function(index) {
|
||||
@ -1358,45 +1359,45 @@ FrameDetails.prototype.argumentValue = function(index) {
|
||||
if (index >= 0 && index < this.argumentCount()) {
|
||||
return this.details_[kFrameDetailsFirstDynamicIndex +
|
||||
index * kFrameDetailsNameValueSize +
|
||||
kFrameDetailsValueIndex]
|
||||
kFrameDetailsValueIndex];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.localCount = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsLocalCountIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.sourcePosition = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kFrameDetailsSourcePositionIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.localName = function(index) {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
if (index >= 0 && index < this.localCount()) {
|
||||
var locals_offset = kFrameDetailsFirstDynamicIndex +
|
||||
this.argumentCount() * kFrameDetailsNameValueSize
|
||||
this.argumentCount() * kFrameDetailsNameValueSize;
|
||||
return this.details_[locals_offset +
|
||||
index * kFrameDetailsNameValueSize +
|
||||
kFrameDetailsNameIndex]
|
||||
kFrameDetailsNameIndex];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.localValue = function(index) {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
if (index >= 0 && index < this.localCount()) {
|
||||
var locals_offset = kFrameDetailsFirstDynamicIndex +
|
||||
this.argumentCount() * kFrameDetailsNameValueSize
|
||||
this.argumentCount() * kFrameDetailsNameValueSize;
|
||||
return this.details_[locals_offset +
|
||||
index * kFrameDetailsNameValueSize +
|
||||
kFrameDetailsValueIndex]
|
||||
kFrameDetailsValueIndex];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.returnValue = function() {
|
||||
@ -1407,12 +1408,12 @@ FrameDetails.prototype.returnValue = function() {
|
||||
if (this.details_[kFrameDetailsAtReturnIndex]) {
|
||||
return this.details_[return_value_offset];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameDetails.prototype.scopeCount = function() {
|
||||
return %GetScopeCount(this.break_id_, this.frameId());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1575,7 +1576,8 @@ FrameMirror.prototype.scope = function(index) {
|
||||
};
|
||||
|
||||
|
||||
FrameMirror.prototype.evaluate = function(source, disable_break, opt_context_object) {
|
||||
FrameMirror.prototype.evaluate = function(source, disable_break,
|
||||
opt_context_object) {
|
||||
var result = %DebugEvaluate(this.break_id_,
|
||||
this.details_.frameId(),
|
||||
this.details_.inlinedFrameIndex(),
|
||||
@ -1599,7 +1601,8 @@ FrameMirror.prototype.invocationText = function() {
|
||||
result += '[debugger]';
|
||||
} else {
|
||||
// If the receiver has a className which is 'global' don't display it.
|
||||
var display_receiver = !receiver.className || receiver.className() != 'global';
|
||||
var display_receiver =
|
||||
!receiver.className || (receiver.className() != 'global');
|
||||
if (display_receiver) {
|
||||
result += receiver.toText();
|
||||
}
|
||||
@ -1661,7 +1664,7 @@ FrameMirror.prototype.invocationText = function() {
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameMirror.prototype.sourceAndPositionText = function() {
|
||||
@ -1693,13 +1696,13 @@ FrameMirror.prototype.sourceAndPositionText = function() {
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameMirror.prototype.localsText = function() {
|
||||
// Format local variables.
|
||||
var result = '';
|
||||
var locals_count = this.localCount()
|
||||
var locals_count = this.localCount();
|
||||
if (locals_count > 0) {
|
||||
for (var i = 0; i < locals_count; ++i) {
|
||||
result += ' var ';
|
||||
@ -1711,7 +1714,7 @@ FrameMirror.prototype.localsText = function() {
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
FrameMirror.prototype.toText = function(opt_locals) {
|
||||
@ -1726,7 +1729,7 @@ FrameMirror.prototype.toText = function(opt_locals) {
|
||||
result += this.localsText();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
const kScopeDetailsTypeIndex = 0;
|
||||
@ -1744,13 +1747,13 @@ function ScopeDetails(frame, index) {
|
||||
ScopeDetails.prototype.type = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kScopeDetailsTypeIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ScopeDetails.prototype.object = function() {
|
||||
%CheckExecutionState(this.break_id_);
|
||||
return this.details_[kScopeDetailsObjectIndex];
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1862,12 +1865,12 @@ ScriptMirror.prototype.lineCount = function() {
|
||||
ScriptMirror.prototype.locationFromPosition = function(
|
||||
position, include_resource_offset) {
|
||||
return this.script_.locationFromPosition(position, include_resource_offset);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ScriptMirror.prototype.sourceSlice = function (opt_from_line, opt_to_line) {
|
||||
return this.script_.sourceSlice(opt_from_line, opt_to_line);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ScriptMirror.prototype.context = function() {
|
||||
@ -1907,7 +1910,7 @@ ScriptMirror.prototype.toText = function() {
|
||||
}
|
||||
result += ')';
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1965,7 +1968,7 @@ function JSONProtocolSerializer(details, options) {
|
||||
*/
|
||||
JSONProtocolSerializer.prototype.serializeReference = function(mirror) {
|
||||
return this.serialize_(mirror, true, true);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -1978,7 +1981,7 @@ JSONProtocolSerializer.prototype.serializeReference = function(mirror) {
|
||||
JSONProtocolSerializer.prototype.serializeValue = function(mirror) {
|
||||
var json = this.serialize_(mirror, false, true);
|
||||
return json;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2000,17 +2003,17 @@ JSONProtocolSerializer.prototype.serializeReferencedObjects = function() {
|
||||
}
|
||||
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JSONProtocolSerializer.prototype.includeSource_ = function() {
|
||||
return this.options_ && this.options_.includeSource;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JSONProtocolSerializer.prototype.inlineRefs_ = function() {
|
||||
return this.options_ && this.options_.inlineRefs;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JSONProtocolSerializer.prototype.maxStringLength_ = function() {
|
||||
@ -2019,7 +2022,7 @@ JSONProtocolSerializer.prototype.maxStringLength_ = function() {
|
||||
return kMaxProtocolStringLength;
|
||||
}
|
||||
return this.options_.maxStringLength;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JSONProtocolSerializer.prototype.add_ = function(mirror) {
|
||||
@ -2032,7 +2035,7 @@ JSONProtocolSerializer.prototype.add_ = function(mirror) {
|
||||
|
||||
// Add the mirror to the list of mirrors to be serialized.
|
||||
this.mirrors_.push(mirror);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2139,7 +2142,7 @@ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
|
||||
break;
|
||||
|
||||
case PROPERTY_TYPE:
|
||||
throw new Error('PropertyMirror cannot be serialized independeltly')
|
||||
throw new Error('PropertyMirror cannot be serialized independeltly');
|
||||
break;
|
||||
|
||||
case FRAME_TYPE:
|
||||
@ -2179,7 +2182,7 @@ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
|
||||
mirror.evalFromScript()) {
|
||||
content.evalFromScript =
|
||||
this.serializeReference(mirror.evalFromScript());
|
||||
var evalFromLocation = mirror.evalFromLocation()
|
||||
var evalFromLocation = mirror.evalFromLocation();
|
||||
if (evalFromLocation) {
|
||||
content.evalFromLocation = { line: evalFromLocation.line,
|
||||
column: evalFromLocation.column };
|
||||
@ -2203,7 +2206,7 @@ JSONProtocolSerializer.prototype.serialize_ = function(mirror, reference,
|
||||
|
||||
// Create and return the JSON string.
|
||||
return content;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2278,7 +2281,7 @@ JSONProtocolSerializer.prototype.serializeObject_ = function(mirror, content,
|
||||
}
|
||||
}
|
||||
content.properties = p;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@ -2342,7 +2345,7 @@ JSONProtocolSerializer.prototype.serializeProperty_ = function(propertyMirror) {
|
||||
result.ref = propertyValue.handle();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
|
||||
@ -2362,7 +2365,7 @@ JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
|
||||
var x = new Array(mirror.argumentCount());
|
||||
for (var i = 0; i < mirror.argumentCount(); i++) {
|
||||
var arg = {};
|
||||
var argument_name = mirror.argumentName(i)
|
||||
var argument_name = mirror.argumentName(i);
|
||||
if (argument_name) {
|
||||
arg.name = argument_name;
|
||||
}
|
||||
@ -2392,7 +2395,7 @@ JSONProtocolSerializer.prototype.serializeFrame_ = function(mirror, content) {
|
||||
index: i
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) {
|
||||
@ -2402,7 +2405,7 @@ JSONProtocolSerializer.prototype.serializeScope_ = function(mirror, content) {
|
||||
content.object = this.inlineRefs_() ?
|
||||
this.serializeValue(mirror.scopeObject()) :
|
||||
this.serializeReference(mirror.scopeObject());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
|
@ -419,14 +419,18 @@ function SetUpRegExp() {
|
||||
}
|
||||
function RegExpSetInput(string) {
|
||||
LAST_INPUT(lastMatchInfo) = ToString(string);
|
||||
};
|
||||
}
|
||||
|
||||
%DefineAccessor($RegExp, 'input', GETTER, RegExpGetInput, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'input', SETTER, RegExpSetInput, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$_', GETTER, RegExpGetInput,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$_', SETTER, RegExpSetInput,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$input', GETTER, RegExpGetInput,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$input', SETTER, RegExpSetInput,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
|
||||
// The properties multiline and $* are aliases for each other. When this
|
||||
// value is set in SpiderMonkey, the value it is set to is coerced to a
|
||||
@ -437,38 +441,51 @@ function SetUpRegExp() {
|
||||
|
||||
// Getter and setter for multiline.
|
||||
var multiline = false;
|
||||
function RegExpGetMultiline() { return multiline; };
|
||||
function RegExpSetMultiline(flag) { multiline = flag ? true : false; };
|
||||
function RegExpGetMultiline() { return multiline; }
|
||||
function RegExpSetMultiline(flag) { multiline = flag ? true : false; }
|
||||
|
||||
%DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'multiline', GETTER, RegExpGetMultiline,
|
||||
DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'multiline', SETTER, RegExpSetMultiline,
|
||||
DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$*', GETTER, RegExpGetMultiline,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$*', SETTER, RegExpSetMultiline,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
|
||||
|
||||
function NoOpSetter(ignored) {}
|
||||
|
||||
|
||||
// Static properties set by a successful match.
|
||||
%DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'lastMatch', GETTER, RegExpGetLastMatch,
|
||||
DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'lastMatch', SETTER, NoOpSetter, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$&', GETTER, RegExpGetLastMatch,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$&', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'lastParen', GETTER, RegExpGetLastParen,
|
||||
DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'lastParen', SETTER, NoOpSetter, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$+', GETTER, RegExpGetLastParen,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$+', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'leftContext', GETTER, RegExpGetLeftContext,
|
||||
DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'leftContext', SETTER, NoOpSetter, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$`', GETTER, RegExpGetLeftContext,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$`', SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'rightContext', GETTER, RegExpGetRightContext,
|
||||
DONT_DELETE);
|
||||
%DefineAccessor($RegExp, 'rightContext', SETTER, NoOpSetter, DONT_DELETE);
|
||||
%DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext, DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, "$'", GETTER, RegExpGetRightContext,
|
||||
DONT_ENUM | DONT_DELETE);
|
||||
%DefineAccessor($RegExp, "$'", SETTER, NoOpSetter, DONT_ENUM | DONT_DELETE);
|
||||
|
||||
for (var i = 1; i < 10; ++i) {
|
||||
%DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i), DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$' + i, GETTER, RegExpMakeCaptureGetter(i),
|
||||
DONT_DELETE);
|
||||
%DefineAccessor($RegExp, '$' + i, SETTER, NoOpSetter, DONT_DELETE);
|
||||
}
|
||||
}
|
||||
|
@ -458,7 +458,8 @@ function APPLY_PREPARE(args) {
|
||||
}
|
||||
|
||||
if (!IS_SPEC_FUNCTION(this)) {
|
||||
throw %MakeTypeError('apply_non_function', [ %ToString(this), typeof this ]);
|
||||
throw %MakeTypeError('apply_non_function',
|
||||
[ %ToString(this), typeof this ]);
|
||||
}
|
||||
|
||||
// Make sure the arguments list has the right type.
|
||||
|
@ -46,16 +46,18 @@
|
||||
|
||||
// ECMA-262 section 15.5.4.2
|
||||
function StringToString() {
|
||||
if (!IS_STRING(this) && !IS_STRING_WRAPPER(this))
|
||||
if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
|
||||
throw new $TypeError('String.prototype.toString is not generic');
|
||||
}
|
||||
return %_ValueOf(this);
|
||||
}
|
||||
|
||||
|
||||
// ECMA-262 section 15.5.4.3
|
||||
function StringValueOf() {
|
||||
if (!IS_STRING(this) && !IS_STRING_WRAPPER(this))
|
||||
if (!IS_STRING(this) && !IS_STRING_WRAPPER(this)) {
|
||||
throw new $TypeError('String.prototype.valueOf is not generic');
|
||||
}
|
||||
return %_ValueOf(this);
|
||||
}
|
||||
|
||||
@ -91,7 +93,8 @@ function StringCharCodeAt(pos) {
|
||||
// ECMA-262, section 15.5.4.6
|
||||
function StringConcat() {
|
||||
if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
||||
throw MakeTypeError("called_on_null_or_undefined", ["String.prototype.concat"]);
|
||||
throw MakeTypeError("called_on_null_or_undefined",
|
||||
["String.prototype.concat"]);
|
||||
}
|
||||
var len = %_ArgumentsLength();
|
||||
var this_as_string = TO_STRING_INLINE(this);
|
||||
@ -358,7 +361,7 @@ function ExpandReplacement(string, subject, matchInfo, builder) {
|
||||
builder_elements.push(SubString(string, position, next));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Compute the string of a given regular expression capture.
|
||||
@ -371,7 +374,7 @@ function CaptureString(string, lastCaptureInfo, index) {
|
||||
if (start < 0) return;
|
||||
var end = lastCaptureInfo[CAPTURE(scaled + 1)];
|
||||
return SubString(string, start, end);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Add the string of a given regular expression capture to the
|
||||
@ -384,7 +387,7 @@ function addCaptureString(builder, matchInfo, index) {
|
||||
if (start < 0) return;
|
||||
var end = matchInfo[CAPTURE(scaled + 1)];
|
||||
builder.addSpecialSlice(start, end);
|
||||
};
|
||||
}
|
||||
|
||||
// TODO(lrn): This array will survive indefinitely if replace is never
|
||||
// called again. However, it will be empty, since the contents are cleared
|
||||
@ -531,30 +534,36 @@ function StringSlice(start, end) {
|
||||
var s_len = s.length;
|
||||
var start_i = TO_INTEGER(start);
|
||||
var end_i = s_len;
|
||||
if (end !== void 0)
|
||||
if (end !== void 0) {
|
||||
end_i = TO_INTEGER(end);
|
||||
}
|
||||
|
||||
if (start_i < 0) {
|
||||
start_i += s_len;
|
||||
if (start_i < 0)
|
||||
if (start_i < 0) {
|
||||
start_i = 0;
|
||||
}
|
||||
} else {
|
||||
if (start_i > s_len)
|
||||
if (start_i > s_len) {
|
||||
start_i = s_len;
|
||||
}
|
||||
}
|
||||
|
||||
if (end_i < 0) {
|
||||
end_i += s_len;
|
||||
if (end_i < 0)
|
||||
if (end_i < 0) {
|
||||
end_i = 0;
|
||||
}
|
||||
} else {
|
||||
if (end_i > s_len)
|
||||
if (end_i > s_len) {
|
||||
end_i = s_len;
|
||||
}
|
||||
}
|
||||
|
||||
var num_c = end_i - start_i;
|
||||
if (num_c < 0)
|
||||
if (num_c < 0) {
|
||||
num_c = 0;
|
||||
}
|
||||
|
||||
return SubString(s, start_i, start_i + num_c);
|
||||
}
|
||||
@ -692,7 +701,7 @@ function StringSubstring(start, end) {
|
||||
}
|
||||
}
|
||||
|
||||
return (start_i + 1 == end_i
|
||||
return ((start_i + 1 == end_i)
|
||||
? %_StringCharAt(s, start_i)
|
||||
: %_SubString(s, start_i, end_i));
|
||||
}
|
||||
@ -736,7 +745,7 @@ function StringSubstr(start, n) {
|
||||
var end = start + len;
|
||||
if (end > s.length) end = s.length;
|
||||
|
||||
return (start + 1 == end
|
||||
return ((start + 1 == end)
|
||||
? %_StringCharAt(s, start)
|
||||
: %_SubString(s, start, end));
|
||||
}
|
||||
@ -836,7 +845,7 @@ function HtmlEscape(str) {
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// Compatibility support for KJS.
|
||||
|
10
src/uri.js
10
src/uri.js
@ -219,7 +219,7 @@ function Decode(uri, reserved) {
|
||||
var cc = URIHexCharsToCharCode(uri.charCodeAt(++k), uri.charCodeAt(++k));
|
||||
if (cc >> 7) {
|
||||
var n = 0;
|
||||
while (((cc << ++n) & 0x80) != 0) ;
|
||||
while (((cc << ++n) & 0x80) != 0) { }
|
||||
if (n == 1 || n > 4) throw new $URIError("URI malformed");
|
||||
var octets = new $Array(n);
|
||||
octets[0] = cc;
|
||||
@ -267,7 +267,7 @@ function URIDecode(uri) {
|
||||
if (63 <= cc && cc <= 64) return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
var string = ToString(uri);
|
||||
return Decode(string, reservedPredicate);
|
||||
}
|
||||
@ -275,7 +275,7 @@ function URIDecode(uri) {
|
||||
|
||||
// ECMA-262 - 15.1.3.2.
|
||||
function URIDecodeComponent(component) {
|
||||
function reservedPredicate(cc) { return false; };
|
||||
function reservedPredicate(cc) { return false; }
|
||||
var string = ToString(component);
|
||||
return Decode(string, reservedPredicate);
|
||||
}
|
||||
@ -316,7 +316,7 @@ function URIEncode(uri) {
|
||||
if (cc == 126) return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
var string = ToString(uri);
|
||||
return Encode(string, unescapePredicate);
|
||||
@ -339,7 +339,7 @@ function URIEncodeComponent(component) {
|
||||
if (cc == 126) return true;
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
var string = ToString(component);
|
||||
return Encode(string, unescapePredicate);
|
||||
|
@ -127,8 +127,9 @@ function GlobalParseInt(string, radix) {
|
||||
// The spec says ToString should be evaluated before ToInt32.
|
||||
string = TO_STRING_INLINE(string);
|
||||
radix = TO_INT32(radix);
|
||||
if (!(radix == 0 || (2 <= radix && radix <= 36)))
|
||||
if (!(radix == 0 || (2 <= radix && radix <= 36))) {
|
||||
return $NaN;
|
||||
}
|
||||
}
|
||||
|
||||
if (%_HasCachedArrayIndex(string) &&
|
||||
@ -283,7 +284,8 @@ function ObjectDefineGetter(name, fun) {
|
||||
receiver = %GlobalReceiver(global);
|
||||
}
|
||||
if (!IS_SPEC_FUNCTION(fun)) {
|
||||
throw new $TypeError('Object.prototype.__defineGetter__: Expecting function');
|
||||
throw new $TypeError(
|
||||
'Object.prototype.__defineGetter__: Expecting function');
|
||||
}
|
||||
var desc = new PropertyDescriptor();
|
||||
desc.setGet(fun);
|
||||
@ -329,8 +331,9 @@ function ObjectLookupSetter(name) {
|
||||
|
||||
|
||||
function ObjectKeys(obj) {
|
||||
if (!IS_SPEC_OBJECT(obj))
|
||||
if (!IS_SPEC_OBJECT(obj)) {
|
||||
throw MakeTypeError("obj_ctor_property_non_object", ["keys"]);
|
||||
}
|
||||
if (%IsJSProxy(obj)) {
|
||||
var handler = %GetHandler(obj);
|
||||
var names = CallTrap0(handler, "keys", DerivedKeysTrap);
|
||||
@ -461,7 +464,7 @@ function ToPropertyDescriptor(obj) {
|
||||
|
||||
// For Harmony proxies.
|
||||
function ToCompletePropertyDescriptor(obj) {
|
||||
var desc = ToPropertyDescriptor(obj)
|
||||
var desc = ToPropertyDescriptor(obj);
|
||||
if (IsGenericDescriptor(desc) || IsDataDescriptor(desc)) {
|
||||
if (!desc.hasValue()) desc.setValue(void 0);
|
||||
if (!desc.hasWritable()) desc.setWritable(false);
|
||||
@ -845,17 +848,19 @@ function DefineOwnProperty(obj, p, desc, should_throw) {
|
||||
|
||||
// ES5 section 15.2.3.2.
|
||||
function ObjectGetPrototypeOf(obj) {
|
||||
if (!IS_SPEC_OBJECT(obj))
|
||||
if (!IS_SPEC_OBJECT(obj)) {
|
||||
throw MakeTypeError("obj_ctor_property_non_object", ["getPrototypeOf"]);
|
||||
}
|
||||
return %GetPrototype(obj);
|
||||
}
|
||||
|
||||
|
||||
// ES5 section 15.2.3.3
|
||||
function ObjectGetOwnPropertyDescriptor(obj, p) {
|
||||
if (!IS_SPEC_OBJECT(obj))
|
||||
if (!IS_SPEC_OBJECT(obj)) {
|
||||
throw MakeTypeError("obj_ctor_property_non_object",
|
||||
["getOwnPropertyDescriptor"]);
|
||||
}
|
||||
var desc = GetOwnProperty(obj, p);
|
||||
return FromPropertyDescriptor(desc);
|
||||
}
|
||||
@ -868,11 +873,11 @@ function ToStringArray(obj, trap) {
|
||||
}
|
||||
var n = ToUint32(obj.length);
|
||||
var array = new $Array(n);
|
||||
var names = {} // TODO(rossberg): use sets once they are ready.
|
||||
var names = {}; // TODO(rossberg): use sets once they are ready.
|
||||
for (var index = 0; index < n; index++) {
|
||||
var s = ToString(obj[index]);
|
||||
if (s in names) {
|
||||
throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s])
|
||||
throw MakeTypeError("proxy_repeated_prop_name", [obj, trap, s]);
|
||||
}
|
||||
array[index] = s;
|
||||
names[s] = 0;
|
||||
@ -883,9 +888,10 @@ function ToStringArray(obj, trap) {
|
||||
|
||||
// ES5 section 15.2.3.4.
|
||||
function ObjectGetOwnPropertyNames(obj) {
|
||||
if (!IS_SPEC_OBJECT(obj))
|
||||
throw MakeTypeError("obj_ctor_property_non_object", ["getOwnPropertyNames"]);
|
||||
|
||||
if (!IS_SPEC_OBJECT(obj)) {
|
||||
throw MakeTypeError("obj_ctor_property_non_object",
|
||||
["getOwnPropertyNames"]);
|
||||
}
|
||||
// Special handling for proxies.
|
||||
if (%IsJSProxy(obj)) {
|
||||
var handler = %GetHandler(obj);
|
||||
@ -902,8 +908,9 @@ function ObjectGetOwnPropertyNames(obj) {
|
||||
if (%GetInterceptorInfo(obj) & 1) {
|
||||
var indexedInterceptorNames =
|
||||
%GetIndexedInterceptorElementNames(obj);
|
||||
if (indexedInterceptorNames)
|
||||
if (indexedInterceptorNames) {
|
||||
propertyNames = propertyNames.concat(indexedInterceptorNames);
|
||||
}
|
||||
}
|
||||
|
||||
// Find all the named properties.
|
||||
@ -929,8 +936,9 @@ function ObjectGetOwnPropertyNames(obj) {
|
||||
// We need to check for the exact property value since for intrinsic
|
||||
// properties like toString if(propertySet["toString"]) will always
|
||||
// succeed.
|
||||
if (propertySet[name] === true)
|
||||
if (propertySet[name] === true) {
|
||||
continue;
|
||||
}
|
||||
propertySet[name] = true;
|
||||
propertyNames[j++] = name;
|
||||
}
|
||||
@ -1006,8 +1014,9 @@ function GetOwnEnumerablePropertyNames(properties) {
|
||||
|
||||
// ES5 section 15.2.3.7.
|
||||
function ObjectDefineProperties(obj, properties) {
|
||||
if (!IS_SPEC_OBJECT(obj))
|
||||
if (!IS_SPEC_OBJECT(obj)) {
|
||||
throw MakeTypeError("obj_ctor_property_non_object", ["defineProperties"]);
|
||||
}
|
||||
var props = ToObject(properties);
|
||||
var names = GetOwnEnumerablePropertyNames(props);
|
||||
var descriptors = new InternalArray();
|
||||
@ -1232,8 +1241,9 @@ function BooleanToString() {
|
||||
function BooleanValueOf() {
|
||||
// NOTE: Both Boolean objects and values can enter here as
|
||||
// 'this'. This is not as dictated by ECMA-262.
|
||||
if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this))
|
||||
if (!IS_BOOLEAN(this) && !IS_BOOLEAN_WRAPPER(this)) {
|
||||
throw new $TypeError('Boolean.prototype.valueOf is not generic');
|
||||
}
|
||||
return %_ValueOf(this);
|
||||
}
|
||||
|
||||
@ -1273,8 +1283,9 @@ function NumberToString(radix) {
|
||||
// 'this'. This is not as dictated by ECMA-262.
|
||||
var number = this;
|
||||
if (!IS_NUMBER(this)) {
|
||||
if (!IS_NUMBER_WRAPPER(this))
|
||||
if (!IS_NUMBER_WRAPPER(this)) {
|
||||
throw new $TypeError('Number.prototype.toString is not generic');
|
||||
}
|
||||
// Get the value of this number in case it's an object.
|
||||
number = %_ValueOf(this);
|
||||
}
|
||||
@ -1307,8 +1318,9 @@ function NumberToLocaleString() {
|
||||
function NumberValueOf() {
|
||||
// NOTE: Both Number objects and values can enter here as
|
||||
// 'this'. This is not as dictated by ECMA-262.
|
||||
if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this))
|
||||
if (!IS_NUMBER(this) && !IS_NUMBER_WRAPPER(this)) {
|
||||
throw new $TypeError('Number.prototype.valueOf is not generic');
|
||||
}
|
||||
return %_ValueOf(this);
|
||||
}
|
||||
|
||||
@ -1334,7 +1346,8 @@ function NumberToExponential(fractionDigits) {
|
||||
if (!IS_UNDEFINED(fractionDigits)) {
|
||||
f = TO_INTEGER(fractionDigits);
|
||||
if (f < 0 || f > 20) {
|
||||
throw new $RangeError("toExponential() argument must be between 0 and 20");
|
||||
throw new $RangeError(
|
||||
"toExponential() argument must be between 0 and 20");
|
||||
}
|
||||
}
|
||||
if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) {
|
||||
@ -1378,7 +1391,8 @@ function SetUpNumber() {
|
||||
DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
|
||||
// ECMA-262 section 15.7.3.2.
|
||||
%SetProperty($Number, "MIN_VALUE", 5e-324, DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
%SetProperty($Number, "MIN_VALUE", 5e-324,
|
||||
DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
|
||||
// ECMA-262 section 15.7.3.3.
|
||||
%SetProperty($Number, "NaN", $NaN, DONT_ENUM | DONT_DELETE | READ_ONLY);
|
||||
@ -1496,7 +1510,8 @@ function FunctionBind(this_arg) { // Length is 1.
|
||||
}
|
||||
// This runtime function finds any remaining arguments on the stack,
|
||||
// so we don't pass the arguments object.
|
||||
var result = %FunctionBindArguments(boundFunction, this, this_arg, new_length);
|
||||
var result = %FunctionBindArguments(boundFunction, this,
|
||||
this_arg, new_length);
|
||||
|
||||
// We already have caller and arguments properties on functions,
|
||||
// which are non-configurable. It therefore makes no sence to
|
||||
|
@ -42,4 +42,4 @@ function C() {
|
||||
|
||||
assertEquals(23, new C().x);
|
||||
C.prototype.__defineSetter__('x', function(value) { this.y = 23; });
|
||||
assertEquals(void 0, new C().x));
|
||||
assertEquals(void 0, new C().x);
|
||||
|
Loading…
Reference in New Issue
Block a user