Last Comment Bug 302640 - hasFeature for SVG DOM implementation yields true with native SVG disabled
: hasFeature for SVG DOM implementation yields true with native SVG disabled
Status: RESOLVED FIXED
: fixed1.8
Product: Core
Classification: Components
Component: SVG (show other bugs)
: Trunk
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Scooter Morris
: Hixie (not reading bugmail)
: Jet Villegas (:jet)
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-07-29 07:54 PDT by Martin Honnen
Modified: 2006-03-12 18:45 PST (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
test case (outputs document.implementation.hasFeature('org.w3c.dom.svg', '1.0')) (1.34 KB, application/xml)
2005-07-29 08:12 PDT, Martin Honnen
no flags Details
Check for SVGEnabled before evaluating feature (1.18 KB, patch)
2005-09-13 13:13 PDT, Scooter Morris
jwatt: review+
Details | Diff | Splinter Review
Final patch (for reference) with jwatt's changes (1.96 KB, patch)
2005-09-14 16:26 PDT, Scooter Morris
asa: approval1.8b5+
Details | Diff | Splinter Review

Description Martin Honnen 2005-07-29 07:54:07 PDT
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.
Comment 1 Martin Honnen 2005-07-29 08:12:33 PDT
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.
Comment 2 Scooter Morris 2005-09-13 13:13:02 PDT
Created attachment 195928 [details] [diff] [review]
Check for SVGEnabled before evaluating feature
Comment 3 Jonathan Watt [:jwatt] 2005-09-13 16:15:34 PDT
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.
Comment 4 Scooter Morris 2005-09-14 16:26:50 PDT
Created attachment 196087 [details] [diff] [review]
Final patch (for reference) with jwatt's changes
Comment 5 Scooter Morris 2005-09-14 16:31:40 PDT
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
Comment 6 Scooter Morris 2005-09-16 13:14:03 PDT
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

Note You need to log in before you can comment on or make changes to this bug.