2

在 javascript Web 控制台中,当我按下<enter>表达式时,会计算表达式,但输入不清除 - 而是插入了一个新行。这种行为就像我同时按下<enter><shift>+<enter>进行多行输入一样。

我曾尝试以安全模式启动 Firefox,升级和“刷新”Firefox,但均无济于事。

是否有一些设置将多行输入设置为默认行为?

4

1 回答 1

0

I opened the Browser Console, cleared it, and put it next to my Firefox window. Then I typed an expression in the Web Console and hit enter. The instant I did so an error appeared in the Browser Console:

NS_ERROR_UNEXPECTED: Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getIntPref] utils.js:555:0

That utils.js:555:0 is a link, taking you to that specific line of that file:

WebConsoleUtils._usageCount = Services.prefs.getIntPref("devtools.selfxss.count");

Apparently something’s seems to be up with this devtools.selfxss.count pref. I opened about:config to see if I could figure out what.

It turned out that this pref was missing! So I right-clicked, and chose “New > Integer”, entered devtools.selfxss.count as the pref name and 0 as the value.

It worked!

Then I researched what this pref is all about, and found https://bugzilla.mozilla.org/show_bug.cgi?id=994134#c89:

What does this option exactly do and does setting it to 100 completely disable this feature or making the message just less likely to appear?

The selfxss prevention works by counting the number of times you have used the console, and turning off paste protection when you cross a certain number, which is at the moment 5 (the number also stops incrementing after that). Alternatively, when you type "allow pasting" into the console when the prompt comes up, this pref is set to a number >5.

Setting it to any number more than 5 should fix this. 100 is just a high enough number that it will be resilient to all change.

The question now is why it was missing.

You could check if you’re having the same problem. Otherwise this at least might be helpful to track down your problem.

于 2015-08-30T13:04:34.483 回答