From 9579813b7aca186ce421aafdfde23fd52e141830 Mon Sep 17 00:00:00 2001 From: Mina Almasry Date: Tue, 16 Jul 2013 11:18:33 -0400 Subject: [PATCH] Bug 888864 - Changing a stylesheet ProcessingInstruction's data no longer applies immediately. r=bz --- content/base/src/Comment.h | 1 + content/base/src/nsGenericDOMDataNode.h | 2 +- content/base/src/nsTextNode.h | 1 + content/base/test/Makefile.in | 1 + ...essing_instruction_update_stylesheet.xhtml | 46 +++++++++++++++++++ content/xml/content/src/CDATASection.h | 1 + .../xml/content/src/ProcessingInstruction.h | 1 + .../src/XMLStylesheetProcessingInstruction.h | 11 +++++ 8 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 content/base/test/test_processing_instruction_update_stylesheet.xhtml diff --git a/content/base/src/Comment.h b/content/base/src/Comment.h index 530f2ab89c05..c2968e0909dd 100644 --- a/content/base/src/Comment.h +++ b/content/base/src/Comment.h @@ -46,6 +46,7 @@ public: // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) + using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. // nsIDOMComment // Empty interface diff --git a/content/base/src/nsGenericDOMDataNode.h b/content/base/src/nsGenericDOMDataNode.h index 51b7c7aa3bd1..0f51254e00f4 100644 --- a/content/base/src/nsGenericDOMDataNode.h +++ b/content/base/src/nsGenericDOMDataNode.h @@ -169,7 +169,7 @@ public: // WebIDL API // Our XPCOM GetData is just fine for WebIDL - void SetData(const nsAString& aData, mozilla::ErrorResult& rv) + virtual void SetData(const nsAString& aData, mozilla::ErrorResult& rv) { rv = SetData(aData); } diff --git a/content/base/src/nsTextNode.h b/content/base/src/nsTextNode.h index cb762c2a7cc8..e0e3e0f62856 100644 --- a/content/base/src/nsTextNode.h +++ b/content/base/src/nsTextNode.h @@ -53,6 +53,7 @@ public: // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) + using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. // nsIDOMText NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::) diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index 638d49a18f67..68ed1b91c24d 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -638,6 +638,7 @@ MOCHITEST_FILES_C= \ test_bug890580.html \ test_declare_stylesheet_obsolete.html \ variable_style_sheet.sjs \ + test_processing_instruction_update_stylesheet.xhtml \ $(NULL) # OOP tests don't work on Windows (bug 763081) or native-fennec diff --git a/content/base/test/test_processing_instruction_update_stylesheet.xhtml b/content/base/test/test_processing_instruction_update_stylesheet.xhtml new file mode 100644 index 000000000000..c921bcc1c255 --- /dev/null +++ b/content/base/test/test_processing_instruction_update_stylesheet.xhtml @@ -0,0 +1,46 @@ + + + + + + + Test for Bug 888864 + + + + + +

This changes color

+Mozilla Bug 888864 +
+
+ + diff --git a/content/xml/content/src/CDATASection.h b/content/xml/content/src/CDATASection.h index 6caabd0591ee..03537c6506e3 100644 --- a/content/xml/content/src/CDATASection.h +++ b/content/xml/content/src/CDATASection.h @@ -48,6 +48,7 @@ public: // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) + using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. // nsIDOMText NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::) diff --git a/content/xml/content/src/ProcessingInstruction.h b/content/xml/content/src/ProcessingInstruction.h index 04fc8d383df3..461cfff33a0e 100644 --- a/content/xml/content/src/ProcessingInstruction.h +++ b/content/xml/content/src/ProcessingInstruction.h @@ -30,6 +30,7 @@ public: // nsIDOMCharacterData NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::) + using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. // nsIDOMProcessingInstruction NS_DECL_NSIDOMPROCESSINGINSTRUCTION diff --git a/content/xml/content/src/XMLStylesheetProcessingInstruction.h b/content/xml/content/src/XMLStylesheetProcessingInstruction.h index e65f9227162d..f60ac26668cc 100644 --- a/content/xml/content/src/XMLStylesheetProcessingInstruction.h +++ b/content/xml/content/src/XMLStylesheetProcessingInstruction.h @@ -63,6 +63,17 @@ public: // nsStyleLinkElement NS_IMETHOD GetCharset(nsAString& aCharset) MOZ_OVERRIDE; + virtual void SetData(const nsAString& aData, mozilla::ErrorResult& rv) MOZ_OVERRIDE + { + nsGenericDOMDataNode::SetData(aData, rv); + if (rv.Failed()) { + return; + } + UpdateStyleSheetInternal(nullptr, true); + } + using nsGenericDOMDataNode::SetData; // Prevent hiding overloaded virtual function. + using ProcessingInstruction::SetData; + protected: nsCOMPtr mOverriddenBaseURI;