Closed Bug 302640 Opened 19 years ago Closed 19 years ago

hasFeature for SVG DOM implementation yields true with native SVG disabled

Categories

(Core :: SVG, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: martin.honnen, Assigned: scootermorris)

Details

(Keywords: fixed1.8)

Attachments

(2 files, 1 obsolete file)

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.
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: general → scootermorris
Status: NEW → ASSIGNED
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+
Attachment #195928 - Attachment is obsolete: true
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
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #196087 - Flags: approval1.8b5?
Attachment #196087 - Flags: approval1.8b5? → approval1.8b5+
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.

Attachment

General

Creator:
Created:
Updated:
Size: