代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/firefox 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
# HG changeset patch
# User Henri Sivonen <hsivonen@hsivonen.fi>
# Date 1603457329 0
# Fri Oct 23 12:48:49 2020 +0000
# Node ID 3476387362fb15c82f133f390afef719ad36de0a
# Parent fd45fcfd6261e9ed6cf83e54ad8286717f1b4762
Bug 1666300 part 1 - Remove attributes from descendants when setting sanitized style. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D93215
diff -r fd45fcfd6261 -r 3476387362fb dom/base/nsTreeSanitizer.cpp
--- a/dom/base/nsTreeSanitizer.cpp Fri Oct 23 13:04:19 2020 +0000
+++ b/dom/base/nsTreeSanitizer.cpp Fri Oct 23 12:48:49 2020 +0000
@@ -1341,6 +1341,7 @@
nsAutoString sanitizedStyle;
SanitizeStyleSheet(styleText, sanitizedStyle, aRoot->OwnerDoc(),
node->GetBaseURI());
+ RemoveAllAttributesFromDescendants(elt);
nsContentUtils::SetNodeTextContent(node, sanitizedStyle, true);
if (!mOnlyConditionalCSS) {
@@ -1427,6 +1428,18 @@
}
}
+void nsTreeSanitizer::RemoveAllAttributesFromDescendants(
+ mozilla::dom::Element* aElement) {
+ nsIContent* node = aElement->GetFirstChild();
+ while (node) {
+ if (node->IsElement()) {
+ mozilla::dom::Element* elt = node->AsElement();
+ RemoveAllAttributes(elt);
+ }
+ node = node->GetNextNode(aElement);
+ }
+}
+
void nsTreeSanitizer::LogMessage(const char* aMessage, Document* aDoc,
Element* aElement, nsAtom* aAttr) {
if (mLogRemovals) {
diff -r fd45fcfd6261 -r 3476387362fb dom/base/nsTreeSanitizer.h
--- a/dom/base/nsTreeSanitizer.h Fri Oct 23 13:04:19 2020 +0000
+++ b/dom/base/nsTreeSanitizer.h Fri Oct 23 12:48:49 2020 +0000
@@ -200,6 +200,12 @@
void RemoveAllAttributes(mozilla::dom::Element* aElement);
/**
+ * Removes all attributes from the descendants of an element but not from
+ * the element itself.
+ */
+ void RemoveAllAttributesFromDescendants(mozilla::dom::Element* aElement);
+
+ /**
* Log a Console Service message to indicate we removed something.
* If you pass an element and/or attribute, their information will
* be appended to the message.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。