0

I create next code and catch error in some phone browser:

Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 NokiaN97-1/22.0.110; Profile/MIDP-2.1 Configuration/CLDC-1.1) AppleWebKit/525 (KHTML, like Gecko) BrowserNG/7.1.4
Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5800d-1/52.0.007; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.6.9 3gpp-gba
Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5228/40.1.003; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.4 3gpp-gba
Mozilla/5.0 (SymbianOS/9.3; Series60/3.2 NokiaC5-00/031.022; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.3.1
Mozilla/5.0 (SymbianOS/9.4; Series60/5.0 Nokia5230/40.0.003; Profile/MIDP-2.1 Configuration/CLDC-1.1 ) AppleWebKit/525 (KHTML, like Gecko) Version/3.0 BrowserNG/7.2.7.4 3gpp-gba

Code:

try {

var blank_function = function () {}; if (window) window.ll = 9423;
if (!window.console) {
    window.console = {time: blank_function, timeEnd: blank_function, log: blank_function, dir: blank_function}; if (window) window.ll = 9425;
}
if (!console.time) {
    console.time = blank_function; if (window) window.ll = 9428;
}
if (!console.timeEnd) {
    console.timeEnd = blank_function; if (window) window.ll = 9431;
}
if (!console.log) {
    console.log = blank_function; if (window) window.ll = 9434;
}
if (!console.dir) {
    console.dir = blank_function; if (window) window.ll = 9437;
}


console.time("other"); if (window) window.ll = 9441;

} catch(e) {if (window.send_exception && typeof window.send_exception == typeof function(){}) {window.send_exception(e);}}

What is problem with it? I don't use return value => it's may be undefined. In other browsers works without errors.

Exception data:

Array (
    [name] => TypeError
    [message] => Value undefined (result of expression console.time) is not object.
    [line] => 9442
    [toString] => TypeError: Value undefined (result of expression console.time) is not object.
)

PS Sorry for bad English.

PPS window.ll = line number - 1.

Enyby
  • 4,162
  • 2
  • 33
  • 42
  • Are you sure the exception is thrown here? – a better oliver Apr 27 '13 at 17:10
  • Yes. The same line number and value window.ll equal 9437. – Enyby Apr 27 '13 at 17:13
  • I'd rather not be. This error happens when you try to add a property (or delete one) to `console.time` when console.time does not exist. But I don't see something like that here. And since the line number is set after `console.time("other")` it's logical that the problem occurs after that. – a better oliver Apr 27 '13 at 17:23
  • Not. Number line script (not window.ll) is 9442. And window.ll = 9437. => "if (window) window.ll = 9441;" don't run. => error in "console.time("other");". – Enyby Apr 27 '13 at 17:32
  • Maybe you should stop timer with console.timeEnd("other") after console.time("other"). – Ikrom Apr 27 '13 at 17:52
  • I post part of code. Of course console.timeEnd("other") present. But if console.time("other") caused exception code after that don't run. – Enyby Apr 27 '13 at 18:03

1 Answers1

0

I still see only one explanation:

This JavaScript implementation contains window.console object, but without method time.

However, the object can not add methods, so the assignment of blank_function does not give anything.

While after that the call can not be done, since method time does not exist.

Enyby
  • 4,162
  • 2
  • 33
  • 42