Bug 818014: strip null bytes in document titles when setting the chrome window's title, since some platform nsWindow::SetTitle implementations don't handle them correctly, r=dolske
authorGavin Sharp <gavin@gavinsharp.com>
Tue, 05 Mar 2013 22:59:30 -0800
changeset 124031 23d42f6e56b47954fe22f4dc7f43f5820e862692
parent 124030 8dc9c169f28ce30dee6d8bb04e454e8ad21fddf6
child 124032 2b6e31ff221ef2b6dd665474b0cc4cb3b56bff10
push id24406
push userryanvm@gmail.com
push dateThu, 07 Mar 2013 17:19:02 +0000
treeherdermozilla-central@71395a927025 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdolske
bugs818014
milestone22.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 818014: strip null bytes in document titles when setting the chrome window's title, since some platform nsWindow::SetTitle implementations don't handle them correctly, r=dolske
browser/base/content/tabbrowser.xml
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -778,17 +778,20 @@
       <method name="getWindowTitleForBrowser">
         <parameter name="aBrowser"/>
         <body>
           <![CDATA[
             var newTitle = "";
             var docElement = this.ownerDocument.documentElement;
             var sep = docElement.getAttribute("titlemenuseparator");
 
-            var docTitle = aBrowser.contentTitle;
+            // Strip out any null bytes in the content title, since the
+            // underlying widget implementations of nsWindow::SetTitle pass
+            // null-terminated strings to system APIs.
+            var docTitle = aBrowser.contentTitle.replace("\0", "");
 
             if (!docTitle)
               docTitle = docElement.getAttribute("titledefault");
 
             var modifier = docElement.getAttribute("titlemodifier");
             if (docTitle) {
               newTitle += docElement.getAttribute("titlepreface");
               newTitle += docTitle;