hasFeature for SVG DOM implementation yields true with native SVG disabled

RESOLVED FIXED

Status

()

Core
SVG
RESOLVED FIXED
12 years ago
12 years ago

People

(Reporter: Martin Honnen, Assigned: Scooter Morris)

Tracking

({fixed1.8})

Trunk
x86
Windows XP
fixed1.8
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Reporter)

Description

12 years ago
Over on the SVG group on Yahoo groups there was some debate on how to detect
with script that native SVG is supported and enabled in a browser like Firefox
Deer Park (respectively upcoming Firefox releases).
One of the latest suggestions in this message
<http://groups.yahoo.com/group/svg-developers/message/50976>
is to use the DOM hasFeature method with the feature string 'org.w3c.dom.svg'
and version string '1.0' which seems a reasonable suggestion.
Thus I have tried to check
  document.implementation.hasFeature("org.w3c.dom.svg", "1.0")
in a Firefox trunk nightly (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US;
rv:1.8b4) Gecko/20050728 Firefox/1.0+) but unfortunately that yields true in all
cases, whether the preference svg.enabled is true or false.
If document.implementation.hasFeature("org.w3c.dom.svg", "1.0") is supposed to
allow a script to check whether native SVG support is enabled then it should
yield false if the preference svg.enabled is set to false.
(Reporter)

Comment 1

12 years ago
Created attachment 190953 [details]
test case (outputs document.implementation.hasFeature('org.w3c.dom.svg', '1.0'))

Test case should show false for
document.implementation.hasFeature("org.w3c.dom.svg", "1.0") if the preference
svg.enabled is false and true if the preference is true but currently a trunk
Firefox build always gives true.
(Assignee)

Comment 2

12 years ago
Created attachment 195928 [details] [diff] [review]
Check for SVGEnabled before evaluating feature
Assignee: general → scootermorris
Status: NEW → ASSIGNED
(Assignee)

Updated

12 years ago
Attachment #195928 - Flags: review?(jonathan.watt)
Comment on attachment 195928 [details] [diff] [review]
Check for SVGEnabled before evaluating feature

Cool, r=me if you put the

+#include "nsContentUtils.h"

in nsSVGUtils.h instead of nsSVGFeatures.cpp. I also prefer |if
(!nsSVGUtils::SVGEnabled()| but that's a nit and I'll leave that up to you.
Attachment #195928 - Flags: review?(jonathan.watt) → review+
(Assignee)

Comment 4

12 years ago
Created attachment 196087 [details] [diff] [review]
Final patch (for reference) with jwatt's changes
Attachment #195928 - Attachment is obsolete: true
(Assignee)

Comment 5

12 years ago
Checked in on trunk: r=jwatt
Checking in layout/svg/base/src/nsSVGUtils.h;
/cvsroot/mozilla/layout/svg/base/src/nsSVGUtils.h,v  <--  nsSVGUtils.h
new revision: 1.6; previous revision: 1.5
done
Checking in content/svg/content/src/nsSVGFeatures.cpp;
/cvsroot/mozilla/content/svg/content/src/nsSVGFeatures.cpp,v  <--  nsSVGFeatures.cpp
new revision: 1.3; previous revision: 1.2
done
(Assignee)

Updated

12 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → FIXED
(Assignee)

Updated

12 years ago
Attachment #196087 - Flags: approval1.8b5?

Updated

12 years ago
Attachment #196087 - Flags: approval1.8b5? → approval1.8b5+
(Assignee)

Comment 6

12 years ago
Checked in on branch:
Checking in layout/svg/base/src/nsSVGUtils.h;
/cvsroot/mozilla/layout/svg/base/src/nsSVGUtils.h,v  <--  nsSVGUtils.h
new revision: 1.2.2.2; previous revision: 1.2.2.1
done
Checking in content/svg/content/src/nsSVGFeatures.cpp;
/cvsroot/mozilla/content/svg/content/src/nsSVGFeatures.cpp,v  <--  nsSVGFeatures.cpp
new revision: 1.2.18.1; previous revision: 1.2
done
Keywords: fixed1.8
You need to log in before you can comment on or make changes to this bug.