|
134 | 134 | }); |
135 | 135 |
|
136 | 136 | test("run opera9", function() { |
137 | | - expect(4); |
| 137 | + expect(5); |
138 | 138 | var p = new printStackTrace.implementation(); |
139 | 139 | p.opera10a = p.opera10b = p.opera11 = p.other = p.firefox = p.chrome = function() { |
140 | 140 | equals(1, 0, 'must not call run for any mode other than "opera9"'); |
|
158 | 158 | p.run(CapturedExceptions.opera_854); |
159 | 159 | p.run(CapturedExceptions.opera_902); |
160 | 160 | p.run(CapturedExceptions.opera_927); |
| 161 | + p.run(CapturedExceptions.opera_964); |
161 | 162 | UnitTest.fn.clearFakeOperaEnvironment(); |
162 | 163 | }); |
163 | 164 |
|
164 | 165 | test("run opera10a", function() { |
165 | | - expect(2); |
| 166 | + expect(1); |
166 | 167 | var p = new printStackTrace.implementation(); |
167 | 168 | p.opera9 = p.opera10b = p.opera11 = p.other = p.firefox = p.chrome = function() { |
168 | 169 | equals(1, 0, 'must not call run for any mode other than "opera10a"'); |
|
171 | 172 | equals(1, 1, 'called run for "opera10a"'); |
172 | 173 | }; |
173 | 174 | UnitTest.fn.prepareFakeOperaEnvironment(); |
174 | | - p.run(CapturedExceptions.opera_964); |
175 | 175 | p.run(CapturedExceptions.opera_1010); |
176 | 176 | UnitTest.fn.clearFakeOperaEnvironment(); |
177 | 177 | }); |
|
403 | 403 | }); |
404 | 404 |
|
405 | 405 | test("opera9", function() { |
406 | | - var e = [CapturedExceptions.opera_854, CapturedExceptions.opera_902, CapturedExceptions.opera_927]; |
407 | | - expect(9); // 3 * e.length |
| 406 | + var e = [CapturedExceptions.opera_854, CapturedExceptions.opera_902, CapturedExceptions.opera_927, CapturedExceptions.opera_964]; |
| 407 | + expect(12); // 3 * e.length |
408 | 408 | for (var i = 0; i < e.length; i++) { |
409 | 409 | var message = pst.opera9(e[i]); |
410 | 410 | //equals(message.join("\n"), 'debug', 'debug'); |
|
415 | 415 | }); |
416 | 416 |
|
417 | 417 | test("opera10a", function() { |
418 | | - var e = [CapturedExceptions.opera_964, CapturedExceptions.opera_1010]; |
419 | | - expect(6); // 3 * e.length |
| 418 | + var e = [CapturedExceptions.opera_1010]; |
| 419 | + expect(5); // 5 * e.length |
420 | 420 | for (var i = 0; i < e.length; i++) { |
421 | 421 | var message = pst.opera10a(e[i]); |
422 | 422 | //equals(message.join("\n"), 'debug', 'debug'); |
423 | | - // NOTE: the important thing here is that the user sees calls to bar and foo in the correct order |
424 | | - // We cannot test the size of the stack because it's inconsistent |
425 | | - equals(message[message.length - 3].indexOf('bar(') >= 0, true, 'bar is 3nd from the bottom of stack'); |
| 423 | + equals(message.length, 7, 'number of stack entries'); |
| 424 | + equals(message[0].indexOf('this.undef()') >= 0, true, 'this.undef() is at the top of stack'); |
| 425 | + equals(message[message.length - 3].indexOf('bar(') >= 0, true, 'bar is 3rd from the bottom of stack'); |
426 | 426 | equals(message[message.length - 2].indexOf('bar(2)') >= 0, true, 'bar is 2nd from the bottom of stack'); |
427 | 427 | equals(message[message.length - 1].indexOf('foo()') >= 0, true, 'foo() is at the bottom of stack'); |
428 | 428 | } |
|
455 | 455 | test("opera11", function() { |
456 | 456 | var mode = pst.mode(UnitTest.fn.createGenericError()); |
457 | 457 | var e = []; |
| 458 | + |
458 | 459 | /*e.push({ |
459 | | - stack: 'ignored\n' + |
460 | | - 'f1([arguments not available])@http://site.com/main.js:2\n' + |
461 | | - '<anonymous function: f2>([arguments not available])@http://site.com/main.js:4\n' + |
462 | | - '@', |
463 | | - stacktrace: 'Error thrown at line 129, column 5 in <anonymous function>():\n' + |
464 | | - 'ignored\n' + |
465 | | - 'Error thrown at line 129, column 5 in <anonymous function>():\n' + |
466 | | - 'ignored\n' + |
467 | | - 'Error thrown at line 124, column 4 in <anonymous function>():\n' + |
468 | | - 'ignored\n' + |
469 | | - 'Error thrown at line 594, column 2 in process():\n' + |
470 | | - 'ignored\n' + |
471 | | - 'Error thrown at line 124, column 4 in <anonymous function>():\n' + |
472 | | - 'ignored\n' + |
473 | | - 'Error thrown at line 1, column 55 in discarded():\n' + |
474 | | - ' this.undef();\n' + |
475 | | - 'called from line 1, column 333 in f1(arg1, arg2):\n' + |
476 | | - ' discarded();\n' + |
477 | | - 'called from line 1, column 470 in <anonymous function>():\n' + |
478 | | - ' f1(1, "abc");\n' + |
479 | | - 'called from line 1, column 278 in program code:\n' + |
480 | | - ' f2();' |
| 460 | + message: "'this.undef' is not a function", |
| 461 | +
|
| 462 | + stack: "discarded([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:461\n" + |
| 463 | + "f1([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:468\n" + |
| 464 | + "<anonymous function>([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:471\n" + |
| 465 | + "<anonymous function>([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:473\n" + |
| 466 | + "<anonymous function: run>([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:102\n" + |
| 467 | + "<anonymous function: queue>([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:232\n" + |
| 468 | + "process([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:864\n" + |
| 469 | + "<anonymous function: start>([arguments not available])@http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:408", |
| 470 | +
|
| 471 | + stacktrace: "Error thrown at line 461, column 10 in discarded() in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:\n" + |
| 472 | + " this.undef();\n" + |
| 473 | + "called from line 468, column 8 in f1(arg1, arg2) in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:\n" + |
| 474 | + " discarded();\n" + |
| 475 | + "called from line 471, column 8 in <anonymous function>() in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:\n" + |
| 476 | + " f1(1, \"abc\");\n" + |
| 477 | + "called from line 473, column 6 in <anonymous function>() in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/TestStacktrace.js:\n" + |
| 478 | + " f2();\n" + |
| 479 | + "called from line 102, column 12 in <anonymous function: run>() in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:\n" + |
| 480 | + " this.callback.call(this.testEnvironment);\n" + |
| 481 | + "called via Function.prototype.call() from line 232, column 16 in <anonymous function: queue>() in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:\n" + |
| 482 | + " test.run();\n" + |
| 483 | + "called from line 864, column 12 in process() in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:\n" + |
| 484 | + " config.queue.shift()();\n" + |
| 485 | + "called from line 408, column 16 in <anonymous function: start>() in http://127.0.0.1:8000/DevTools/stacktrace/javascript-stacktrace/test/qunit.js:\n" + |
| 486 | + " process();" |
481 | 487 | });*/ |
| 488 | + |
482 | 489 | if (mode == 'opera11') { |
483 | 490 | function discarded() { |
484 | 491 | try { |
|
499 | 506 | expect(3 * e.length); |
500 | 507 | for (var i = 0; i < e.length; i++) { |
501 | 508 | var stack = pst.opera11(e[i]), stack_string = stack.join('\n'); |
502 | | - equals(stack_string, 'debug', 'debug'); |
| 509 | + //equals(stack_string, 'debug', 'debug'); |
503 | 510 | equals(stack_string.indexOf('ignored'), -1, 'ignored'); |
504 | | - equals(stack[5].indexOf('f1(') >= 0, true, 'f1 function name: ' + stack[5]); |
505 | | - equals(stack[6].indexOf('{anonymous}()') >= 0, true, 'f2 is anonymous: ' + stack[6]); |
506 | | - //FIXME: Clean up stack[2], opera has some internal stack weirdness |
| 511 | + equals(stack[1].indexOf('f1(') >= 0, true, 'f1 function name: ' + stack[1]); |
| 512 | + equals(stack[2].indexOf('{anonymous}()') >= 0, true, 'f2 is anonymous: ' + stack[2]); |
507 | 513 | } |
508 | 514 | }); |
509 | 515 |
|
|
0 commit comments