Closed
Bug 692125
Opened 13 years ago
Closed 12 years ago
apply(), bind() and call() methods are undefined for console.log in content script
Categories
(Add-on SDK Graveyard :: General, defect, P2)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: xKhorasan, Assigned: irakli)
References
Details
Attachments
(1 file)
942 bytes,
application/octet-stream
|
Details |
User Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Add-on SDK: 1.2b3 Unlike Add-on script, apply(), bind() and call() methods are undefined for console.log in content script. It makes hard to write utility function like function debug() { if (typeof DEBUG !== 'undefined' && DEBUG) { console.log.apply(console, arguments) } } or var log = console.log.bind(console); in content script. This problem also happened in Windows Vista (User Agent: Mozilla/5.0 (Windows NT 6.0; rv:7.0.1) Gecko/20100101 Firefox/7.0.1). Reproducible: Always Steps to reproduce: 1. Download Add-on SDK 1.2b3 and unpack it. (curl -O https://ftp.mozilla.org/pub/mozilla.org/labs/jetpack/addon-sdk-1.2b3.zip && unzip addon-sdk-1.2b3.zip) 2. Move to addon-sdk-1.2b3 directory, then run 'source bin/activate' (or 'bin\activate' on Windows). (cd addon-sdk-1.2b3 && source bin/activate) 3. Download test Add-on code from https://bitbucket.org/xKairouan/console_log_test. (hg clone https://bitbucket.org/xKairouan/console_log_test) 4. Move to console_log_test directory, then run 'cfx run'. (cd console_log_test && cfx run) 5. Input 'www.mozilla.org' in the address bar and press Enter. 6. Wait until page loaded completely. 7. Press Alt + F4 to close Firefox. Actual results: info: console.log.apply is function info: console.log.bind is function info: console.log.call is function info: console.log in Add-on script info: console.log.apply in Add-on script info: console.log.bind in Add-on script info: console.log.call in Add-on script info: console.log.apply is undefined info: console.log.bind is undefined info: console.log.call is undefined info: console.log in content script error: An exception occurred. Traceback (most recent call last): File "console.log.call(console, 'console.log.call in content script');", line 5, in console.log.call File "console.log.bind(console, 'console.log.bind in content script')()", line NaN, in console.log.bind File "console.log.apply(console, ['console.log.apply in content script'])", line NaN, in console.log.apply File "console.log('console.log in content script')", line NaN, in console.log File "})", line NaN, in } File " console.log('console.log.' + prop + ' is ' + typeof console.log[prop])", line NaN, in console.log File "javascript", line NaN, in TypeError: console.log.apply is not a function Expected results: info: console.log.apply is function info: console.log.bind is function info: console.log.call is function info: console.log in Add-on script info: console.log.apply in Add-on script info: console.log.bind in Add-on script info: console.log.call in Add-on script info: console.log.apply is function info: console.log.bind is function info: console.log.call is function info: console.log in content script info: console.log.apply in content script info: console.log.bind in content script info: console.log.call in content script
Blocks: 692539
Irakli, can you confirm that this happens? If this gets confirmed, priority is P2.
Assignee: nobody → rFobic
Priority: -- → P2
Comment 2•12 years ago
|
||
Wes, it should have been fixed by bug 718666.
Comment 3•12 years ago
|
||
xKhorasan, Thanks for your report! I tried your example and it output this on current SDK master: info: console.log in content script info: console.log.apply in content script info: console.log.bind in content script info: console.log.call in content script Please reopen the bug if I miss something, but it looks like it is now fixed.
Status: UNCONFIRMED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•