зеркало из https://github.com/mozilla/pjs.git
Bug 348233 - FTP and Gopher index pages are LTR always; r+sr=bzbarsky
This commit is contained in:
Родитель
9f2feea1a9
Коммит
8c09439d28
|
@ -23,6 +23,7 @@
|
|||
* Bradley Baetz <bbaetz@cs.mcgill.ca>
|
||||
* Christopher A. Aillon <christopher@aillon.com>
|
||||
* Dão Gottwald <dao@design-noir.de>
|
||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -156,7 +157,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
channel->SetContentType(NS_LITERAL_CSTRING("text/html"));
|
||||
channel->SetContentType(NS_LITERAL_CSTRING("application/xhtml+xml"));
|
||||
|
||||
mParser = do_CreateInstance("@mozilla.org/dirIndexParser;1",&rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -275,9 +276,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
}
|
||||
|
||||
nsString buffer;
|
||||
buffer.AppendLiteral("<!DOCTYPE html>\n"
|
||||
"<html>\n<head>\n"
|
||||
"<meta http-equiv=\"content-type\" content=\"text/html; charset=");
|
||||
buffer.AppendLiteral("<?xml version=\"1.0\" encoding=\"");
|
||||
|
||||
// Get the encoding from the parser
|
||||
// XXX - this won't work for any encoding set via a 301: line in the
|
||||
|
@ -289,8 +288,13 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
AppendASCIItoUTF16(encoding, buffer);
|
||||
buffer.AppendLiteral("\">\n"
|
||||
"<style type=\"text/css\">\n"
|
||||
buffer.AppendLiteral("\"?>\n"
|
||||
"<!DOCTYPE html ["
|
||||
" <!ENTITY % globalDTD SYSTEM \"chrome://global/locale/global.dtd\">\n"
|
||||
" %globalDTD;\n"
|
||||
"]>\n"
|
||||
"<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n"
|
||||
"<style type=\"text/css\"><![CDATA[\n"
|
||||
":root {\n"
|
||||
" font-family: sans-serif;\n"
|
||||
"}\n"
|
||||
|
@ -298,7 +302,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
" border: 0;\n"
|
||||
"}\n"
|
||||
"th {\n"
|
||||
" text-align: left;\n"
|
||||
" text-align: start;\n"
|
||||
" white-space: nowrap;\n"
|
||||
"}\n"
|
||||
"th > a {\n"
|
||||
|
@ -311,7 +315,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
" display: none;\n"
|
||||
" width: .8em;\n"
|
||||
" -moz-margin-end: -.8em;\n"
|
||||
" text-align: right;\n"
|
||||
" text-align: end;\n"
|
||||
"}\n"
|
||||
"table[order=\"asc\"] > thead > tr > th::after {\n"
|
||||
" content: \"\\2193\"; /* DOWNWARDS ARROW (U+2193) */\n"
|
||||
|
@ -344,7 +348,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
" -moz-padding-end: 1em;\n"
|
||||
"}\n"
|
||||
"td:first-child + td {\n"
|
||||
" text-align: right;\n"
|
||||
" text-align: end;\n"
|
||||
" -moz-padding-end: 1em;\n"
|
||||
" white-space: nowrap;\n"
|
||||
"}\n"
|
||||
|
@ -364,6 +368,9 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
" white-space: pre !important;\n"
|
||||
" font-family: monospace;\n"
|
||||
" }\n"
|
||||
" table {\n"
|
||||
" direction: ltr;\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
".symlink {\n"
|
||||
" font-style: italic;\n"
|
||||
|
@ -382,12 +389,12 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
".dir::before {\n"
|
||||
" content: url(resource://gre/res/html/folder.png);\n"
|
||||
"}\n"
|
||||
"</style>\n"
|
||||
"]]></style>\n"
|
||||
"<link rel=\"stylesheet\" media=\"screen, projection\" type=\"text/css\""
|
||||
" href=\"chrome://global/skin/dirListing/dirListing.css\">\n");
|
||||
" href=\"chrome://global/skin/dirListing/dirListing.css\" />\n");
|
||||
|
||||
if (!isSchemeGopher) {
|
||||
buffer.AppendLiteral("<script type=\"application/javascript\">\n"
|
||||
buffer.AppendLiteral("<script type=\"application/javascript\"><![CDATA[\n"
|
||||
"var gTable, gOrderBy, gTBody, gRows, gUI_showHidden;\n"
|
||||
"document.addEventListener(\"DOMContentLoaded\", function() {\n"
|
||||
" gTable = document.getElementsByTagName(\"table\")[0];\n"
|
||||
|
@ -465,7 +472,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
" \"\" :\n"
|
||||
" \"remove-hidden\";\n"
|
||||
"}\n"
|
||||
"</script>\n");
|
||||
"]]></script>\n");
|
||||
}
|
||||
buffer.AppendLiteral("<link rel=\"icon\" type=\"image/png\" href=\"");
|
||||
nsCOMPtr<nsIURI> innerUri = NS_GetInnermostURI(uri);
|
||||
|
@ -516,7 +523,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
"BYWFOWicuqppoNTnStHzPFCPQhBEBOyGAX4JMADFetubi4BS"
|
||||
"YAAAAABJRU5ErkJggg%3D%3D");
|
||||
}
|
||||
buffer.AppendLiteral("\">\n<title>");
|
||||
buffer.AppendLiteral("\" />\n<title>");
|
||||
|
||||
// Anything but a gopher url needs to end in a /,
|
||||
// otherwise we end up linking to file:///foo/dirfile
|
||||
|
@ -585,14 +592,14 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
nsString htmlEscapedUri;
|
||||
htmlEscapedUri.Adopt(nsEscapeHTML2(utf16BaseURI.get(), utf16BaseURI.Length()));
|
||||
buffer.Append(htmlEscapedUri);
|
||||
buffer.AppendLiteral("\">\n");
|
||||
buffer.AppendLiteral("\" />\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
NS_ERROR("broken protocol handler didn't escape double-quote.");
|
||||
}
|
||||
|
||||
buffer.AppendLiteral("</head>\n<body>\n<h1>");
|
||||
buffer.AppendLiteral("</head>\n<body dir=\"&locale.dir;\">\n<h1>");
|
||||
|
||||
const PRUnichar* formatHeading[] = {
|
||||
htmlEscSpec.get()
|
||||
|
@ -630,7 +637,7 @@ nsIndexedToHTML::OnStartRequest(nsIRequest* request, nsISupports *aContext) {
|
|||
getter_Copies(showHiddenText));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
buffer.AppendLiteral("<p id=\"UI_showHidden\" style=\"display:none\"><label><input type=\"checkbox\" checked onchange=\"updateHidden()\">");
|
||||
buffer.AppendLiteral("<p id=\"UI_showHidden\" style=\"display:none\"><label><input type=\"checkbox\" checked=\"checked\" onchange=\"updateHidden()\" />");
|
||||
AppendNonAsciiToNCR(showHiddenText, buffer);
|
||||
buffer.AppendLiteral("</label></p>\n");
|
||||
}
|
||||
|
@ -934,7 +941,7 @@ nsIndexedToHTML::OnIndexAvailable(nsIRequest *aRequest,
|
|||
getter_Copies(altText));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
AppendNonAsciiToNCR(altText, pushBuffer);
|
||||
pushBuffer.AppendLiteral("\">");
|
||||
pushBuffer.AppendLiteral("\" />");
|
||||
}
|
||||
|
||||
pushBuffer.Append(escapedShort);
|
||||
|
|
|
@ -61,6 +61,7 @@ _TEST_FILES = findbar_window.xul \
|
|||
bug429723_window.xul \
|
||||
test_bug429723.xul \
|
||||
bug437844.css \
|
||||
bug437844.dtd \
|
||||
bug437844.manifest \
|
||||
test_bug437844.xul \
|
||||
bug451286_window.xul \
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
<!ENTITY locale.dir "rtl">
|
|
@ -1,2 +1,3 @@
|
|||
# Override intl.css with our own CSS file
|
||||
override chrome://global/locale/intl.css chrome://mochikit/content/chrome/toolkit/content/tests/chrome/bug437844.css
|
||||
override chrome://global/locale/global.dtd chrome://mochikit/content/chrome/toolkit/content/tests/chrome/bug437844.dtd
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=437844
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=348233
|
||||
-->
|
||||
<window title="Mozilla Bug 437844"
|
||||
<window title="Mozilla Bug 437844 and Bug 348233"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<title>Test for Bug 437844</title>
|
||||
<title>Test for Bug 437844 and Bug 348233</title>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
|
@ -21,6 +22,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=437844
|
|||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=437844">
|
||||
Mozilla Bug 437844
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=348233">
|
||||
Mozilla Bug 348233
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
@ -109,7 +114,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=437844
|
|||
<script class="testbody" type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 437844 **/
|
||||
/** Test for Bug 437844 and Bug 348233 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// Disable XUL cache temporarily
|
||||
|
@ -145,12 +150,21 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=437844
|
|||
|
||||
is(frame.contentDocument.dir, "rtl", "about:plugins should be RTL in RTL locales");
|
||||
|
||||
// cleanup
|
||||
dirSvc.unregisterProvider(provider);
|
||||
cr.checkForNewChrome();
|
||||
cr.refreshSkins();
|
||||
prefs.clearUserPref(XUL_CACHE_PREF);
|
||||
SimpleTest.finish();
|
||||
frame = document.createElement("iframe");
|
||||
frame.setAttribute("src", uri.spec); // a file:// URI, bug 348233
|
||||
frame.addEventListener("load", function () {
|
||||
frame.removeEventListener("load", arguments.callee, false);
|
||||
|
||||
is(frame.contentDocument.body.dir, "rtl", "file:// listings should be RTL in RTL locales");
|
||||
|
||||
// cleanup
|
||||
dirSvc.unregisterProvider(provider);
|
||||
cr.checkForNewChrome();
|
||||
cr.refreshSkins();
|
||||
prefs.clearUserPref(XUL_CACHE_PREF);
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
document.documentElement.appendChild(frame);
|
||||
}, false);
|
||||
document.documentElement.appendChild(frame);
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -77,11 +78,19 @@ p {
|
|||
float: left;
|
||||
}
|
||||
|
||||
body[dir="rtl"] #UI_goUp {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#UI_showHidden {
|
||||
margin-top: 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
body[dir="rtl"] #UI_showHidden {
|
||||
float: left;
|
||||
}
|
||||
|
||||
table {
|
||||
clear: both;
|
||||
width: 90%;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
|
@ -77,11 +78,19 @@ p {
|
|||
float: left;
|
||||
}
|
||||
|
||||
body[dir="rtl"] #UI_goUp {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#UI_showHidden {
|
||||
margin-top: 0;
|
||||
float: right;
|
||||
}
|
||||
|
||||
body[dir="rtl"] #UI_showHidden {
|
||||
float: left;
|
||||
}
|
||||
|
||||
table {
|
||||
clear: both;
|
||||
width: 90%;
|
||||
|
|
|
@ -1460,14 +1460,14 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
|
|||
#endif
|
||||
|
||||
// setup the original channel's content type
|
||||
(void)aChannel->SetContentType(NS_LITERAL_CSTRING("text/html"));
|
||||
(void)aChannel->SetContentType(NS_LITERAL_CSTRING("application/xhtml+xml"));
|
||||
|
||||
// Otherwise, lets use the html listing
|
||||
nsCOMPtr<nsICategoryManager> catMan(do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
nsXPIDLCString contractID;
|
||||
rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "text/html",
|
||||
rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", "application/xhtml+xml",
|
||||
getter_Copies(contractID));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
@ -1478,11 +1478,11 @@ nsDirectoryViewerFactory::CreateInstance(const char *aCommand,
|
|||
nsCOMPtr<nsIStreamListener> listener;
|
||||
|
||||
if (viewSource) {
|
||||
rv = factory->CreateInstance("view-source", aChannel, aLoadGroup, "text/html; x-view-type=view-source",
|
||||
rv = factory->CreateInstance("view-source", aChannel, aLoadGroup, "application/xhtml+xml; x-view-type=view-source",
|
||||
aContainer, aExtraInfo, getter_AddRefs(listener),
|
||||
aDocViewerResult);
|
||||
} else {
|
||||
rv = factory->CreateInstance("view", aChannel, aLoadGroup, "text/html",
|
||||
rv = factory->CreateInstance("view", aChannel, aLoadGroup, "application/xhtml+xml",
|
||||
aContainer, aExtraInfo, getter_AddRefs(listener),
|
||||
aDocViewerResult);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче