Closed Bug 783858 Opened 12 years ago Closed 12 years ago

Unicode in script names breaks scratchpad's recent files

Categories

(DevTools Graveyard :: Scratchpad, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 19

People

(Reporter: espadrine, Assigned: anton)

Details

Attachments

(1 file, 1 obsolete file)

Reproducible.
1. Create a file on your hard drive, name it ☕.
2. Open a scratchpad, File > Open, select the file you have just created.
3. Restart Firefox.
4. Open the scratchpad: the File > Open Recent menu is greyed out.

We get the following output in the terminal:
JavaScript error: chrome://browser/content/scratchpad.js, line 744: SyntaxError: JSON.parse: bad control character in string literal
This patch fixes the issue (get/setCharPref don't play nice with unicode strings) and updates recent-files test to test for unicode filenames.
Assignee: nobody → anton
Status: NEW → ASSIGNED
Attachment #674068 - Flags: review?(rcampbell)
Attachment #674068 - Flags: review?(fayearthur)
Comment on attachment 674068 [details] [diff] [review]
Use set/getComplexValue instead of set/getCharPref

Review of attachment 674068 [details] [diff] [review]:
-----------------------------------------------------------------

looks good. Use some consts!

::: browser/devtools/scratchpad/scratchpad.js
@@ +737,3 @@
>      if (branch.prefHasUserValue("recentFilePaths")) {
> +      let data = branch.getComplexValue("recentFilePaths",
> +        Components.interfaces.nsISupportsString).data;

you can use Ci.nsISupportsString here.

@@ +786,5 @@
> +    // WARNING: Do not use setCharPref here, it doesn't play nicely with
> +    // Unicode strings.
> +
> +    let str = Components.classes["@mozilla.org/supports-string;1"]
> +      .createInstance(Components.interfaces.nsISupportsString);

Cc and Ci. We have those consts for convenience!

::: browser/devtools/scratchpad/test/browser_scratchpad_bug_651942_recent_files.js
@@ +27,4 @@
>  
>  // Temporary file names.
>  let gFileName01 = "file01_ForBug651942.tmp"
> +let gFileName02 = "☕" // See bug 783858 for more information

delicious.
Attachment #674068 - Flags: review?(rcampbell) → review+
Changed the patch to use Cc and Ci constants. Carrying over r+.
Attachment #674068 - Attachment is obsolete: true
Attachment #674068 - Flags: review?(fayearthur)
Attachment #674303 - Flags: review+
Whiteboard: [land-in-fx-team]
Comment on attachment 674303 [details] [diff] [review]
Use set/getComplexValue instead of set/getCharPref

Review of attachment 674303 [details] [diff] [review]:
-----------------------------------------------------------------

Wanted to land this patch, but I'd like to know if you have a green try push?

::: browser/devtools/scratchpad/test/browser_scratchpad_bug_651942_recent_files.js
@@ +27,4 @@
>  
>  // Temporary file names.
>  let gFileName01 = "file01_ForBug651942.tmp"
> +let gFileName02 = "☕" // See bug 783858 for more information

This might fail - based on previous experience you might need to use the unicode escape \uNNNN.
Priority: -- → P2
Try build: https://tbpl.mozilla.org/?tree=Try&rev=349cfa48cc70
The build seems green to me.
https://hg.mozilla.org/integration/fx-team/rev/9e56a20d367f
Whiteboard: [land-in-fx-team] → [fixed-in-fx-team]
Backed out on suspicion of causing mochitest-1 and 3 permaorange:
https://hg.mozilla.org/integration/fx-team/rev/c5e7f0bbdb84
Whiteboard: [fixed-in-fx-team]
Relanded:
https://hg.mozilla.org/integration/fx-team/rev/45bfc549dcac
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/45bfc549dcac
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 19
Product: Firefox → DevTools
Product: DevTools → DevTools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: