2011-12-12 48 views
1

我有一個Firefox擴展名爲myjavascriptfile.js,由於我是新來這個插件的概念,只是我想調試這個script.So我使用下面的語句在這個文件中像我的日誌語句是在Mac上打印的嗎?

function LOG(text) 
{ 
    var consoleService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService); 
    consoleService.logStringMessage(text); 
} 


observe: function(subject, topic, data) 
    { 
     LOG("observe called "); 
} 

我知道這個觀察得到調用,但我不知道在哪裏看到我的日誌消息。有人告訴我它在哪裏打印? 請幫忙。

回答

1

該文本轉到錯誤控制檯。您可能需要去about:config並將devtools.errorconsole.enabled優先選擇更改爲true - 默認情況下,錯誤控制檯在默認情況下已從菜單中刪除(奇怪的是,即使沒有此預設,我仍可以看到它)。我認爲在OS X上,您仍然可以通過Tools/Web Developer菜單打開錯誤控制檯,在Windows上您必須單擊Firefox按鈕,然後選擇Web Developer菜單。或者,Command-Shift-J也應該這樣做。

+0

我明白了,非常感謝 – Akbar