Merge backout. a=backout

This commit is contained in:
Mounir Lamouri 2011-05-24 15:46:13 +02:00
commit 18da1d600a
24 changed files with 86 additions and 116 deletions

View File

@ -31,7 +31,7 @@ function test() {
content.location =
"data:text/html," +
"<style type='text/css'>%23test-image,%23not-test-image {background-image: url('about:logo?c');}</style>" +
"<style type='text/css'>#test-image,#not-test-image {background-image: url('about:logo?c');}</style>" +
"<img src='about:logo?b' height=300 width=350 alt=2 id='not-test-image'>" +
"<img src='about:logo?b' height=300 width=350 alt=2>" +
"<img src='about:logo?a' height=200 width=250>" +

View File

@ -15,12 +15,12 @@ function test() {
}
// very long page that produces black bars at the right
let html1 = '<html><body style="background-color: %2300f;">' +
'<div style="background: %23fff; width: 95%; height: 10000px; ' +
let html1 = '<html><body style="background-color: #00f;">' +
'<div style="background: #fff; width: 95%; height: 10000px; ' +
' margin: 0 auto;"></div></body></html>';
// very short page that produces black bars at the bottom
let html2 = '<html><body style="background-color: %2300f;"></body></html>';
let html2 = '<html><body style="background-color: #00f;"></body></html>';
let tests = [{
url: 'data:text/html,' + html1,

View File

@ -867,6 +867,7 @@ ContentParent::RecvSetURITitle(const IPC::URI& uri,
bool
ContentParent::RecvShowFilePicker(const PRInt16& mode,
const PRInt16& selectedType,
const PRBool& addToRecentDocs,
const nsString& title,
const nsString& defaultFile,
const nsString& defaultExtension,
@ -892,7 +893,9 @@ ContentParent::RecvShowFilePicker(const PRInt16& mode,
*result = filePicker->Init(window, title, mode);
if (NS_FAILED(*result))
return true;
filePicker->SetAddToRecentDocs(addToRecentDocs);
PRUint32 count = filters.Length();
for (PRUint32 i = 0; i < count; ++i) {
filePicker->AppendFilter(filterNames[i], filters[i]);

View File

@ -178,6 +178,7 @@ private:
virtual bool RecvShowFilePicker(const PRInt16& mode,
const PRInt16& selectedType,
const PRBool& addToRecentDocs,
const nsString& title,
const nsString& defaultFile,
const nsString& defaultExtension,

View File

@ -144,7 +144,7 @@ parent:
async SetURITitle(URI uri, nsString title);
// filepicker remoting
sync ShowFilePicker(PRInt16 mode, PRInt16 selectedType,
sync ShowFilePicker(PRInt16 mode, PRInt16 selectedType, PRBool addToRecentDocs,
nsString title, nsString defaultFile, nsString defaultExtension,
nsString[] filters, nsString[] filterNames)
returns (nsString[] files, PRInt16 retValue, nsresult result);

View File

@ -189,7 +189,7 @@ SimpleTest.waitForFocus(runTest);
<button id="b2" label="Button"/>
<button id="b3" label="Button"/>
<iframe id="child" src="data:text/html,&lt;html&gt;&lt;style&gt;* { outline: none; -moz-appearance: none; } %23elem:focus { outline: 2px solid red; } %23elem:-moz-focusring { outline: 1px solid blue; }&lt;/style&gt;&lt;div id='container'&gt;&lt;/html&gt;"/>
<iframe id="child" src="data:text/html,&lt;html&gt;&lt;style&gt;* { outline: none; -moz-appearance: none; } #elem:focus { outline: 2px solid red; } #elem:-moz-focusring { outline: 1px solid blue; }&lt;/style&gt;&lt;div id='container'&gt;&lt;/html&gt;"/>
<body xmlns="http://www.w3.org/1999/xhtml" style="height: 300px; overflow: auto;"/>

View File

@ -7,7 +7,7 @@
* 我听见 我忘记; 我看见 我记住; 我做 我了解
*/
const sample = "~{NJK{K-JGI59OAK~}5~{7VVS!%235+JG%23,K{K-2;R*GsHTH;JGR;8vI59OS@T6!%23~} ~{NRL}<{~} ~{NRM|<G~}; ~{NR?4<{~} ~{NR<GW!~}; ~{NRWv~} ~{NRAK=b!%23~}";
const sample = "~{NJK{K-JGI59OAK~}5~{7VVS!#5+JG#,K{K-2;R*GsHTH;JGR;8vI59OS@T6!#~} ~{NRL}<{~} ~{NRM|<G~}; ~{NR?4<{~} ~{NR<GW!~}; ~{NRWv~} ~{NRAK=b!#~}";
const expected = "\u95EE\u4ED6\u8C01\u662F\u50BB\u74DC\u4E865\u5206\u949F\u3002\u4F46\u662F\uFF0C\u4ED6\u8C01\u4E0D\u8981\u6C42\u4ECD\u7136\u662F\u4E00\u4E2A\u50BB\u74DC\u6C38\u8FDC\u3002 \u6211\u542C\u89C1 \u6211\u5FD8\u8BB0; \u6211\u770B\u89C1 \u6211\u8BB0\u4F4F; \u6211\u505A \u6211\u4E86\u89E3\u3002";

View File

@ -46,10 +46,9 @@ function run()
function test_document_rule(urltests, shouldapply)
{
var zIndex = ++zIndexCounter;
var encodedRule = encodeURI("@-moz-document " + urltests + " { ") +
"%23" + // encoded hash character for "#display"
encodeURI("display { z-index: " + zIndex + " } }");
var sheeturi = "data:text/css," + encodedRule;
var rule = "@-moz-document " + urltests +
" { #display { z-index: " + zIndex + " } }";
var sheeturi = "data:text/css," + encodeURI(rule);
set_user_sheet(sheeturi);
if (shouldapply) {
is(cs.zIndex, zIndex,

View File

@ -104,13 +104,13 @@ base + "#6ident, #a {color: red }",
".\\--ident, .a { color: green; }",
// CSS2.1 section 4.1.5 and 4.2
"@import 'data:text/css,%23a{color:green}';",
"@import \"data:text/css,%23a{color:green}\";",
"@import url(data:text/css,%23a{color:green});",
"@import 'data:text/css,%23a{color:green}' screen;",
base + "@import 'data:text/css,%23a{color:red}' blahblahblah;",
"@import 'data:text/css,%23a{color:green}'",
"@import 'data:text/css,%23a{color:green}",
"@import 'data:text/css,#a{color:green}';",
"@import \"data:text/css,#a{color:green}\";",
"@import url(data:text/css,#a{color:green});",
"@import 'data:text/css,#a{color:green}' screen;",
base + "@import 'data:text/css,#a{color:red}' blahblahblah;",
"@import 'data:text/css,#a{color:green}'",
"@import 'data:text/css,#a{color:green}",
"@foo {}" + base,
"@foo bar {}" + base,
"@foo; " + base,

View File

@ -115,10 +115,8 @@ nsSimpleURI::Read(nsIObjectInputStream* aStream)
mIsRefValid = isRefValid;
if (isRefValid) {
rv = aStream->ReadCString(mRef);
if (NS_FAILED(rv)) return rv;
} else {
mRef.Truncate(); // invariant: mRef should be empty when it's not valid
rv = aStream->ReadCString(mRef);
if (NS_FAILED(rv)) return rv;
}
return NS_OK;
@ -168,7 +166,6 @@ nsSimpleURI::Read(const IPC::Message *aMsg, void **aIter)
if (mIsRefValid) {
return ReadParam(aMsg, aIter, &mRef);
}
mRef.Truncate(); // invariant: mRef should be empty when it's not valid
return PR_TRUE;
}
@ -194,8 +191,6 @@ nsSimpleURI::GetSpec(nsACString &result)
result = mScheme + NS_LITERAL_CSTRING(":") + mPath;
if (mIsRefValid) {
result += NS_LITERAL_CSTRING("#") + mRef;
} else {
NS_ABORT_IF_FALSE(mRef.IsEmpty(), "mIsRefValid/mRef invariant broken");
}
return NS_OK;
}
@ -373,7 +368,6 @@ nsSimpleURI::SetPath(const nsACString &path)
PRInt32 hashPos = path.FindChar('#');
if (hashPos < 0) {
mIsRefValid = PR_FALSE;
mRef.Truncate(); // invariant: mRef should be empty when it's not valid
mPath = path;
return NS_OK;
}
@ -386,7 +380,6 @@ NS_IMETHODIMP
nsSimpleURI::GetRef(nsACString &result)
{
if (!mIsRefValid) {
NS_ABORT_IF_FALSE(mRef.IsEmpty(), "mIsRefValid/mRef invariant broken");
result.Truncate();
} else {
result = mRef;
@ -405,7 +398,7 @@ nsSimpleURI::SetRef(const nsACString &aRef)
if (aRef.IsEmpty()) {
// Empty string means to remove ref completely.
mIsRefValid = PR_FALSE;
mRef.Truncate(); // invariant: mRef should be empty when it's not valid
mRef.Truncate();
return NS_OK;
}
@ -510,7 +503,6 @@ nsSimpleURI::CloneInternal(nsSimpleURI::RefHandlingEnum refHandlingMode,
url->mPath = mPath;
if (refHandlingMode == eHonorRef) {
url->mRef = mRef;
url->mIsRefValid = mIsRefValid;
}
url.forget(result);

View File

@ -62,10 +62,10 @@ nsDataChannel::OpenContentStream(PRBool async, nsIInputStream **result,
rv = URI()->GetAsciiSpec(spec);
if (NS_FAILED(rv)) return rv;
nsCString contentType, contentCharset, dataBuffer, hashRef;
nsCString contentType, contentCharset, dataBuffer;
PRBool lBase64;
rv = nsDataHandler::ParseURI(spec, contentType, contentCharset,
lBase64, dataBuffer, hashRef);
lBase64, dataBuffer);
NS_UnescapeURL(dataBuffer);

View File

@ -114,9 +114,9 @@ nsDataHandler::NewURI(const nsACString &aSpec,
rv = uri->SetRef(spec);
} else {
// Otherwise, we'll assume |spec| is a fully-specified data URI
nsCAutoString contentType, contentCharset, dataBuffer, hashRef;
nsCAutoString contentType, contentCharset, dataBuffer;
PRBool base64;
rv = ParseURI(spec, contentType, contentCharset, base64, dataBuffer, hashRef);
rv = ParseURI(spec, contentType, contentCharset, base64, dataBuffer);
if (NS_FAILED(rv))
return rv;
@ -171,8 +171,7 @@ nsDataHandler::ParseURI(nsCString& spec,
nsCString& contentType,
nsCString& contentCharset,
PRBool& isBase64,
nsCString& dataBuffer,
nsCString& hashRef) {
nsCString& dataBuffer) {
isBase64 = PR_FALSE;
// move past "data:"
@ -231,16 +230,7 @@ nsDataHandler::ParseURI(nsCString& spec,
contentType.StripWhitespace();
contentCharset.StripWhitespace();
// Split encoded data from terminal "#ref" (if present)
char *data = comma + 1;
char *hash = strchr(data, '#');
if (!hash) {
dataBuffer.Assign(data);
hashRef.Truncate();
} else {
dataBuffer.Assign(data, hash - data);
hashRef.Assign(hash);
}
dataBuffer.Assign(comma + 1);
return NS_OK;
}

View File

@ -63,8 +63,7 @@ public:
nsCString& contentType,
nsCString& contentCharset,
PRBool& isBase64,
nsCString& dataBuffer,
nsCString& hashRef);
nsCString& dataBuffer);
};
#endif /* nsDataHandler_h___ */

View File

@ -1 +0,0 @@
<iframe src="data:text/html,ABC"></iframe>

View File

@ -1 +0,0 @@
<iframe src="data:text/html,ABC#myRef"></iframe>

View File

@ -1,2 +1,2 @@
== bug565432-1.html bug565432-1-ref.html
== 658949-1.html 658949-1-ref.html

View File

@ -5,12 +5,6 @@ const Ci = Components.interfaces;
// TEST DATA
// ---------
var gTests = [
{ spec: "about:blank",
scheme: "about",
prePath: "about:",
path: "blank",
ref: "",
nsIURL: false, nsINestedURI: true, immutable: true },
{ spec: "about:foobar",
scheme: "about",
prePath: "about:",
@ -83,12 +77,6 @@ var gTests = [
path: "resource://gre/chrome.toolkit.jar!/",
ref: "",
nsIURL: true, nsINestedURI: true },
{ spec: "place:redirectsMode=2&sort=8&maxResults=10",
scheme: "place",
prePath: "place:",
path: "redirectsMode=2&sort=8&maxResults=10",
ref: "",
nsIURL: false, nsINestedURI: false },
{ spec: "resource://gre/",
scheme: "resource",
prePath: "resource://gre",
@ -230,10 +218,6 @@ function do_test_uri_with_hash_suffix(aTest, aSuffix) {
var testURI = NetUtil.newURI(aTest.spec + aSuffix);
var origURI = NetUtil.newURI(aTest.spec);
do_info("testing " + aTest.spec + " with '" + aSuffix + "' appended " +
"equals a clone of itself");
do_check_uri_eq(testURI, testURI.clone());
do_info("testing " + aTest.spec +
" doesn't equal self with '" + aSuffix + "' appended");
if (aTest.spec == "file://") {

View File

@ -155,6 +155,10 @@ nsFilePicker.prototype = {
set filterIndex(a) { this.mFilterIndex = a; },
get filterIndex() { return this.mFilterIndex; },
/* attribute boolean addToRecentDocs; */
set addToRecentDocs(a) {},
get addToRecentDocs() { return false; },
/* members */
mFilesEnumerator: undefined,
mParentWindow: null,

View File

@ -44,7 +44,7 @@ interface nsIURI;
interface nsIDOMWindow;
interface nsISimpleEnumerator;
[scriptable, uuid(d24ef0aa-d555-4117-84af-9cbbb7406909)]
[scriptable, uuid(f2c0e216-5d07-4df4-bbcb-37683077ae7e)]
interface nsIFilePicker : nsISupports
{
const short modeOpen = 0; // Load a file or directory
@ -162,6 +162,14 @@ interface nsIFilePicker : nsISupports
*/
readonly attribute nsISimpleEnumerator files;
/**
* Controls whether the chosen file(s) should be added to the system's recent
* documents list. This attribute will be ignored if the system has no "Recent
* Docs" concept, or if the application is in private browsing mode (in which
* case the file will not be added). Defaults to true.
*/
attribute boolean addToRecentDocs;
/**
* Show File Dialog. The dialog is displayed modally.
*

View File

@ -46,6 +46,7 @@
#include "nsIServiceManager.h"
#include "nsIPlatformCharset.h"
#include "nsICharsetConverterManager.h"
#include "nsIPrivateBrowsingService.h"
#include "nsFilePicker.h"
#include "nsILocalFile.h"
#include "nsIURL.h"
@ -69,21 +70,11 @@ char nsFilePicker::mLastUsedDirectory[MAX_PATH+1] = { 0 };
#define MAX_EXTENSION_LENGTH 10
//-------------------------------------------------------------------------
//
// nsFilePicker constructor
//
//-------------------------------------------------------------------------
nsFilePicker::nsFilePicker()
{
mSelectedType = 1;
}
//-------------------------------------------------------------------------
//
// nsFilePicker destructor
//
//-------------------------------------------------------------------------
nsFilePicker::~nsFilePicker()
{
if (mLastUsedUnicodeDirectory) {
@ -92,12 +83,7 @@ nsFilePicker::~nsFilePicker()
}
}
//-------------------------------------------------------------------------
//
// Show - Display the file dialog
//
//-------------------------------------------------------------------------
int CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData)
{
if (uMsg == BFFM_INITIALIZED)
@ -195,7 +181,20 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
ofn.lpstrFile = fileBuffer;
ofn.nMaxFile = FILE_BUFFER_SIZE;
ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE |
OFN_LONGNAMES | OFN_OVERWRITEPROMPT |
OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
// Handle add to recent docs settings
nsCOMPtr<nsIPrivateBrowsingService> pbs =
do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
PRBool privacyModeEnabled = PR_FALSE;
if (pbs) {
pbs->GetPrivateBrowsingEnabled(&privacyModeEnabled);
}
if (privacyModeEnabled || !mAddToRecentDocs) {
ofn.Flags |= OFN_DONTADDTORECENT;
}
if (!mDefaultExtension.IsEmpty()) {
ofn.lpstrDefExt = mDefaultExtension.get();
@ -405,7 +404,6 @@ NS_IMETHODIMP nsFilePicker::GetFile(nsILocalFile **aFile)
return NS_OK;
}
//-------------------------------------------------------------------------
NS_IMETHODIMP nsFilePicker::GetFileURL(nsIURI **aFileURL)
{
*aFileURL = nsnull;
@ -423,11 +421,7 @@ NS_IMETHODIMP nsFilePicker::GetFiles(nsISimpleEnumerator **aFiles)
return NS_NewArrayEnumerator(aFiles, mFiles);
}
//-------------------------------------------------------------------------
//
// Get the file + path
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsFilePicker::SetDefaultString(const nsAString& aString)
{
mDefault = aString;
@ -465,11 +459,7 @@ NS_IMETHODIMP nsFilePicker::GetDefaultString(nsAString& aString)
return NS_ERROR_FAILURE;
}
//-------------------------------------------------------------------------
//
// The default extension to use for files
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsFilePicker::GetDefaultExtension(nsAString& aExtension)
{
aExtension = mDefaultExtension;
@ -482,11 +472,7 @@ NS_IMETHODIMP nsFilePicker::SetDefaultExtension(const nsAString& aExtension)
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Set the filter index
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsFilePicker::GetFilterIndex(PRInt32 *aFilterIndex)
{
// Windows' filter index is 1-based, we use a 0-based system.
@ -501,7 +487,6 @@ NS_IMETHODIMP nsFilePicker::SetFilterIndex(PRInt32 aFilterIndex)
return NS_OK;
}
//-------------------------------------------------------------------------
void nsFilePicker::InitNative(nsIWidget *aParent,
const nsAString& aTitle,
PRInt16 aMode)

View File

@ -46,7 +46,7 @@
#include "GfxInfoX11.h"
#if defined(MOZ_CRASHREPORTER) && defined(MOZ_ENABLE_LIBXUL)
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#include "nsICrashReporter.h"
#endif
@ -165,7 +165,7 @@ GfxInfo::GetData()
mAdapterDescription.Append(nsDependentCString(buf));
mAdapterDescription.AppendLiteral("\n");
}
#if defined(MOZ_CRASHREPORTER) && defined(MOZ_ENABLE_LIBXUL)
#ifdef MOZ_CRASHREPORTER
CrashReporter::AppendAppNotesToCrashReport(mAdapterDescription);
#endif
return;
@ -181,7 +181,7 @@ GfxInfo::GetData()
note.Append(" -- ");
note.Append(mVersion);
note.Append("\n");
#if defined(MOZ_CRASHREPORTER) && defined(MOZ_ENABLE_LIBXUL)
#ifdef MOZ_CRASHREPORTER
CrashReporter::AppendAppNotesToCrashReport(note);
#endif

View File

@ -64,7 +64,8 @@ using namespace mozilla::widget;
#define FILEPICKER_TITLES "chrome://global/locale/filepicker.properties"
#define FILEPICKER_FILTERS "chrome://global/content/filepicker.properties"
nsBaseFilePicker::nsBaseFilePicker()
nsBaseFilePicker::nsBaseFilePicker() :
mAddToRecentDocs(PR_TRUE)
{
}
@ -74,7 +75,6 @@ nsBaseFilePicker::~nsBaseFilePicker()
}
//-------------------------------------------------------------------------
NS_IMETHODIMP nsBaseFilePicker::Init(nsIDOMWindow *aParent,
const nsAString& aTitle,
PRInt16 aMode)
@ -161,11 +161,7 @@ nsBaseFilePicker::AppendFilters(PRInt32 aFilterMask)
return NS_OK;
}
//-------------------------------------------------------------------------
//
// Set the filter index
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsBaseFilePicker::GetFilterIndex(PRInt32 *aFilterIndex)
{
*aFilterIndex = 0;
@ -197,11 +193,8 @@ NS_IMETHODIMP nsBaseFilePicker::GetFiles(nsISimpleEnumerator **aFiles)
}
#ifdef BASEFILEPICKER_HAS_DISPLAYDIRECTORY
//-------------------------------------------------------------------------
//
// Set the display directory
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsBaseFilePicker::SetDisplayDirectory(nsILocalFile *aDirectory)
{
if (!aDirectory) {
@ -216,11 +209,7 @@ NS_IMETHODIMP nsBaseFilePicker::SetDisplayDirectory(nsILocalFile *aDirectory)
return rv;
}
//-------------------------------------------------------------------------
//
// Get the display directory
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsBaseFilePicker::GetDisplayDirectory(nsILocalFile **aDirectory)
{
*aDirectory = nsnull;
@ -233,3 +222,17 @@ NS_IMETHODIMP nsBaseFilePicker::GetDisplayDirectory(nsILocalFile **aDirectory)
return CallQueryInterface(directory, aDirectory);
}
#endif
NS_IMETHODIMP
nsBaseFilePicker::GetAddToRecentDocs(PRBool *aFlag)
{
*aFlag = mAddToRecentDocs;
return NS_OK;
}
NS_IMETHODIMP
nsBaseFilePicker::SetAddToRecentDocs(PRBool aFlag)
{
mAddToRecentDocs = aFlag;
return NS_OK;
}

View File

@ -69,12 +69,15 @@ public:
NS_IMETHOD GetDisplayDirectory(nsILocalFile * *aDisplayDirectory);
NS_IMETHOD SetDisplayDirectory(nsILocalFile * aDisplayDirectory);
#endif
NS_IMETHOD GetAddToRecentDocs(PRBool *aFlag);
NS_IMETHOD SetAddToRecentDocs(PRBool aFlag);
protected:
virtual void InitNative(nsIWidget *aParent, const nsAString& aTitle,
PRInt16 aMode) = 0;
PRBool mAddToRecentDocs;
#ifdef BASEFILEPICKER_HAS_DISPLAYDIRECTORY
nsCOMPtr<nsILocalFile> mDisplayDirectory;
#endif

View File

@ -175,7 +175,8 @@ NS_IMETHODIMP nsFilePickerProxy::Show(PRInt16* aReturn)
InfallibleTArray<nsString> filePaths;
nsresult rv;
cc->SendShowFilePicker(mMode, mSelectedType, mTitle,
cc->SendShowFilePicker(mMode, mSelectedType,
mAddToRecentDocs, mTitle,
mDefault, mDefaultExtension,
mFilters, mFilterNames,
&filePaths, aReturn, &rv);