зеркало из https://github.com/mozilla/pjs.git
Fixing regression bug 81918 (Setting preferred style sheet via HTTP headers is broken). r=glazman, sr=jst.
This commit is contained in:
Родитель
99c9bf9ae8
Коммит
bcc4d7040c
|
@ -932,6 +932,7 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData)
|
|||
else {
|
||||
nsDocHeaderData* data = mHeaderData;
|
||||
nsDocHeaderData** lastPtr = &mHeaderData;
|
||||
PRBool found = PR_FALSE;
|
||||
do { // look for existing and replace
|
||||
if (data->mField == aHeaderField) {
|
||||
if (!aData.IsEmpty()) {
|
||||
|
@ -942,13 +943,13 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData)
|
|||
data->mNext = nsnull;
|
||||
delete data;
|
||||
}
|
||||
return NS_OK;
|
||||
found = PR_TRUE;
|
||||
}
|
||||
lastPtr = &(data->mNext);
|
||||
data = data->mNext;
|
||||
} while (nsnull != data);
|
||||
// didn't find, append
|
||||
if (!aData.IsEmpty()) {
|
||||
} while (data && !found);
|
||||
if (!aData.IsEmpty() && !found) {
|
||||
// didn't find, append
|
||||
*lastPtr = new nsDocHeaderData(aHeaderField, aData);
|
||||
}
|
||||
}
|
||||
|
@ -956,22 +957,20 @@ nsDocument::SetHeaderData(nsIAtom* aHeaderField, const nsAReadableString& aData)
|
|||
// switch alternate style sheets based on default
|
||||
nsAutoString type;
|
||||
nsAutoString title;
|
||||
nsAutoString textHtml;
|
||||
textHtml.Assign(NS_LITERAL_STRING("text/html"));
|
||||
PRInt32 index;
|
||||
|
||||
mCSSLoader->SetPreferredSheet(nsAutoString(aData));
|
||||
mCSSLoader->SetPreferredSheet(aData);
|
||||
|
||||
PRInt32 count = mStyleSheets.Count();
|
||||
for (index = 0; index < count; index++) {
|
||||
nsIStyleSheet* sheet = (nsIStyleSheet*)mStyleSheets.ElementAt(index);
|
||||
sheet->GetType(type);
|
||||
if (!type.Equals(textHtml)) {
|
||||
if (!type.Equals(NS_LITERAL_STRING("text/html"))) {
|
||||
sheet->GetTitle(title);
|
||||
if (!title.IsEmpty()) { // if sheet has title
|
||||
nsAutoString data(aData);
|
||||
PRBool disabled = (aData.IsEmpty() ||
|
||||
!title.EqualsIgnoreCase(data));
|
||||
PRBool disabled = (aData.IsEmpty() ||
|
||||
Compare(title, aData,
|
||||
nsCaseInsensitiveStringComparator()) != 0);
|
||||
SetStyleSheetDisabledState(sheet, disabled);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsAReadableString.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
|
@ -52,7 +53,7 @@ public:
|
|||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive) = 0;
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode) = 0;
|
||||
NS_IMETHOD SetPreferredSheet(const nsString& aTitle) = 0;
|
||||
NS_IMETHOD SetPreferredSheet(const nsAReadableString& aTitle) = 0;
|
||||
|
||||
// Get/Recycle a CSS parser for general use
|
||||
NS_IMETHOD GetParserFor(nsICSSStyleSheet* aSheet,
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive);
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode);
|
||||
NS_IMETHOD SetPreferredSheet(const nsString& aTitle);
|
||||
NS_IMETHOD SetPreferredSheet(const nsAReadableString& aTitle);
|
||||
|
||||
NS_IMETHOD GetParserFor(nsICSSStyleSheet* aSheet,
|
||||
nsICSSParser** aParser);
|
||||
|
@ -520,7 +520,7 @@ CSSLoaderImpl::SetQuirkMode(PRBool aQuirkMode)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSLoaderImpl::SetPreferredSheet(const nsString& aTitle)
|
||||
CSSLoaderImpl::SetPreferredSheet(const nsAReadableString& aTitle)
|
||||
{
|
||||
mPreferredSheet = aTitle;
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ public:
|
|||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive);
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode);
|
||||
NS_IMETHOD SetPreferredSheet(const nsString& aTitle);
|
||||
NS_IMETHOD SetPreferredSheet(const nsAReadableString& aTitle);
|
||||
|
||||
NS_IMETHOD GetParserFor(nsICSSStyleSheet* aSheet,
|
||||
nsICSSParser** aParser);
|
||||
|
@ -520,7 +520,7 @@ CSSLoaderImpl::SetQuirkMode(PRBool aQuirkMode)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CSSLoaderImpl::SetPreferredSheet(const nsString& aTitle)
|
||||
CSSLoaderImpl::SetPreferredSheet(const nsAReadableString& aTitle)
|
||||
{
|
||||
mPreferredSheet = aTitle;
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "nslayout.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsAReadableString.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
|
@ -52,7 +53,7 @@ public:
|
|||
|
||||
NS_IMETHOD SetCaseSensitive(PRBool aCaseSensitive) = 0;
|
||||
NS_IMETHOD SetQuirkMode(PRBool aQuirkMode) = 0;
|
||||
NS_IMETHOD SetPreferredSheet(const nsString& aTitle) = 0;
|
||||
NS_IMETHOD SetPreferredSheet(const nsAReadableString& aTitle) = 0;
|
||||
|
||||
// Get/Recycle a CSS parser for general use
|
||||
NS_IMETHOD GetParserFor(nsICSSStyleSheet* aSheet,
|
||||
|
|
Загрузка…
Ссылка в новой задаче