Bug 691690 - Part 2: Use UTF-8 flag on copy. r=gavin a=asa
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Fri, 07 Oct 2011 07:35:17 +0900
changeset 78309 99db0336dcd19d7770c1e187a5e9a66a6d54a285
parent 78308 dae0bfc9a7608d500e4a75002f30db48567d6f11
child 78310 4da434beb5377fe1a06800ff165cfb965cc04865
push id473
push userdgottwald@mozilla.com
push dateWed, 26 Oct 2011 12:31:10 +0000
treeherdermozilla-aurora@99db0336dcd1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin, asa
bugs691690
milestone9.0a2
Bug 691690 - Part 2: Use UTF-8 flag on copy. r=gavin a=asa
browser/base/content/test/browser_urlbarCopying.js
browser/base/content/urlbarBindings.xml
--- a/browser/base/content/test/browser_urlbarCopying.js
+++ b/browser/base/content/test/browser_urlbarCopying.js
@@ -85,16 +85,30 @@ var tests = [
     copyVal: "e<xample.com/\xe9>\xe9",
     copyExpected: "xample.com/\xe9"
   },
   {
     copyVal: "<example.com/\xe9>\xe9",
     copyExpected: "http://example.com/\xe9"
   },
 
+  {
+    loadURL: "http://example.com/?%C3%B7%C3%B7",
+    expectedURL: "example.com/?\xf7\xf7",
+    copyExpected: "http://example.com/?%C3%B7%C3%B7"
+  },
+  {
+    copyVal: "e<xample.com/?\xf7>\xf7",
+    copyExpected: "xample.com/?\xf7"
+  },
+  {
+    copyVal: "<example.com/?\xf7>\xf7",
+    copyExpected: "http://example.com/?\xf7"
+  },
+
   // data: and javsacript: URIs shouldn't be encoded
   {
     loadURL: "javascript:('%C3%A9')",
     expectedURL: "javascript:('\xe9')",
     copyExpected: "javascript:('\xe9')"
   },
   {
     copyVal: "<javascript:(>'\xe9')",
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -501,17 +501,17 @@
           // modified, nothing else to do here.
           if (this.selectionStart > 0 || this.valueIsTyped)
             return selectedVal;
 
           let uriFixup = Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci.nsIURIFixup);
 
           let uri;
           try {
-            uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
+            uri = uriFixup.createFixupURI(inputVal, Ci.nsIURIFixup.FIXUP_FLAG_USE_UTF8);
           } catch (e) {}
           if (!uri)
             return selectedVal;
 
           // Only copy exposable URIs
           try {
             uri = uriFixup.createExposableURI(uri);
           } catch (ex) {}