Closed
Bug 956482
Opened 11 years ago
Closed 10 years ago
Rewrite inline script in /browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml (about:privatebrowsing)
Categories
(Firefox :: General, defect)
Tracking
()
VERIFIED
FIXED
Firefox 36
People
(Reporter: desiradaniel2007, Assigned: desiradaniel2007)
References
(Blocks 1 open bug)
Details
Attachments
(1 file, 8 obsolete files)
(deleted),
patch
|
jaws
:
review+
|
Details | Diff | Splinter Review |
With the current plan to harden the security of Firefox, we want to disallow internal privileged pages to use inline JavaScript. Since their amount is fairly limited, we start this by rewriting them bit by bit.
Assignee | ||
Comment 1•11 years ago
|
||
I am not sure as to whether I got the URLs right and cannot test since I haven't configured the build system yet.
As commented in the markup, I have found platform-specific styles for about:privatebrowsing so I decided to create a new file with the inline style.
Attachment #8361861 -
Flags: review+
Flags: needinfo?
Updated•11 years ago
|
Flags: needinfo?
Comment 2•11 years ago
|
||
Comment on attachment 8361861 [details] [diff] [review]
aboutPrivateBrowsingCSSJS.patch
Thanks for the patch, Daniel. I asked Freddy for feedback on it.
Attachment #8361861 -
Flags: review+ → feedback?(fbraun)
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•11 years ago
|
Assignee: nobody → desiradaniel2007
Status: NEW → ASSIGNED
Comment 3•11 years ago
|
||
Comment on attachment 8361861 [details] [diff] [review]
aboutPrivateBrowsingCSSJS.patch
Review of attachment 8361861 [details] [diff] [review]:
-----------------------------------------------------------------
This looks good in general. There are some minor questions I have, though:
::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ +3,5 @@
> +
> +Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
> +
> +if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
> + document.title = "]]>&privatebrowsingpage.title.normal;<![CDATA[";
It think we had problems with these custom entities in similar bugs. Have you confirmed this works?
::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
@@ +29,3 @@
>
> + <!-- Style shared between platforms -->
> + <link rel="stylesheet" href="chrome://content/browser/aboutPrivateBrowsing.css" type="text/css" media="all"/>
There's already another aboutPrivateBrowsing.css referenced above. What's the reason behind having two separate files?
::: browser/components/privatebrowsing/jar.mn
@@ +4,3 @@
>
> browser.jar:
> * content/browser/aboutPrivateBrowsing.xhtml (content/aboutPrivateBrowsing.xhtml)
While you're at it, please remove the trailing whitespace (this is what we call un-needed space characters after an ending line).
Attachment #8361861 -
Flags: feedback?(fbraun) → feedback+
Assignee | ||
Comment 4•11 years ago
|
||
Snippet 1: Are referring to the string assigned to document.title? I will build on my system after reformatting HDD and fix.
Snippet 2: I believe we need that, since there seems to be different styles for Linux, OS X and Windows as commented. Would you confirm on this please?
Snippet 3: Will do.
Thanks for the feedback! :)
Assignee | ||
Comment 5•11 years ago
|
||
Here are some other fixes I believe you missed. However, those are coming as I am having trouble with "./mach build". Shall file a build system bug on that. If you would like to/can help me with it, I will send you the output I get.
Attachment #8361861 -
Attachment is obsolete: true
Comment 6•11 years ago
|
||
Sorry for not reaching out again, Daniel.
Do you still have build system issues? Feel free to try MDN and Google since some of these problems are common things that other people have dealt with already. If this doesnt help you can file a bug and CC me. I will be happy to help you moving things forward.
Can you also please refresh the patch to make sure it still applies? :)
Assignee | ||
Comment 7•10 years ago
|
||
Hello again Fredric,
I've been passing through tough personal problems and have had some serious coursework to finish up. That's why it took me another 3 months to come back.
I have recently started following CodeFirefox, which has cleared much of my confusion, but after a full build, I am getting a message that I need to clobber which I now did and had it result in a fail since "mozilla-central\obj-i686-pc-mingw32\" is not empty.
Googling for solutions did not really help. Is it possible for you to help me over this thread, Twitter or IRC please? Or is filing a Build bug more appropriate? Thanks.
Comment 8•10 years ago
|
||
You can try asking in #developers (irc.mozilla.org) before you file a bug for the build system. But I think you can safely delete all "obj-*" dirs when you do a clobbered build.
Assignee | ||
Comment 9•10 years ago
|
||
On running a successful build, I realized that my patch breaks the page, which mach reports 2 warnings for aboutPrivateBrowsing.xhtml and aboutPrivateBrowsing.css: no useful preprocessor directives found
Will be hopefully solving this by sometime this week. Thanks! :)
Comment 10•10 years ago
|
||
Here's the patch but I had to hack around &privatebrowsingpage.title because it does not work right. Suggestions?
Attachment #8473151 -
Flags: review?(gavin.sharp)
Updated•10 years ago
|
Attachment #8473151 -
Flags: review?(gavin.sharp) → review?(jaws)
Comment 11•10 years ago
|
||
Comment on attachment 8473151 [details] [diff] [review]
patch 3
Review of attachment 8473151 [details] [diff] [review]:
-----------------------------------------------------------------
This is close, just a couple things to address.
::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ +7,5 @@
> +
> +Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
> +
> +if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
> + document.title = "&privatebrowsingpage.title.normal;";
This isn't going to work. You'll need to move these strings to a .properties file and use a StringBundle to load the string from the string bundle to assign it to document.title.
@@ +11,5 @@
> + document.title = "&privatebrowsingpage.title.normal;";
> + setFavIcon("chrome://global/skin/icons/question-16.png");
> +} else {
> +#ifndef XP_MACOSX
> + //document.title = "&privatebrowsingpage.title;";
Why is this line commented out? I see that this is redundant, since the title is already set to be this value within the XHTML file, but we shouldn't show a title that might get changed in the next instant. So let's go with only setting the title from the JS file.
As a result, you can remove the `*` from the jar.mn for the XHTML file since we won't need preprocessing there anymore. Also, you can remove the `#` characters from the license header there since we won't be preprocessing that file anymore and the `#` was only used to comment out the license header from the build output.
::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
@@ +23,3 @@
> <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all"/>
> <link rel="stylesheet" href="chrome://browser/skin/aboutPrivateBrowsing.css" type="text/css" media="all"/>
> + <link rel="stylesheet" href="chrome://browser/content/aboutPrivateBrowsing.css" type="text/css"></link>
Please move the content stylesheet to be included before the skin stylesheet, so that themes can override the content styling if necessary.
Attachment #8473151 -
Flags: review?(jaws) → review-
Assignee | ||
Comment 12•10 years ago
|
||
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #11)
> Comment on attachment 8473151 [details] [diff] [review]
> patch 3
>
> Review of attachment 8473151 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> This is close, just a couple things to address.
>
> ::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
> @@ +7,5 @@
> > +
> > +Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
> > +
> > +if (!PrivateBrowsingUtils.isWindowPrivate(window)) {
> > + document.title = "&privatebrowsingpage.title.normal;";
>
> This isn't going to work. You'll need to move these strings to a .properties
> file and use a StringBundle to load the string from the string bundle to
> assign it to document.title.
>
> @@ +11,5 @@
> > + document.title = "&privatebrowsingpage.title.normal;";
> > + setFavIcon("chrome://global/skin/icons/question-16.png");
> > +} else {
> > +#ifndef XP_MACOSX
> > + //document.title = "&privatebrowsingpage.title;";
>
> Why is this line commented out? I see that this is redundant, since the
> title is already set to be this value within the XHTML file, but we
> shouldn't show a title that might get changed in the next instant. So let's
> go with only setting the title from the JS file.
>
> As a result, you can remove the `*` from the jar.mn for the XHTML file since
> we won't need preprocessing there anymore. Also, you can remove the `#`
> characters from the license header there since we won't be preprocessing
> that file anymore and the `#` was only used to comment out the license
> header from the build output.
>
Are you sure about that? There are still some XHTML entities remaining once &privatebrowsingpage.title is removed so I don't know know how to go about it. :)
> ::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
> @@ +23,3 @@
> > <link rel="stylesheet" href="chrome://global/skin/netError.css" type="text/css" media="all"/>
> > <link rel="stylesheet" href="chrome://browser/skin/aboutPrivateBrowsing.css" type="text/css" media="all"/>
> > + <link rel="stylesheet" href="chrome://browser/content/aboutPrivateBrowsing.css" type="text/css"></link>
>
> Please move the content stylesheet to be included before the skin
> stylesheet, so that themes can override the content styling if necessary.
Done!
Flags: needinfo?(jaws)
Comment 13•10 years ago
|
||
The XHTML entities will still be inserted appropriately even when preprocessing is disabled.
Flags: needinfo?(jaws)
Comment 14•10 years ago
|
||
The preprocessing was only needed for the `#ifndef` and `#endif` tokens.
Comment 15•10 years ago
|
||
So I ended up using the string bundle service since <stringbundle> is not available in XHTML. Spent some time Googling and asking on IRC and following https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Miscellaneous#Using_string_bundles_from_JavaScript
Only one thing is unclear: How should I construct .properties file URL relative to directory.
Comment 16•10 years ago
|
||
Quick update: Almost done. Just some merge conflicts to overcome due to recent changes.
Comment 17•10 years ago
|
||
This should do it. Proven to work for the new about:privatebrowsing! :D
Attachment #8473151 -
Attachment is obsolete: true
Attachment #8485860 -
Flags: review?(jaws)
Comment 18•10 years ago
|
||
Comment on attachment 8485860 [details] [diff] [review]
aboutPrivateBrowsing
Review of attachment 8485860 [details] [diff] [review]:
-----------------------------------------------------------------
Sorry for not getting to this until now.
::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml
@@ -30,5 @@
> - setFavIcon("chrome://global/skin/icons/question-16.png");
> - } else {
> -#ifndef XP_MACOSX
> - document.title = "]]>&aboutPrivateBrowsing.title;<![CDATA[";
> -#endif
Weird, so previously new tabs on Mac in Private Browsing mode would show "New Tab" as the page title, but on Windows and Linux we showed "You're browsing privately". "You're browsing privately" probably doesn't make much sense for the title of new tabs in private browsing mode, with maybe the exception of the first tab.
Let's stick with what you've got for this patch and file a new bug to figure out what we want the tab titles to be for new tabs in Private Browsing mode.
Attachment #8485860 -
Flags: review?(jaws) → review+
Updated•10 years ago
|
Attachment #8377272 -
Attachment is obsolete: true
Comment 19•10 years ago
|
||
I had to update your patch since http://hg.mozilla.org/mozilla-central/rev/380f8554aa17 just landed and added some more classes to elements within the page.
I pushed the updated patch to the tryserver so we can run it through all of the automated tests. After the tests finish, we'll know if anything was broken from these changes.
If everything looks good, we can add the checkin-needed keyword to this bug. The patch will then be checked-in and should appear in Firefox Nightly within a couple days.
You can view the progress of your build at the following URL:
https://tbpl.mozilla.org/?tree=Try&rev=0b63634d0440
Comment 20•10 years ago
|
||
Comment on attachment 8485860 [details] [diff] [review]
aboutPrivateBrowsing
Review of attachment 8485860 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for the patch, nicely done!
I've landed the patch for you:
https://hg.mozilla.org/integration/fx-team/rev/4b5f794b80a8
Below are the changes I made:
> Bug 956442 - Rewrite inline script in /browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml (about:privatebrowsing); r=reviewers
I fixed the bug number in your commit message (should be 956482).
::: browser/components/privatebrowsing/jar.mn
@@ -2,5 @@
> # License, v. 2.0. If a copy of the MPL was not distributed with this
> # file, You can obtain one at http://mozilla.org/MPL/2.0/.
>
> browser.jar:
> -* content/browser/aboutPrivateBrowsing.css (content/aboutPrivateBrowsing.css)
This file still needs to be pre-processed due to the license header.
Updated•10 years ago
|
Flags: qe-verify+
Whiteboard: [fixed in fx-team]
Comment 21•10 years ago
|
||
Backed out for debug OSX perma-fail.
https://hg.mozilla.org/integration/fx-team/rev/a6e449e2c13e
https://tbpl.mozilla.org/php/getParsedLog.php?id=47913954&tree=Fx-Team
Whiteboard: [fixed in fx-team]
Assignee | ||
Comment 22•10 years ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #21)
> Backed out for debug OSX perma-fail.
> https://hg.mozilla.org/integration/fx-team/rev/a6e449e2c13e
>
> https://tbpl.mozilla.org/php/getParsedLog.php?id=47913954&tree=Fx-Team
Any insight to what we could do about that?
Comment 23•10 years ago
|
||
(In reply to desiradaniel2007 from comment #22)
> (In reply to Ryan VanderMeulen [:RyanVM UTC-4] from comment #21)
> > Backed out for debug OSX perma-fail.
> > https://hg.mozilla.org/integration/fx-team/rev/a6e449e2c13e
> >
> > https://tbpl.mozilla.org/php/getParsedLog.php?id=47913954&tree=Fx-Team
>
> Any insight to what we could do about that?
It looks like browser_privatebrowsing_windowtitle.js needs to be updated now that OSX uses the same title for new private windows as Windows/Linux.
Assignee | ||
Comment 24•10 years ago
|
||
We also need to clarifiy whether the names I used in the properties file are compliant with the coding conventions.
(In reply to Jared Wein [:jaws] (please needinfo? me) from comment #23)
> It looks like browser_privatebrowsing_windowtitle.js needs to be updated now
> that OSX uses the same title for new private windows as Windows/Linux.
Hmm, that's likely to be better to be tracked within another bug as it should have been introduced by a change other than mine. Although I don't own a mac, I am willing to give it a shot.
Assignee | ||
Updated•10 years ago
|
Summary: Rewrite inline script/style in /browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml (about:privatebrowsing) → Rewrite inline script in /browser/components/privatebrowsing/content/aboutPrivateBrowsing.xhtml (about:privatebrowsing)
Assignee | ||
Comment 25•10 years ago
|
||
Hi guys, sorry for taking so long on this one. I have just checked the diff for my patch and realized I mistakenly used the older version of the page so perhaps simply rewriting my patch over the last code-base could do it.
Expect a working patch any time soon. :)
Comment 26•10 years ago
|
||
Sounds good, thanks for the update.
Comment 27•10 years ago
|
||
Please build and test on OS X.
Attachment #8485860 -
Attachment is obsolete: true
Attachment #8515327 -
Flags: review?(mak77)
Updated•10 years ago
|
Attachment #8515327 -
Flags: review?(mak77) → review?(jaws)
Assignee | ||
Comment 28•10 years ago
|
||
Any update regarding review please?
Comment 29•10 years ago
|
||
Hey, what a coincidence. I'm actually doing the review as I write this. I had to get my OSX build up to date. Sorry, I should have commented in here earlier.
Assignee | ||
Comment 30•10 years ago
|
||
Thanks! :)
Comment 31•10 years ago
|
||
Comment on attachment 8515327 [details] [diff] [review]
aboutPrivateBrowsing2
Review of attachment 8515327 [details] [diff] [review]:
-----------------------------------------------------------------
::: browser/components/privatebrowsing/content/aboutPrivateBrowsing.js
@@ +13,5 @@
> + document.title = stringBundle.GetStringFromName("title.normal");
> + setFavIcon("chrome://global/skin/icons/question-16.png");
> +} else {
> +#ifndef XP_MACOSX
> + document.title = stringBundle.GetStringFromName("title");
So there is still an issue here where the XP_MACOSX symbol is not defined in this file. I'm not sure why.
We can drop this special casing though, and just make all new tabs in private windows have this string. It doesn't make sense that OSX gets a different new tab title for private windows. Note that you'll still have to update the test as mentioned in comment #23.
Attachment #8515327 -
Flags: review?(jaws) → review-
Assignee | ||
Comment 32•10 years ago
|
||
I'm sorry, I missed that! Will give it a try later on this week. Should reply by Sunday. Cheers!
Comment 33•10 years ago
|
||
Hi, I have modified the test and am not sure whether I have done everything needed but please let me know :)
Attachment #8515327 -
Attachment is obsolete: true
Attachment #8518413 -
Flags: review?(jaws)
Updated•10 years ago
|
Attachment #8518413 -
Attachment is patch: true
Assignee | ||
Comment 34•10 years ago
|
||
Has anyone running OS X re-run the test?
Comment 35•10 years ago
|
||
The test still hangs for me. I'm looking a bit deeper. We should get you level-1 try access so you can push to the tryserver and have it run the OSX tests for you :)
You can follow the instructions here, https://www.mozilla.org/en-US/about/governance/policies/commit/
Comment 36•10 years ago
|
||
Ok, I fixed the test on Mac. Daniel, can you run the test on your machine and see if it passes for you in your environment still? To run it, you should run `mach mochitest-browser browser/components/privatebrowsing/test/browser/browser_privatebrowsing_windowtitle.js`
Flags: needinfo?(desiradaniel2007)
Assignee | ||
Comment 37•10 years ago
|
||
It's a shame for me that I did not do it properly. That was too easy! Will run the test as soon as I'm on that machine. Thanks :)
Comment 38•10 years ago
|
||
I tested out that patch on Windows and noticed that it now failed on Windows. With a minor tweak it should now work everywhere.
I pushed it to the tryserver to make sure that it will work everywhere now.
The rest of the patch looks good. Once the tryserver results come back and show that nothing has failed, we can get this checked in.
Nice work and congratulations on getting your first patch r+'d \o/
You can view the progress of your build at the following URL:
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=b2e5664d809e
Alternatively, view them on TBPL (soon to be deprecated):
https://tbpl.mozilla.org/?tree=Try&rev=b2e5664d809e
Attachment #8518413 -
Attachment is obsolete: true
Attachment #8520202 -
Attachment is obsolete: true
Attachment #8518413 -
Flags: review?(jaws)
Flags: needinfo?(desiradaniel2007)
Attachment #8521510 -
Flags: review+
Comment 39•10 years ago
|
||
Hey, thanks! I have just run it on my system (Win7) and it seems to pass. (No fail message.)
Actually, this is my second patch.
Will be keeping tabs on the try build's progress to see if there's anything I can do.
Thanks again! :)
Comment 40•10 years ago
|
||
Ah, you're multiple bugzilla accounts (that only differ by the domain) confused me. Nonetheless, the congrats stays ;)
Comment 41•10 years ago
|
||
I just noticed that the commit message had the wrong bug number listed.
Attachment #8521510 -
Attachment is obsolete: true
Attachment #8521716 -
Flags: review+
Updated•10 years ago
|
Keywords: checkin-needed
Comment 42•10 years ago
|
||
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Comment 43•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → Firefox 36
Assignee | ||
Comment 44•10 years ago
|
||
Again? :/ Thanks for the coordination.
Comment 45•10 years ago
|
||
You're also missing a license header in the .properties file.
Comment 46•10 years ago
|
||
(In reply to Francesco Lodolo [:flod] from comment #45)
> You're also missing a license header in the .properties file.
Also, file is using Windows line ending, which is definitely unusual (not sure if there's a policy for that).
Comment 47•10 years ago
|
||
Added the license header and fixed the line endings,
https://hg.mozilla.org/integration/fx-team/rev/6b7bd35aca3d
Comment 48•10 years ago
|
||
Assignee | ||
Comment 49•10 years ago
|
||
Cheers guys. Notes taken for next patch!
Comment 50•10 years ago
|
||
As written in comment 18, reproduced with Nightly from 2014-09-21 under Mac OS X 10.8.5 the fact that 'New tab' is displayed as title when opening a PB window. With Fx 36 beta 8 (Build ID: 20150209164123), 'You're browsing privately' is displayed on Windows 7 64-bit, Mac OS X 10.8.5 and Ubuntu 14.04 32-bit.
Please let me know at what else should I look in order to properly verify this bug. Thanks in advance!
Flags: needinfo?(desiradaniel2007)
Comment 51•10 years ago
|
||
That should be enough to verify this bug. Thanks!
Status: RESOLVED → VERIFIED
Flags: needinfo?(desiradaniel2007)
You need to log in
before you can comment on or make changes to this bug.
Description
•