Bug 295994 - [p=honzab@allpeers.com (Honza Bambas [mayhemer]) r+sr=sicking a1.9=schrep/damons]
git-svn-id: svn://10.0.0.236/trunk@249827 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
68c954841b
commit
6f831c32c4
40
mozilla/content/xul/content/test/398289-resource.xul
Normal file
40
mozilla/content/xul/content/test/398289-resource.xul
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
||||
<dialog xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
buttonlabelaccept="OK"
|
||||
ondialogaccept="alert('OK');"
|
||||
buttonlabelcancel="Cancel"
|
||||
ondialogcancel="alert('Cancel');">
|
||||
|
||||
<tabbox id="test" flex="1" persist="selectedIndex">
|
||||
|
||||
<tabs>
|
||||
<tab label="One"/>
|
||||
<tab label="Two"/>
|
||||
</tabs>
|
||||
|
||||
<tabpanels flex="1">
|
||||
|
||||
<vbox flex="1">
|
||||
<description>Text for tab ONE</description>
|
||||
<description class="text-link"
|
||||
onclick="window.open('https://bugzilla.mozilla.org/show_bug.cgi?id=398289');">(test case for bug 398289)</description>
|
||||
<tree>
|
||||
<treecols>
|
||||
<treecol label="Header" flex="1"/>
|
||||
</treecols>
|
||||
</tree>
|
||||
</vbox>
|
||||
|
||||
<vbox flex="1">
|
||||
<description>Text for tab TWO</description>
|
||||
<description>(When the document is reloaded, this content gets replaced by the one from the first tab.)</description>
|
||||
</vbox>
|
||||
|
||||
</tabpanels>
|
||||
|
||||
</tabbox>
|
||||
|
||||
</dialog>
|
||||
@ -47,6 +47,14 @@ include $(topsrcdir)/config/rules.mk
|
||||
_TEST_FILES = test_bug330705-2.xul \
|
||||
test_bug233643.xul \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
test_bug398289.html \
|
||||
398289-resource.xul \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
||||
libs:: $(_CHROME_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
|
||||
|
||||
30
mozilla/content/xul/content/test/test_bug398289.html
Normal file
30
mozilla/content/xul/content/test/test_bug398289.html
Normal file
@ -0,0 +1,30 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="reftest-wait" style="height: 100%">
|
||||
<head>
|
||||
<title>Test for bug 398289</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body style="height: 100%">
|
||||
<iframe id="test" src="chrome://mochikit/content/chrome/content/xul/content/test/398289-resource.xul" width="100%" height="100%">
|
||||
</iframe>
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.frames[0].document.getElementById("test").selectedIndex = 0;
|
||||
window.frames[0].document.getElementById("test").selectedIndex = 1;
|
||||
document.getElementById("test").onload = onLoad;
|
||||
window.frames[0].location.reload();
|
||||
|
||||
function onLoad() {
|
||||
document.documentElement.className = "";
|
||||
is(window.frames[0].document.getElementById("test").selectedIndex, 1,
|
||||
"persistent attribute in tab box broken");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -1274,14 +1274,33 @@ nsXULDocument::Persist(const nsAString& aID,
|
||||
}
|
||||
|
||||
|
||||
PRBool
|
||||
nsXULDocument::IsCapabilityEnabled(const char* aCapabilityLabel)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// NodePrincipal is guarantied to be non-null
|
||||
PRBool enabled = PR_FALSE;
|
||||
rv = NodePrincipal()->IsCapabilityEnabled(aCapabilityLabel, nsnull, &enabled);
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
return enabled;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID,
|
||||
nsIAtom* aAttribute)
|
||||
{
|
||||
// For non-chrome documents, persistance is simply broken
|
||||
if (!IsCapabilityEnabled("UniversalBrowserWrite"))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
// First make sure we _have_ a local store to stuff the persisted
|
||||
// information into. (We might not have one if profile information
|
||||
// hasn't been loaded yet...)
|
||||
if (! mLocalStore)
|
||||
if (!mLocalStore)
|
||||
return NS_OK;
|
||||
|
||||
nsresult rv;
|
||||
@ -2066,13 +2085,26 @@ nsXULDocument::PrepareToLoadPrototype(nsIURI* aURI, const char* aCommand,
|
||||
nsresult
|
||||
nsXULDocument::ApplyPersistentAttributes()
|
||||
{
|
||||
// For non-chrome documents, persistance is simply broken
|
||||
if (!IsCapabilityEnabled("UniversalBrowserRead"))
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
// Add all of the 'persisted' attributes into the content
|
||||
// model.
|
||||
if (! mLocalStore)
|
||||
if (!mLocalStore)
|
||||
return NS_OK;
|
||||
|
||||
mApplyingPersistedAttrs = PR_TRUE;
|
||||
ApplyPersistentAttributesInternal();
|
||||
mApplyingPersistedAttrs = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsXULDocument::ApplyPersistentAttributesInternal()
|
||||
{
|
||||
nsCOMArray<nsIContent> elements;
|
||||
|
||||
nsCAutoString docurl;
|
||||
@ -2119,8 +2151,6 @@ nsXULDocument::ApplyPersistentAttributes()
|
||||
ApplyPersistentAttributesToElements(resource, elements);
|
||||
}
|
||||
|
||||
mApplyingPersistedAttrs = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -3027,8 +3057,7 @@ nsXULDocument::ResumeWalk()
|
||||
rv = ResolveForwardReferences();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = ApplyPersistentAttributes();
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
ApplyPersistentAttributes();
|
||||
|
||||
mStillWalking = PR_FALSE;
|
||||
if (mPendingSheets == 0) {
|
||||
|
||||
@ -201,6 +201,7 @@ protected:
|
||||
PRBool* aFailureFromContent);
|
||||
|
||||
nsresult ApplyPersistentAttributes();
|
||||
nsresult ApplyPersistentAttributesInternal();
|
||||
nsresult ApplyPersistentAttributesToElements(nsIRDFResource* aResource,
|
||||
nsCOMArray<nsIContent>& aElements);
|
||||
|
||||
@ -237,6 +238,9 @@ protected:
|
||||
|
||||
static PRLogModuleInfo* gXULLog;
|
||||
|
||||
PRBool
|
||||
IsCapabilityEnabled(const char* aCapabilityLabel);
|
||||
|
||||
nsresult
|
||||
Persist(nsIContent* aElement, PRInt32 aNameSpaceID, nsIAtom* aAttribute);
|
||||
|
||||
|
||||
@ -622,7 +622,6 @@ skip-if(MOZ_WIDGET_TOOLKIT!="windows") == 391045.html 391045-ref.html # windows-
|
||||
== 397428-1.html 397428-1-ref.html
|
||||
== 397844-1.xhtml 397844-1-ref.xhtml
|
||||
== 398101-1.html 398101-1-ref.html
|
||||
== 398289-1.html 398289-1-ref.html
|
||||
== 398144-1.html 398144-1-ref.html
|
||||
== 398797-1a.html 398797-1-ref.html
|
||||
== 398797-1b.html 398797-1-ref.html
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user