Backed out changeset 00f6e702f095 because svg-image-script-2.svg is failing intermittently

This commit is contained in:
Dão Gottwald 2011-04-29 17:11:07 +02:00
parent 56a7c5d0ed
commit d72f56968e
8 changed files with 15 additions and 75 deletions

View File

@ -2283,15 +2283,18 @@ nsGenericElement::InternalIsSupported(nsISupports* aObject,
PL_strcmp(v, "3.0") == 0) {
*aReturn = PR_TRUE;
}
} else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
nsSVGFeatures::HaveFeature(aObject, aFeature)) {
}
#ifdef MOZ_SVG
else if (PL_strcasecmp(f, "SVGEvents") == 0 ||
PL_strcasecmp(f, "SVGZoomEvents") == 0 ||
nsSVGFeatures::HaveFeature(aFeature)) {
if (aVersion.IsEmpty() ||
PL_strcmp(v, "1.0") == 0 ||
PL_strcmp(v, "1.1") == 0) {
*aReturn = PR_TRUE;
}
}
#endif /* MOZ_SVG */
#ifdef MOZ_SMIL
else if (NS_SMILEnabled() && PL_strcasecmp(f, "TimeControl") == 0) {
if (aVersion.IsEmpty() || PL_strcmp(v, "1.0") == 0) {

View File

@ -54,31 +54,11 @@
#include "nsCharSeparatedTokenizer.h"
#include "nsStyleUtil.h"
#include "nsSVGUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
/*static*/ PRBool
nsSVGFeatures::HaveFeature(nsISupports* aObject, const nsAString& aFeature)
nsSVGFeatures::HaveFeature(const nsAString& aFeature)
{
if (aFeature.EqualsLiteral("http://www.w3.org/TR/SVG11/feature#Script")) {
nsCOMPtr<nsIContent> content(do_QueryInterface(aObject));
if (content) {
nsIDocument *doc = content->GetCurrentDoc();
if (doc && doc->IsResourceDoc()) {
// no scripting in SVG images or external resource documents
return PR_FALSE;
}
}
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
PRBool js;
if (NS_SUCCEEDED(prefs->GetBoolPref("javascript.enabled", &js))) {
return js;
}
}
return PR_FALSE;
}
#define SVG_SUPPORTED_FEATURE(str) if (aFeature.EqualsLiteral(str)) return PR_TRUE;
#define SVG_SUPPORTED_FEATURE(str) if (aFeature.Equals(NS_LITERAL_STRING(str).get())) return PR_TRUE;
#define SVG_UNSUPPORTED_FEATURE(str)
#include "nsSVGFeaturesList.h"
#undef SVG_SUPPORTED_FEATURE
@ -87,11 +67,11 @@ nsSVGFeatures::HaveFeature(nsISupports* aObject, const nsAString& aFeature)
}
/*static*/ PRBool
nsSVGFeatures::HaveFeatures(nsISupports* aObject, const nsSubstring& aFeatures)
nsSVGFeatures::HaveFeatures(const nsSubstring& aFeatures)
{
nsWhitespaceTokenizer tokenizer(aFeatures);
while (tokenizer.hasMoreTokens()) {
if (!HaveFeature(aObject, tokenizer.nextToken())) {
if (!HaveFeature(tokenizer.nextToken())) {
return PR_FALSE;
}
}
@ -101,7 +81,7 @@ nsSVGFeatures::HaveFeatures(nsISupports* aObject, const nsSubstring& aFeatures)
/*static*/ PRBool
nsSVGFeatures::HaveExtension(const nsAString& aExtension)
{
#define SVG_SUPPORTED_EXTENSION(str) if (aExtension.EqualsLiteral(str)) return PR_TRUE;
#define SVG_SUPPORTED_EXTENSION(str) if (aExtension.Equals(NS_LITERAL_STRING(str).get())) return PR_TRUE;
SVG_SUPPORTED_EXTENSION("http://www.w3.org/1999/xhtml")
#ifdef MOZ_MATHML
SVG_SUPPORTED_EXTENSION("http://www.w3.org/1998/Math/MathML")
@ -206,7 +186,7 @@ nsSVGFeatures::PassesConditionalProcessingTests(nsIContent *aContent,
// Required Features
nsAutoString value;
if (aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::requiredFeatures, value)) {
if (value.IsEmpty() || !HaveFeatures(aContent, value)) {
if (value.IsEmpty() || !HaveFeatures(value)) {
return PR_FALSE;
}
}

View File

@ -50,13 +50,11 @@ public:
/**
* Check whether we support the given feature string.
*
* @param aObject the object, which should support the feature,
* for example nsIDOMNode or nsIDOMDOMImplementation
* @param aFeature one of the feature strings specified at
* http://www.w3.org/TR/SVG11/feature.html
*/
static PRBool
HaveFeature(nsISupports* aObject, const nsAString& aFeature);
HaveFeature(const nsAString& aFeature);
/**
* Compare the language name(s) in a systemLanguage attribute to the
@ -99,13 +97,11 @@ private:
/**
* Check whether we support the given list of feature strings.
*
* @param aObject the object, which should support the feature,
* for example nsIDOMNode or nsIDOMDOMImplementation
* @param aFeatures a whitespace separated list containing one or more of the
* feature strings specified at http://www.w3.org/TR/SVG11/feature.html
*/
static PRBool
HaveFeatures(nsISupports* aObject, const nsSubstring& aFeatures);
HaveFeatures(const nsSubstring& aFeatures);
/**
* Check whether we support the given extension string.

View File

@ -81,6 +81,7 @@ SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Hyperlinking")
SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#XlinkAttribute")
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#ExternalResourcesRequired")
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#View")
SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Script")
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Font")
SVG_UNSUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#BasicFont")
SVG_SUPPORTED_FEATURE("http://www.w3.org/TR/SVG11/feature#Extensibility")

View File

@ -103,10 +103,6 @@ fails-if(d2d) == img-novb-width-slice-1.html img-novb-width-all-1-ref.html #
== svg-image-recursive-2a.svg svg-image-recursive-2-ref.svg
== svg-image-recursive-2b.html svg-image-recursive-2-ref.svg
# test that scripting feature is not supported in images or referenced documents
== svg-image-script-1.svg lime100x100.svg
== svg-image-script-2.svg lime100x100.svg
# tests for external resources vs. data URIs in SVG as an image
== svg-image-datauri-1.html lime100x100.svg
HTTP == svg-image-datauri-1.html lime100x100.svg

View File

@ -1,11 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
width="100" height="100">
<defs>
<pattern id="p1" patternUnits="userSpaceOnUse" width="100%" height="100%">
<rect width="100%" height="100%" fill="lime"/>
<rect id="r1" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Script" width="100%" height="100%" fill="orange"/>
</pattern>
</defs>
<rect width="100%" height="100%" fill="lime"/>
<rect requiredFeatures="http://www.w3.org/TR/SVG11/feature#Script" width="100%" height="100%" fill="blue"/>
</svg>

Before

Width:  |  Height:  |  Size: 541 B

View File

@ -1,6 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="100" height="100">
<rect width="100%" height="100%" fill="red"/>
<image width="100%" height="100%" xlink:href="script100x100.svg"/>
</svg>

Before

Width:  |  Height:  |  Size: 244 B

View File

@ -1,19 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
width="100" height="100" class="reftest-wait" onload="startTest()">
<rect width="100%" height="100%" fill="red"/>
<rect id="r1" width="100%" height="100%" fill="yellow"/>
<script type="application/javascript">
function startTest() {
document.addEventListener("MozReftestInvalidate", doTest, false);
// in case we're not gecko
setTimeout(doTest, 5000);
}
function doTest() {
var x = document.getElementById("r1");
x.setAttribute("fill", "url(script100x100.svg#p1)");
document.documentElement.removeAttribute('class');
}
</script>
</svg>

Before

Width:  |  Height:  |  Size: 690 B