Closed
Bug 972218
Opened 11 years ago
Closed 6 years ago
Console string substitution doesn't work in addons
Categories
(DevTools :: Console, defect, P3)
DevTools
Console
Tracking
(Not tracked)
RESOLVED
INVALID
People
(Reporter: grobinson, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [console-papercuts])
Attachments
(1 file)
46.02 KB,
patch
|
Details | Diff | Splinter Review |
According to [0], Firefox's console.log has had string substitutions since Firefox 9.0. If I open the web console and run
console.log("foo %s", "bar)
I get "foo bar", as expected. But the same use of string substitutions in addon code fails, and no substitution is performed. I've created a simple example add-on [1] to demonstrate this problem.
STR:
1. Install the example add-on (in a clean profile if you want)
2. Check the Browser Console (or your terminal, if you ran Firefox from the command line)
3. Output: "foo %s, 1+1=%d, Math.PI=%f" "bar" 2 3.141592653589793
4. Expected: "foo bar, 1+1=2, Math.PI=3.141592653589793"
This addon was created with the Jetpack SDK [2], so it's possible that the issue is with those API's instead.
[0] https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions
[1] https://people.mozilla.org/~grobinson/console-string-sub-bug.xpi
[2] https://developer.mozilla.org/en-US/Add-ons/SDK
Comment 1•11 years ago
|
||
+1, I think we should pursue a 'no surprises' policy with console, it should work consistently regardless of environment.
Comment 2•11 years ago
|
||
The console API is being rewritten in C++ and it will unify implementations.
Depends on: 965860
Updated•11 years ago
|
OS: Linux → All
Priority: -- → P3
Hardware: x86_64 → All
Updated•10 years ago
|
Whiteboard: [console-papercuts]
Updated•10 years ago
|
Whiteboard: [console-papercuts] → [console-papercuts][devedition-40]
Comment 3•10 years ago
|
||
Andrea - now that bug 988636 is resolved, what needs to happen here? Mainly curious, this isn't very high priority just now.
Flags: needinfo?(amarchesini)
Whiteboard: [console-papercuts][devedition-40] → [console-papercuts]
Comment 4•10 years ago
|
||
We didn't fix that bug yet. We unified the console in workers and main-thread but not for JSM/addons. The main reason is because that is used completely in a different way:
1. You have to import Console.jsm
2. Then create your own Console object with custom optional parameters
So, all of this is still implemented separately by Console.jsm. Very low priority, my plan is to replace the implementation with the C++ Console, without changing the current behavior too much.
Unfortunately we cannot get rid of Console.jsm because it's used by way too many addons.
Flags: needinfo?(amarchesini)
Comment 5•10 years ago
|
||
Thanks - I agree this is lower priority. I suppose we could hollow out Console.jsm so it's just a shim on the C++ component as much as possible?
Comment 6•10 years ago
|
||
Yes, that's the plan.
Comment 7•10 years ago
|
||
This is just a WIP. It breaks all the jetpack console tests and all the devtools tests (ignore the crash, that is already fixed):
https://treeherder.mozilla.org/#/jobs?repo=try&revision=6e64c3432690
I wonder how much we can change the tests to make it pass...
Updated•7 years ago
|
Product: Firefox → DevTools
Comment 8•6 years ago
|
||
just checked and works in webextension (content and background), so let's close this.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•