Merge mozilla-inbound to mozilla-central r=merge a=merge

This commit is contained in:
Cosmin Sabou 2017-11-23 11:42:46 +02:00
Родитель c2346512fd 8bb6a64726
Коммит a5d613086a
256 изменённых файлов: 6831 добавлений и 1638 удалений

Просмотреть файл

@ -7,6 +7,11 @@ const TEST_FILE = "dummy_page.html";
add_task(async function() {
let dir = getChromeDir(getResolvedURI(gTestPath));
dir.append(TEST_FILE);
// The file can be a symbolic link on local build. Normalize it to make sure
// the path matches to the actual URI opened in the new tab.
dir.normalize();
const uriString = Services.io.newFileURI(dir).spec;
const openedUriString = uriString + "?opened";

Просмотреть файл

@ -1743,7 +1743,7 @@ BrowserGlue.prototype = {
// eslint-disable-next-line complexity
_migrateUI: function BG__migrateUI() {
const UI_VERSION = 58;
const UI_VERSION = 59;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul";
let currentUIVersion;
@ -2175,6 +2175,40 @@ BrowserGlue.prototype = {
Services.prefs.clearUserPref("browser.search.isUS");
}
if (currentUIVersion < 59) {
let searchInitializedPromise = new Promise(resolve => {
if (Services.search.isInitialized) {
resolve();
}
const SEARCH_SERVICE_TOPIC = "browser-search-service";
Services.obs.addObserver(function observer(subject, topic, data) {
if (data != "init-complete") {
return;
}
Services.obs.removeObserver(observer, SEARCH_SERVICE_TOPIC);
resolve();
}, SEARCH_SERVICE_TOPIC);
});
searchInitializedPromise.then(() => {
let currentEngine = Services.search.currentEngine.wrappedJSObject;
// Only reset the current engine if it wasn't set by a WebExtension
// and it is not one of the default engines.
if (currentEngine._extensionID || currentEngine._isDefault)
return;
if (currentEngine._loadPath.startsWith("[https]")) {
Services.prefs.setCharPref("browser.search.reset.status", "pending");
} else {
// Can't call resetToOriginalDefaultEngine because it doesn't
// unhide the engine.
let defaultEngine = Services.search.originalDefaultEngine;
defaultEngine.hidden = false;
Services.search.currentEngine = defaultEngine;
Services.prefs.setIntPref("browser.search.reset.status", "silent");
}
});
}
// Update the migration version.
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},

Просмотреть файл

@ -17,8 +17,10 @@ let gContainersPane = {
init() {
this._list = document.getElementById("containersView");
document.getElementById("backContainersLink").addEventListener("click", function() {
gotoPref("general");
document.getElementById("backContainersLink").addEventListener("click", function(event) {
if (event.button == 0) {
gotoPref("general");
}
});
this._rebuildView();

Просмотреть файл

@ -114,16 +114,28 @@ var gPrivacyPane = {
gPrivacyPane.updatePrivacyMicroControls();
gPrivacyPane.updateAutostart();
});
setEventListener("historyRememberClear", "click", function() {
gPrivacyPane.clearPrivateDataNow(false);
setEventListener("historyRememberClear", "click", function(event) {
if (event.button == 0) {
gPrivacyPane.clearPrivateDataNow(false);
}
return false;
});
setEventListener("historyRememberCookies", "click", function() {
gPrivacyPane.showCookies();
setEventListener("historyRememberCookies", "click", function(event) {
if (event.button == 0) {
gPrivacyPane.showCookies();
}
return false;
});
setEventListener("historyDontRememberClear", "click", function() {
gPrivacyPane.clearPrivateDataNow(true);
setEventListener("historyDontRememberClear", "click", function(event) {
if (event.button == 0) {
gPrivacyPane.clearPrivateDataNow(true);
}
return false;
});
setEventListener("openSearchEnginePreferences", "click", function(event) {
if (event.button == 0) {
gotoPref("search");
}
return false;
});
setEventListener("privateBrowsingAutoStart", "command",

Просмотреть файл

@ -415,7 +415,7 @@
<checkbox id="openpageSuggestion" label="&locbar.openpage.label;"
accesskey="&locbar.openpage.accesskey;"
preference="browser.urlbar.suggest.openpage"/>
<label class="text-link" onclick="gotoPref('search')">
<label class="text-link" id="openSearchEnginePreferences">
&suggestionSettings2.label;
</label>
</groupbox>

Просмотреть файл

@ -59,9 +59,16 @@ function doSearch() {
function openingSettings() {
record(TELEMETRY_RESULT_ENUM.OPENED_SETTINGS);
savePref("customized");
window.removeEventListener("unload", recordPageClosed);
}
function savePref(value) {
const statusPref = "browser.search.reset.status";
if (Services.prefs.getCharPref(statusPref, "") == "pending")
Services.prefs.setCharPref(statusPref, value);
}
function record(result) {
Services.telemetry.getHistogramById("SEARCH_RESET_RESULT").add(result);
}
@ -71,6 +78,7 @@ function keepCurrentEngine() {
// written for this engine, so that we don't prompt the user again.
Services.search.currentEngine = Services.search.currentEngine;
record(TELEMETRY_RESULT_ENUM.KEPT_CURRENT);
savePref("declined");
doSearch();
}
@ -81,6 +89,7 @@ function changeSearchEngine() {
Services.search.currentEngine = engine;
record(TELEMETRY_RESULT_ENUM.RESTORED_DEFAULT);
savePref("accepted");
doSearch();
}

Просмотреть файл

@ -15,6 +15,8 @@ const kSearchPurpose = "searchbar";
const kTestEngine = "testEngine.xml";
const kStatusPref = "browser.search.reset.status";
function checkTelemetryRecords(expectedValue) {
let histogram = Services.telemetry.getHistogramById("SEARCH_RESET_RESULT");
let snapshot = histogram.snapshot();
@ -59,6 +61,7 @@ var gTests = [
let rawEngine = engine.wrappedJSObject;
let initialHash = rawEngine.getAttr("loadPathHash");
rawEngine.setAttr("loadPathHash", "broken");
Services.prefs.setCharPref(kStatusPref, "pending");
let loadPromise = promiseStoppedLoad(expectedURL);
// eslint-disable-next-line mozilla/no-cpows-in-tests
@ -71,6 +74,7 @@ var gTests = [
"the loadPathHash has been fixed");
checkTelemetryRecords(TELEMETRY_RESULT_ENUM.KEPT_CURRENT);
is(Services.prefs.getCharPref(kStatusPref), "declined");
}
},
@ -92,6 +96,7 @@ var gTests = [
let button = doc.getElementById("searchResetChangeEngine");
is(doc.activeElement, button,
"the 'Change Search Engine' button is focused");
Services.prefs.setCharPref(kStatusPref, "pending");
button.click();
await loadPromise;
@ -99,6 +104,7 @@ var gTests = [
"the default engine is back to the original one");
checkTelemetryRecords(TELEMETRY_RESULT_ENUM.RESTORED_DEFAULT);
is(Services.prefs.getCharPref(kStatusPref), "accepted");
Services.search.currentEngine = currentEngine;
}
},
@ -106,6 +112,7 @@ var gTests = [
{
desc: "Click the settings link.",
async run() {
Services.prefs.setCharPref(kStatusPref, "pending");
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser,
false,
"about:preferences");
@ -114,15 +121,18 @@ var gTests = [
await loadPromise;
checkTelemetryRecords(TELEMETRY_RESULT_ENUM.OPENED_SETTINGS);
is(Services.prefs.getCharPref(kStatusPref), "customized");
}
},
{
desc: "Load another page without clicking any of the buttons.",
async run() {
Services.prefs.setCharPref(kStatusPref, "pending");
await promiseTabLoadEvent(gBrowser.selectedTab, "about:mozilla");
checkTelemetryRecords(TELEMETRY_RESULT_ENUM.CLOSED_PAGE);
is(Services.prefs.getCharPref(kStatusPref), "pending");
}
},
@ -153,6 +163,7 @@ function test() {
gBrowser.removeCurrentTab();
}
Services.prefs.clearUserPref(kStatusPref);
Services.telemetry.canRecordExtended = oldCanRecord;
})().then(finish, ex => {
ok(false, "Unexpected Exception: " + ex);

Просмотреть файл

@ -359,12 +359,10 @@ BasePrincipal::AddonHasPermission(const nsAtom* aPerm)
}
nsIPrincipal*
BasePrincipal::PrincipalToInherit(nsIURI* aRequestedURI,
bool aAllowIfInheritsPrincipal)
BasePrincipal::PrincipalToInherit(nsIURI* aRequestedURI)
{
if (Is<ExpandedPrincipal>()) {
return As<ExpandedPrincipal>()->PrincipalToInherit(aRequestedURI,
aAllowIfInheritsPrincipal);
return As<ExpandedPrincipal>()->PrincipalToInherit(aRequestedURI);
}
return this;
}

Просмотреть файл

@ -131,20 +131,26 @@ public:
// For most principal types, this returns the principal itself. For expanded
// principals, it returns the first sub-principal which subsumes the given URI
// (or, if no URI is given, the last whitelist principal).
//
// The aAllowIfInheritsPrincipal argument is passed through to CheckMayLoad()
// to determine which consistituent principals may load the requested URI.
nsIPrincipal* PrincipalToInherit(nsIURI* aRequestedURI = nullptr,
bool aAllowIfInheritsPrincipal = true);
nsIPrincipal* PrincipalToInherit(nsIURI* aRequestedURI = nullptr);
/**
* Returns true if this principal's CSP should override a document's CSP for
* loads that it triggers. Currently true only for expanded principals which
* subsume the document principal.
* subsume the document principal, and add-on codebase principals regardless
* of whether they subsume the document principal.
*/
bool OverridesCSP(nsIPrincipal* aDocumentPrincipal)
{
return mKind == eExpandedPrincipal && FastSubsumes(aDocumentPrincipal);
// Expanded principals override CSP if and only if they subsume the document
// principal.
if (mKind == eExpandedPrincipal) {
return FastSubsumes(aDocumentPrincipal);
}
// Extension principals always override the CSP non-extension principals.
// This is primarily for the sake of their stylesheets, which are usually
// loaded from channels and cannot have expanded principals.
return (AddonPolicy() &&
!BasePrincipal::Cast(aDocumentPrincipal)->AddonPolicy());
}
protected:

Просмотреть файл

@ -181,13 +181,17 @@ ExpandedPrincipal::AddonHasPermission(const nsAtom* aPerm)
}
nsIPrincipal*
ExpandedPrincipal::PrincipalToInherit(nsIURI* aRequestedURI,
bool aAllowIfInheritsPrincipal)
ExpandedPrincipal::PrincipalToInherit(nsIURI* aRequestedURI)
{
if (aRequestedURI) {
// If a given sub-principal subsumes the given URI, use that principal for
// inheritance. In general, this only happens with certain CORS modes, loads
// with forced principal inheritance, and creation of XML documents from
// XMLHttpRequests or fetch requests. For URIs that normally inherit a
// principal (such as data: URIs), we fall back to the last principal in the
// whitelist.
for (const auto& principal : mPrincipals) {
if (NS_SUCCEEDED(principal->CheckMayLoad(aRequestedURI, false,
aAllowIfInheritsPrincipal))) {
if (Cast(principal)->MayLoadInternal(aRequestedURI)) {
return principal;
}
}

Просмотреть файл

@ -39,8 +39,7 @@ public:
// Returns the principal to inherit when this principal requests the given
// URL. See BasePrincipal::PrincipalToInherit.
nsIPrincipal* PrincipalToInherit(nsIURI* aRequestedURI = nullptr,
bool aAllowIfInheritsPrincipal = true);
nsIPrincipal* PrincipalToInherit(nsIURI* aRequestedURI = nullptr);
protected:
explicit ExpandedPrincipal(nsTArray<nsCOMPtr<nsIPrincipal>> &aWhiteList);

Просмотреть файл

@ -1452,8 +1452,8 @@ class ShapesHighlighter extends AutoRefreshHighlighter {
}];
const geometryTypes = ["margin", "border", "padding", "content"];
// default to border
let referenceBox = "border";
// default to border for clip-path, and margin for shape-outside
let referenceBox = this.property === "clip-path" ? "border" : "margin";
for (let geometry of geometryTypes) {
if (definition.includes(geometry)) {
referenceBox = geometry;

Просмотреть файл

@ -282,6 +282,7 @@ Attr::GetTextContentInternal(nsAString& aTextContent,
void
Attr::SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aError)
{
SetNodeValueInternal(aTextContent, aError);

Просмотреть файл

@ -46,6 +46,7 @@ public:
virtual void GetTextContentInternal(nsAString& aTextContent,
OOMReporter& aError) override;
virtual void SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aError) override;
virtual void GetNodeValueInternal(nsAString& aNodeValue) override;
virtual void SetNodeValueInternal(const nsAString& aNodeValue,

Просмотреть файл

@ -2683,7 +2683,8 @@ Element::SetAttr(int32_t aNamespaceID, nsAtom* aName,
NS_ENSURE_SUCCESS(rv, rv);
if (!preparsedAttrValue &&
!ParseAttribute(aNamespaceID, aName, aValue, attrValue)) {
!ParseAttribute(aNamespaceID, aName, aValue, aSubjectPrincipal,
attrValue)) {
attrValue.SetTo(aValue);
}
@ -2903,6 +2904,7 @@ bool
Element::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::lang) {
@ -3999,7 +4001,7 @@ Element::GetInnerHTML(nsAString& aInnerHTML)
}
void
Element::SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError)
Element::SetInnerHTML(const nsAString& aInnerHTML, nsIPrincipal& aSubjectPrincipal, ErrorResult& aError)
{
SetInnerHTMLInternal(aInnerHTML, aError);
}

Просмотреть файл

@ -1219,7 +1219,11 @@ public:
nsTArray<RefPtr<Animation>>& aAnimations);
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
virtual void SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError);
void GetInnerHTML(nsAString& aInnerHTML, nsIPrincipal& aSubjectPrincipal)
{
GetInnerHTML(aInnerHTML);
}
virtual void SetInnerHTML(const nsAString& aInnerHTML, nsIPrincipal& aSubjectPrincipal, ErrorResult& aError);
void GetOuterHTML(nsAString& aOuterHTML);
void SetOuterHTML(const nsAString& aOuterHTML, ErrorResult& aError);
void InsertAdjacentHTML(const nsAString& aPosition, const nsAString& aText,
@ -1565,12 +1569,18 @@ protected:
* @param aNamespaceID the namespace of the attribute to convert
* @param aAttribute the attribute to convert
* @param aValue the string value to convert
* @param aMaybeScriptedPrincipal the principal of the script setting the
* attribute, if one can be determined, or null otherwise. As in
* AfterSetAttr, a null value does not guarantee that the attribute was
* not set by a scripted caller, but a non-null value guarantees that
* the attribute was set by a scripted caller with the given principal.
* @param aResult the nsAttrValue [OUT]
* @return true if the parsing was successful, false otherwise
*/
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult);
/**

Просмотреть файл

@ -504,20 +504,26 @@ nsIContent::GetBaseURIForStyleAttr() const
return OwnerDoc()->GetDocBaseURI();
}
URLExtraData*
nsIContent::GetURLDataForStyleAttr() const
already_AddRefed<URLExtraData>
nsIContent::GetURLDataForStyleAttr(nsIPrincipal* aSubjectPrincipal) const
{
if (IsInAnonymousSubtree() && IsAnonymousContentInSVGUseSubtree()) {
nsIContent* bindingParent = GetBindingParent();
MOZ_ASSERT(bindingParent);
SVGUseElement* useElement = static_cast<SVGUseElement*>(bindingParent);
if (URLExtraData* data = useElement->GetContentURLData()) {
return data;
return do_AddRef(data);
}
}
if (aSubjectPrincipal && aSubjectPrincipal != NodePrincipal()) {
// TODO: Cache this?
return MakeAndAddRef<URLExtraData>(OwnerDoc()->GetDocBaseURI(),
OwnerDoc()->GetDocumentURI(),
aSubjectPrincipal);
}
// This also ignores the case that SVG inside XBL binding.
// But it is probably fine.
return OwnerDoc()->DefaultStyleAttrURLData();
return do_AddRef(OwnerDoc()->DefaultStyleAttrURLData());
}
//----------------------------------------------------------------------
@ -1388,6 +1394,7 @@ FragmentOrElement::GetTextContentInternal(nsAString& aTextContent,
void
FragmentOrElement::SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
ErrorResult& aError)
{
aError = nsContentUtils::SetNodeTextContent(this, aTextContent, false);

Просмотреть файл

@ -126,6 +126,7 @@ public:
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::OOMReporter& aError) override;
virtual void SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError) override;
// nsIContent interface methods

Просмотреть файл

@ -1725,6 +1725,7 @@ nsAttrValue::LoadImage(nsIDocument* aDocument)
bool
nsAttrValue::ParseStyleAttribute(const nsAString& aString,
nsIPrincipal* aMaybeScriptedPrincipal,
nsStyledElement* aElement)
{
nsIDocument* ownerDoc = aElement->OwnerDoc();
@ -1735,11 +1736,19 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
NS_ASSERTION(aElement->NodePrincipal() == ownerDoc->NodePrincipal(),
"This is unexpected");
nsCOMPtr<nsIPrincipal> principal = (
aMaybeScriptedPrincipal ? aMaybeScriptedPrincipal
: aElement->NodePrincipal());
// If the (immutable) document URI does not match the element's base URI
// (the common case is that they do match) do not cache the rule. This is
// because the results of the CSS parser are dependent on these URIs, and we
// do not want to have to account for the URIs in the hash lookup.
bool cachingAllowed = sheet && baseURI == docURI;
// Similarly, if the triggering principal does not match the node principal,
// do not cache the rule, since the principal will be encoded in any parsed
// URLs in the rule.
bool cachingAllowed = (sheet && baseURI == docURI &&
principal == aElement->NodePrincipal());
if (cachingAllowed) {
MiscContainer* cont = sheet->LookupStyleAttr(aString);
if (cont) {
@ -1753,7 +1762,7 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
RefPtr<DeclarationBlock> decl;
if (ownerDoc->GetStyleBackendType() == StyleBackendType::Servo) {
RefPtr<URLExtraData> data = new URLExtraData(baseURI, docURI,
aElement->NodePrincipal());
principal);
decl = ServoDeclarationBlock::FromCssText(aString, data,
ownerDoc->GetCompatibilityMode(),
ownerDoc->CSSLoader());
@ -1761,7 +1770,7 @@ nsAttrValue::ParseStyleAttribute(const nsAString& aString,
css::Loader* cssLoader = ownerDoc->CSSLoader();
nsCSSParser cssParser(cssLoader);
decl = cssParser.ParseStyleAttribute(aString, docURI, baseURI,
aElement->NodePrincipal());
principal);
}
if (!decl) {
return false;

Просмотреть файл

@ -433,8 +433,12 @@ public:
*
* @param aString the style attribute value to be parsed.
* @param aElement the element the attribute is set on.
* @param aMaybeScriptedPrincipal if available, the scripted principal
* responsible for this attribute value, as passed to
* Element::ParseAttribute.
*/
bool ParseStyleAttribute(const nsAString& aString,
nsIPrincipal* aMaybeScriptedPrincipal,
nsStyledElement* aElement);
size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;

Просмотреть файл

@ -1137,7 +1137,7 @@ nsContentUtils::InternalSerializeAutocompleteAttribute(const nsAttrValue* aAttrV
mozilla::dom::AutocompleteInfo& aInfo,
bool aGrantAllValidValue)
{
// No sandbox attribute so we are done
// No autocomplete attribute so we are done
if (!aAttrVal) {
return eAutocompleteAttrState_Invalid;
}

Просмотреть файл

@ -116,6 +116,7 @@ public:
GetNodeValue(aTextContent);
}
virtual void SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError) override
{
// Batch possible DOMSubtreeModified events.

Просмотреть файл

@ -1024,7 +1024,10 @@ public:
nsIURI* GetBaseURIForStyleAttr() const;
// Returns the URL data for style attribute.
mozilla::URLExtraData* GetURLDataForStyleAttr() const;
// If aSubjectPrincipal is passed, it should be the scripted principal
// responsible for generating the URL data.
already_AddRefed<mozilla::URLExtraData>
GetURLDataForStyleAttr(nsIPrincipal* aSubjectPrincipal = nullptr) const;
virtual nsresult GetEventTargetParent(
mozilla::EventChainPreVisitor& aVisitor) override;

Просмотреть файл

@ -1334,15 +1334,27 @@ public:
// way to ask an element whether it's an HTMLContentElement.
virtual bool IsHTMLContentElement() const { return false; }
void GetTextContent(nsAString& aTextContent,
nsIPrincipal& aSubjectPrincipal,
mozilla::OOMReporter& aError)
{
GetTextContentInternal(aTextContent, aError);
}
void GetTextContent(nsAString& aTextContent,
mozilla::OOMReporter& aError)
{
GetTextContentInternal(aTextContent, aError);
}
void SetTextContent(const nsAString& aTextContent,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError)
{
SetTextContentInternal(aTextContent, aError);
SetTextContentInternal(aTextContent, &aSubjectPrincipal, aError);
}
void SetTextContent(const nsAString& aTextContent,
mozilla::ErrorResult& aError)
{
SetTextContentInternal(aTextContent, nullptr, aError);
}
mozilla::dom::Element* QuerySelector(const nsAString& aSelector,
@ -1993,6 +2005,7 @@ protected:
virtual void GetTextContentInternal(nsAString& aTextContent,
mozilla::OOMReporter& aError);
virtual void SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError)
{
}

Просмотреть файл

@ -540,15 +540,16 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument* aOldDocument,
"<link> is not 'inline', and needs different CSP checks");
if (!nsStyleUtil::CSPAllowsInlineStyle(thisContent,
thisContent->NodePrincipal(),
triggeringPrincipal,
doc->GetDocumentURI(),
mLineNumber, text, &rv))
return rv;
// Parse the style sheet.
rv = doc->CSSLoader()->
LoadInlineStyle(thisContent, text, mLineNumber, title, media,
referrerPolicy, scopeElement, aObserver, &doneLoading,
&isAlternate);
LoadInlineStyle(thisContent, text, triggeringPrincipal, mLineNumber,
title, media, referrerPolicy, scopeElement,
aObserver, &doneLoading, &isAlternate);
}
else {
nsAutoString integrity;

Просмотреть файл

@ -39,15 +39,16 @@ bool
nsStyledElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::style && aNamespaceID == kNameSpaceID_None) {
ParseStyleAttribute(aValue, aResult, false);
ParseStyleAttribute(aValue, aMaybeScriptedPrincipal, aResult, false);
return true;
}
return nsStyledElementBase::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
nsresult
@ -145,7 +146,7 @@ nsStyledElement::ReparseStyleAttribute(bool aForceInDataDoc, bool aForceIfAlread
nsAttrValue attrValue;
nsAutoString stringValue;
oldVal->ToString(stringValue);
ParseStyleAttribute(stringValue, attrValue, aForceInDataDoc);
ParseStyleAttribute(stringValue, nullptr, attrValue, aForceInDataDoc);
// Don't bother going through SetInlineStyleDeclaration; we don't
// want to fire off mutation events or document notifications anyway
bool oldValueSet;
@ -179,6 +180,7 @@ nsStyledElement::GetExistingStyle()
void
nsStyledElement::ParseStyleAttribute(const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult,
bool aForceInDataDoc)
{
@ -187,6 +189,7 @@ nsStyledElement::ParseStyleAttribute(const nsAString& aValue,
if (!isNativeAnon &&
!nsStyleUtil::CSPAllowsInlineStyle(nullptr, NodePrincipal(),
aMaybeScriptedPrincipal,
doc->GetDocumentURI(), 0, aValue,
nullptr))
return;
@ -206,7 +209,8 @@ nsStyledElement::ParseStyleAttribute(const nsAString& aValue,
}
}
if (isCSS && aResult.ParseStyleAttribute(aValue, this)) {
if (isCSS && aResult.ParseStyleAttribute(aValue, aMaybeScriptedPrincipal,
this)) {
return;
}
}

Просмотреть файл

@ -61,14 +61,20 @@ protected:
* document, leave it as a string) and return as nsAttrValue.
*
* @param aValue the value to parse
* @param aMaybeScriptedPrincipal if available, the scripted principal
* responsible for this attribute value, as passed to
* Element::ParseAttribute.
* @param aResult the resulting HTMLValue [OUT]
*/
void ParseStyleAttribute(const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult,
bool aForceInDataDoc);
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
friend class mozilla::dom::Element;

Просмотреть файл

@ -1185,9 +1185,10 @@ nsTreeSanitizer::SanitizeAttributes(mozilla::dom::Element* aElement,
aElement->GetAttr(attrNs, attrLocal, value);
nsIDocument* document = aElement->OwnerDoc();
if (document->IsStyledByServo()) {
RefPtr<URLExtraData> urlExtra(aElement->GetURLDataForStyleAttr());
decl = ServoDeclarationBlock::FromCssText(
value,
aElement->GetURLDataForStyleAttr(),
urlExtra,
document->GetCompatibilityMode(),
document->CSSLoader());
} else {

Просмотреть файл

@ -28,7 +28,8 @@ def generate(output, idlFilename, preprocessorHeader):
continue
# Unfortunately, even some of the getters here are fallible
# (e.g. on nsComputedDOMStyle).
extendedAttrs = ["Throws", "TreatNullAs=EmptyString"]
extendedAttrs = ["Throws", "TreatNullAs=EmptyString",
"NeedsSubjectPrincipal"]
if pref is not "":
extendedAttrs.append('Pref="%s"' % pref)

Просмотреть файл

@ -40,6 +40,7 @@ bool
HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::clear && aNamespaceID == kNameSpaceID_None) {
@ -47,7 +48,7 @@ HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -22,6 +22,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -46,6 +46,7 @@ bool
HTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -70,7 +71,7 @@ HTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
aAttribute, aValue,
aResult) ||
nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -126,6 +126,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;

Просмотреть файл

@ -155,6 +155,7 @@ bool
HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -172,7 +173,7 @@ HTMLButtonElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
bool

Просмотреть файл

@ -89,6 +89,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
// nsGenericHTMLElement

Просмотреть файл

@ -642,6 +642,7 @@ bool
HTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None &&
@ -650,7 +651,7 @@ HTMLCanvasElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}

Просмотреть файл

@ -290,6 +290,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute, int32_t aModType) const override;

Просмотреть файл

@ -31,6 +31,7 @@ bool
HTMLDivElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -55,7 +56,7 @@ HTMLDivElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -32,6 +32,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -221,6 +221,7 @@ bool
HTMLEmbedElement::ParseAttribute(int32_t aNamespaceID,
nsAtom *aAttribute,
const nsAString &aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue &aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -233,7 +234,7 @@ HTMLEmbedElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
static void

Просмотреть файл

@ -48,6 +48,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom *aAttribute,
const nsAString &aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue &aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom *aAttribute) const override;

Просмотреть файл

@ -33,6 +33,7 @@ bool
HTMLFontElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -50,7 +51,7 @@ HTMLFontElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -48,6 +48,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -279,6 +279,7 @@ bool
HTMLFormElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -294,7 +295,7 @@ HTMLFormElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
nsresult

Просмотреть файл

@ -94,6 +94,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsresult GetEventTargetParent(
EventChainPreVisitor& aVisitor) override;

Просмотреть файл

@ -33,6 +33,7 @@ bool
HTMLFrameElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -54,7 +55,7 @@ HTMLFrameElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
aValue, aMaybeScriptedPrincipal, aResult);
}
JSObject*

Просмотреть файл

@ -31,6 +31,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
bool aPreallocateChildren) const override;

Просмотреть файл

@ -137,6 +137,7 @@ bool
HTMLFrameSetElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -152,7 +153,7 @@ HTMLFrameSetElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
nsChangeHint

Просмотреть файл

@ -116,6 +116,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const override;

Просмотреть файл

@ -30,6 +30,7 @@ bool
HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
static const nsAttrValue::EnumTable kAlignTable[] = {
@ -55,7 +56,7 @@ HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -27,6 +27,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -34,6 +34,7 @@ bool
HTMLHeadingElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
@ -41,7 +42,7 @@ HTMLHeadingElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -24,6 +24,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -45,6 +45,7 @@ bool
HTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -76,7 +77,9 @@ HTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
aValue,
aMaybeScriptedPrincipal,
aResult);
}
void

Просмотреть файл

@ -35,6 +35,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -225,6 +225,7 @@ bool
HTMLImageElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -241,7 +242,7 @@ HTMLImageElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -58,6 +58,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const override;

Просмотреть файл

@ -5752,6 +5752,7 @@ bool
HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
// We can't make these static_asserts because kInputDefaultType and
@ -5824,7 +5825,7 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -195,6 +195,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const override;

Просмотреть файл

@ -49,6 +49,7 @@ bool
HTMLLIElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -63,7 +64,7 @@ HTMLLIElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -28,6 +28,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -38,6 +38,7 @@ bool
HTMLLegendElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
// this contains center, because IE4 does
@ -55,7 +56,7 @@ HTMLLegendElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
nsChangeHint

Просмотреть файл

@ -39,6 +39,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,
int32_t aModType) const override;

Просмотреть файл

@ -192,6 +192,7 @@ bool
HTMLLinkElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -217,7 +218,7 @@ HTMLLinkElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -69,6 +69,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual void GetLinkTarget(nsAString& aTarget) override;
virtual EventStates IntrinsicState() const override;

Просмотреть файл

@ -4459,6 +4459,7 @@ HTMLMediaElement::GetEventTargetParent(EventChainPreVisitor& aVisitor)
bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
// Mappings from 'preload' attribute strings to an enumeration.
@ -4484,7 +4485,7 @@ bool HTMLMediaElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void HTMLMediaElement::DoneCreatingElement()

Просмотреть файл

@ -152,6 +152,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,

Просмотреть файл

@ -128,6 +128,7 @@ bool
HTMLMenuElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::type) {
@ -136,7 +137,7 @@ HTMLMenuElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -33,6 +33,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,

Просмотреть файл

@ -320,6 +320,7 @@ bool
HTMLMenuItemElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -335,7 +336,7 @@ HTMLMenuItemElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -43,6 +43,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual void DoneCreatingElement() override;

Просмотреть файл

@ -40,8 +40,11 @@ HTMLMeterElement::IntrinsicState() const
}
bool
HTMLMeterElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult)
HTMLMeterElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max ||
@ -52,7 +55,9 @@ HTMLMeterElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
aValue,
aMaybeScriptedPrincipal,
aResult);
}
/*

Просмотреть файл

@ -27,8 +27,10 @@ public:
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
// WebIDL

Просмотреть файл

@ -453,6 +453,7 @@ bool
HTMLObjectElement::ParseAttribute(int32_t aNamespaceID,
nsAtom *aAttribute,
const nsAString &aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue &aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -465,7 +466,7 @@ HTMLObjectElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
aValue, aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -70,6 +70,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom *aAttribute,
const nsAString &aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue &aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom *aAttribute) const override;

Просмотреть файл

@ -70,8 +70,11 @@ HTMLOutputElement::SubmitNamesValues(HTMLFormSubmission* aFormSubmission)
}
bool
HTMLOutputElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult)
HTMLOutputElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::_for) {
@ -81,7 +84,9 @@ HTMLOutputElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
}
return nsGenericHTMLFormElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
aValue,
aMaybeScriptedPrincipal,
aResult);
}
void

Просмотреть файл

@ -39,8 +39,10 @@ public:
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual void DoneAddingChildren(bool aHaveNotified) override;

Просмотреть файл

@ -29,6 +29,7 @@ bool
HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
@ -36,7 +37,7 @@ HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -28,6 +28,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -30,6 +30,7 @@ bool
HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -39,7 +40,7 @@ HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -28,6 +28,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;

Просмотреть файл

@ -45,8 +45,11 @@ HTMLProgressElement::IntrinsicState() const
}
bool
HTMLProgressElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult)
HTMLProgressElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
if (aAttribute == nsGkAtoms::value || aAttribute == nsGkAtoms::max) {
@ -55,7 +58,9 @@ HTMLProgressElement::ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute,
aValue, aResult);
aValue,
aMaybeScriptedPrincipal,
aResult);
}
double

Просмотреть файл

@ -26,8 +26,10 @@ public:
nsresult Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
bool aPreallocateChildren) const override;
bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue, nsAttrValue& aResult) override;
virtual bool ParseAttribute(int32_t aNamespaceID, nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
// WebIDL
double Value() const;

Просмотреть файл

@ -73,6 +73,7 @@ bool
HTMLScriptElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -88,7 +89,7 @@ HTMLScriptElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
nsresult
@ -146,6 +147,7 @@ HTMLScriptElement::GetInnerHTML(nsAString& aInnerHTML)
void
HTMLScriptElement::SetInnerHTML(const nsAString& aInnerHTML,
nsIPrincipal& aScriptedPrincipal,
ErrorResult& aError)
{
aError = nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);

Просмотреть файл

@ -29,6 +29,7 @@ public:
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) override;
virtual void SetInnerHTML(const nsAString& aInnerHTML,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError) override;
// nsIScriptElement
@ -45,6 +46,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,

Просмотреть файл

@ -1257,6 +1257,7 @@ bool
HTMLSelectElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (kNameSpaceID_None == aNamespaceID) {
@ -1268,7 +1269,7 @@ HTMLSelectElement::ParseAttribute(int32_t aNamespaceID,
}
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -384,6 +384,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
virtual nsChangeHint GetAttributeChangeHint(const nsAtom* aAttribute,

Просмотреть файл

@ -60,6 +60,7 @@ bool
HTMLSharedElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None &&
@ -73,7 +74,7 @@ HTMLSharedElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
static void

Просмотреть файл

@ -33,6 +33,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,

Просмотреть файл

@ -59,6 +59,7 @@ bool
HTMLSharedListElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -75,7 +76,7 @@ HTMLSharedListElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -28,6 +28,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;

Просмотреть файл

@ -100,6 +100,7 @@ HTMLStyleElement::ContentRemoved(nsIDocument* aDocument,
void
HTMLStyleElement::ContentChanged(nsIContent* aContent)
{
mTriggeringPrincipal = nullptr;
if (nsContentUtils::IsInSameAnonymousTree(this, aContent)) {
UpdateStyleSheetInternal(nullptr, nullptr);
}
@ -174,14 +175,25 @@ HTMLStyleElement::GetInnerHTML(nsAString& aInnerHTML)
void
HTMLStyleElement::SetInnerHTML(const nsAString& aInnerHTML,
nsIPrincipal& aScriptedPrincipal,
ErrorResult& aError)
{
SetTextContentInternal(aInnerHTML, &aScriptedPrincipal, aError);
}
void
HTMLStyleElement::SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aScriptedPrincipal,
ErrorResult& aError)
{
SetEnableUpdates(false);
aError = nsContentUtils::SetNodeTextContent(this, aInnerHTML, true);
aError = nsContentUtils::SetNodeTextContent(this, aTextContent, true);
SetEnableUpdates(true);
mTriggeringPrincipal = aScriptedPrincipal;
UpdateStyleSheetInternal(nullptr, nullptr);
}
@ -189,7 +201,7 @@ already_AddRefed<nsIURI>
HTMLStyleElement::GetStyleSheetURL(bool* aIsInline, nsIPrincipal** aTriggeringPrincipal)
{
*aIsInline = true;
*aTriggeringPrincipal = nullptr;
*aTriggeringPrincipal = do_AddRef(mTriggeringPrincipal).take();
return nullptr;
}

Просмотреть файл

@ -34,7 +34,11 @@ public:
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML) override;
using nsGenericHTMLElement::SetInnerHTML;
virtual void SetInnerHTML(const nsAString& aInnerHTML,
nsIPrincipal& aSubjectPrincipal,
mozilla::ErrorResult& aError) override;
virtual void SetTextContentInternal(const nsAString& aTextContent,
nsIPrincipal* aSubjectPrincipal,
mozilla::ErrorResult& aError) override;
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,

Просмотреть файл

@ -40,6 +40,7 @@ bool
HTMLTableCaptionElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aAttribute == nsGkAtoms::align && aNamespaceID == kNameSpaceID_None) {
@ -47,7 +48,7 @@ HTMLTableCaptionElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -33,6 +33,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;

Просмотреть файл

@ -147,6 +147,7 @@ bool
HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -193,7 +194,7 @@ HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID,
aAttribute, aValue,
aResult) ||
nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -139,6 +139,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) override;

Просмотреть файл

@ -35,6 +35,7 @@ bool
HTMLTableColElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
if (aNamespaceID == kNameSpaceID_None) {
@ -59,7 +60,7 @@ HTMLTableColElement::ParseAttribute(int32_t aNamespaceID,
}
return nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}
void

Просмотреть файл

@ -74,6 +74,7 @@ public:
virtual bool ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult) override;
nsMapRuleToAttributesFunc GetAttributeMappingFunction() const override;
NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;

Просмотреть файл

@ -891,6 +891,7 @@ bool
HTMLTableElement::ParseAttribute(int32_t aNamespaceID,
nsAtom* aAttribute,
const nsAString& aValue,
nsIPrincipal* aMaybeScriptedPrincipal,
nsAttrValue& aResult)
{
/* ignore summary, just a string */
@ -932,7 +933,7 @@ HTMLTableElement::ParseAttribute(int32_t aNamespaceID,
aAttribute, aValue,
aResult) ||
nsGenericHTMLElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
aResult);
aMaybeScriptedPrincipal, aResult);
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше