bug 1057841 - use noncharacters as selection delimiters in viewPartialSource.js. r=gavin
authorJonathan Kew <jkew@mozilla.com>
Thu, 28 Aug 2014 16:00:01 +0100
changeset 223844 f307e36bade8c118faa4de3eb5c1f73a05bc8f7c
parent 223843 8b6a176e89ec1323319b1ce217d58a4d9d0f9d3f
child 223845 9dfc18e7a39294bbb152592e9f45f665dcc24744
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgavin
bugs1057841
milestone34.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1057841 - use noncharacters as selection delimiters in viewPartialSource.js. r=gavin
toolkit/components/viewsource/content/viewPartialSource.js
--- a/toolkit/components/viewsource/content/viewPartialSource.js
+++ b/toolkit/components/viewsource/content/viewPartialSource.js
@@ -13,22 +13,22 @@ var gEndTargetLine = 0;
 var gTargetNode = null;
 
 var gEntityConverter = null;
 var gWrapLongLines = false;
 const gViewSourceCSS = 'resource://gre-resources/viewsource.css';
 const NS_XHTML = 'http://www.w3.org/1999/xhtml';
 
 // These are markers used to delimit the selection during processing. They
-// are removed from the final rendering, but we pick space-like characters for
-// safety (and futhermore, these are known to be mapped to a 0-length string
-// in transliterate.properties). It is okay to set start=end, we use findNext()
-// U+200B ZERO WIDTH SPACE
-const MARK_SELECTION_START = '\u200B\u200B\u200B\u200B\u200B';
-const MARK_SELECTION_END = '\u200B\u200B\u200B\u200B\u200B';
+// are removed from the final rendering.
+// We use noncharacter Unicode codepoints to minimize the risk of clashing
+// with anything that might legitimately be present in the document.
+// U+FDD0..FDEF <noncharacters>
+const MARK_SELECTION_START = '\uFDD0';
+const MARK_SELECTION_END = '\uFDEF';
 
 function onLoadViewPartialSource()
 {
   // check the view_source.wrap_long_lines pref
   // and set the menuitem's checked attribute accordingly
   gWrapLongLines = Services.prefs.getBoolPref("view_source.wrap_long_lines");
   document.getElementById("menu_wrapLongLines").setAttribute("checked", gWrapLongLines);
   document.getElementById("menu_highlightSyntax")