Bug 851527 Strip null bytes in document titles when setting the chrome window's title r=Neil.
authorPhilip Chee <philip.chee@gmail.com>
Sat, 16 Mar 2013 16:48:52 +0800
changeset 12126 bf49737b12dcda93bd8a1d63888b6badfbc5b288
parent 12125 93e89494abfdb6f7589fffc5e204c315fa87f60d
child 12127 dad7d607621d10e2d8e23581a8c6aaec932d9c2b
push id9000
push userphilip.chee@gmail.com
push dateSat, 16 Mar 2013 08:49:48 +0000
treeherdercomm-central@bf49737b12dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersNeil
bugs851527
Bug 851527 Strip null bytes in document titles when setting the chrome window's title r=Neil.
suite/browser/tabbrowser.xml
--- a/suite/browser/tabbrowser.xml
+++ b/suite/browser/tabbrowser.xml
@@ -871,18 +871,21 @@
         <body>
           <![CDATA[
             var newTitle = "";
             var docTitle;
             var docElement = this.ownerDocument.documentElement;
             var sep = docElement.getAttribute("titlemenuseparator");
             var modifier = docElement.getAttribute("titlemodifier");
 
+            // Strip out any null bytes in the content title, since the
+            // underlying widget implementations of nsWindow::SetTitle pass
+            // null-terminated strings to system APIs.
             if (this.docShell.contentViewer)
-              docTitle = this.contentTitle;
+              docTitle = this.contentTitle.replace(/\0+/g, "");
 
             if (!docTitle && !modifier) {
               docTitle = this.getTitleForURI(this.mCurrentBrowser.currentURI);
               if (!docTitle) {
                 // Here we actually override contenttitlesetting, because we
                 // don't want the titledefault value.
                 docTitle = this.mStringBundle.getString("tabs.untitled");
               }