Bug 433616. Fix the XML parser's bailing out on CSS loads blocked by the security manager, fix a base URI bug in <svg:use>, add some more tests. r=jst, sr=roc

This commit is contained in:
Boris Zbarsky 2008-09-28 15:18:04 -04:00
Родитель 077399c898
Коммит bab1123e55
8 изменённых файлов: 110 добавлений и 4 удалений

Просмотреть файл

@ -314,8 +314,12 @@ nsStyleLinkElement::DoUpdateStyleSheet(nsIDocument *aOldDocument,
rv = doc->CSSLoader()->
LoadStyleLink(thisContent, uri, title, media, isAlternate, aObserver,
&isAlternate);
if (rv == NS_ERROR_FILE_NOT_FOUND) {
if (NS_FAILED(rv)) {
// Don't propagate LoadStyleLink() errors further than this, since some
// consumers (e.g. nsXMLContentSink) will completely abort on innocuous
// things like a stylesheet load being blocked by the security system.
doneLoading = PR_TRUE;
isAlternate = PR_FALSE;
rv = NS_OK;
}
}

Просмотреть файл

@ -377,6 +377,15 @@ nsSVGUseElement::CreateAnonymousContent()
}
}
// Set up its base URI correctly
nsCOMPtr<nsIURI> baseURI = targetContent->GetBaseURI();
if (!baseURI)
return nsnull;
nsCAutoString spec;
baseURI->GetSpec(spec);
newcontent->SetAttr(kNameSpaceID_XML, nsGkAtoms::base,
NS_ConvertUTF8toUTF16(spec), PR_FALSE);
targetContent->AddMutationObserver(this);
mClone = newcontent;
return mClone;

Просмотреть файл

@ -137,9 +137,10 @@ nsIScriptGlobalObject* GetGlobalObject(nsIChannel* aChannel)
// Get the global object owner from the channel
nsCOMPtr<nsIScriptGlobalObjectOwner> globalOwner;
NS_QueryNotificationCallbacks(aChannel, globalOwner);
NS_ASSERTION(globalOwner,
"Unable to get an nsIScriptGlobalObjectOwner from the "
"channel!");
if (!globalOwner) {
NS_WARNING("Unable to get an nsIScriptGlobalObjectOwner from the "
"channel!");
}
if (!globalOwner) {
return nsnull;
}

Просмотреть файл

@ -1,6 +1,10 @@
<?xml-stylesheet
type="text/css"
href="data:text/css,circle { fill: white }" ?>
<!-- test for javascript: execution: shouldn't happen -->
<?xml-stylesheet
type="text/css"
href="javascript:'circle { fill: black }'" ?>
<svg height="0" xmlns="http://www.w3.org/2000/svg">
<style type="text/css">
/* XXXbz this should really be an external reference to mask-html-01.xhtml

До

Ширина:  |  Высота:  |  Размер: 1.1 KiB

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

@ -31,6 +31,7 @@ include moz-only/reftest.list
== dynamic-text-03.svg dynamic-text-03-ref.svg
== dynamic-use-01.svg pass.svg
== use-01-extref.svg pass.svg
== use-02-extref.svg use-02-extref-ref.svg
== fallback-color-01a.svg pass.svg
== fallback-color-01b.svg pass.svg
== fallback-color-02a.svg fallback-color-02-ref.svg

Просмотреть файл

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg">
<g id="testContent" color="forestgreen">
<defs>
<linearGradient id="linearGrad" gradientUnits="objectBoundingBox" y1="0" x1="0" y2="1" x2="1">
<stop offset="0%" stop-color="royalblue"/>
<stop offset="33%" stop-color="white"/>
<stop offset="50%" stop-color="darkblue"/>
<stop offset="66%" stop-color="white"/>
<stop offset="100%" stop-color="royalblue"/>
</linearGradient>
<radialGradient id="radialGrad" gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.15" fy="0.15">
<stop offset="000%" stop-color="orange" />
<stop offset="033%" stop-color="red" />
<stop offset="050%" stop-color="gold" />
<stop offset="066%" stop-color="red" />
<stop offset="100%" stop-color="orange" />
</radialGradient>
</defs>
<rect x="0" y="0" width="200" height="125" stroke="none"
fill="url(#linearGrad)"/>
<rect x="200" y="0" width="200" height="125" stroke="none"
fill="currentColor"/>
<rect x="0" y="125" width="200" height="125" stroke="none"
fill="currentColor"/>
<rect x="200" y="125" width="200" height="125" stroke="none" fill="url(#radialGrad)" />
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg">
<g color="ghostwhite">
<defs>
<linearGradient id="linearGrad1" gradientUnits="objectBoundingBox" y1="0" x1="0" y2="1" x2="1" >
<stop offset="000%" stop-color="orange" />
<stop offset="033%" stop-color="red" />
<stop offset="050%" stop-color="gold" />
<stop offset="066%" stop-color="red" />
<stop offset="100%" stop-color="orange" />
</linearGradient>
<radialGradient id="radialGrad1" gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.15" fy="0.15" >
<stop offset="000%" stop-color="orange" />
<stop offset="033%" stop-color="red" />
<stop offset="050%" stop-color="gold" />
<stop offset="066%" stop-color="red" />
<stop offset="100%" stop-color="orange" />
</radialGradient>
</defs>
<g>
<rect id="rect1" x="0" y="0" width="200" height="125" stroke="none" />
<rect id="rect2" x="200" y="0" width="200" height="125" stroke="none" />
<rect id="rect3" x="0" y="125" width="200" height="125" stroke="none" fill="currentColor"/>
<rect id="rect4" x="200" y="125" width="200" height="125" stroke="none" fill="url(#radialGrad1)" />
</g>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

Просмотреть файл

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<g color="forestgreen">
<defs>
<linearGradient id="linearGrad1" gradientUnits="objectBoundingBox" y1="0" x1="0" y2="1" x2="1">
<stop offset="0%" stop-color="royalblue"/>
<stop offset="33%" stop-color="white"/>
<stop offset="50%" stop-color="darkblue"/>
<stop offset="66%" stop-color="white"/>
<stop offset="100%" stop-color="royalblue"/>
</linearGradient>
<radialGradient id="radialGrad1" gradientUnits="objectBoundingBox" cx="0.5" cy="0.5" r="0.5" fx="0.15" fy="0.15">
<stop offset="00%" stop-color="royalblue"/>
<stop offset="33%" stop-color="white"/>
<stop offset="50%" stop-color="darkblue"/>
<stop offset="66%" stop-color="white"/>
<stop offset="100%" stop-color="royalblue"/>
</radialGradient>
</defs>
<use xlink:href="use-02-extref-resource.svg#rect1" fill="url(#linearGrad1)"/>
<use xlink:href="use-02-extref-resource.svg#rect2" fill="currentColor"/>
<use xlink:href="use-02-extref-resource.svg#rect3"/>
<use xlink:href="use-02-extref-resource.svg#rect4"/>
</g>
</svg>

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB