Merge mozilla-central to pick up unit test fixes

This commit is contained in:
Chris Jones 2009-10-22 20:33:36 -05:00
Родитель 7fc4deec24 b53e3ce12b
Коммит bcf3969bc6
202 изменённых файлов: 9966 добавлений и 9772 удалений

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

@ -48,6 +48,10 @@
#include "nsISelectionController.h"
#include "nsComponentManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTextAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLTextAccessible::nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessibleWrap(aDomNode, aShell)
{
@ -112,6 +116,10 @@ nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLHRAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLHRAccessible::nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsLeafAccessible(aDomNode, aShell)
{
@ -162,13 +170,16 @@ nsHTMLBRAccessible::GetNameInternal(nsAString& aName)
return NS_OK;
}
// A label is an element (not a leaf) and thus can support advanced interfaces.
// We need to skip over nsTextAccessible QI which prevents that
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsLinkableAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLabelAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLLabelAccessible::nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
nsTextAccessible(aDomNode, aShell)
{
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
nsHTMLLabelAccessible::
nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell) :
nsHyperTextAccessibleWrap(aDomNode, aShell)
{
}
nsresult
@ -184,37 +195,9 @@ nsHTMLLabelAccessible::GetRoleInternal(PRUint32 *aRole)
return NS_OK;
}
nsresult
nsHTMLLabelAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
{
nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
*aState &= (nsIAccessibleStates::STATE_LINKED |
nsIAccessibleStates::STATE_TRAVERSED); // Only use link states
return NS_OK;
}
NS_IMETHODIMP nsHTMLLabelAccessible::GetFirstChild(nsIAccessible **aFirstChild)
{
// A <label> is not necessarily a leaf!
return nsAccessible::GetFirstChild(aFirstChild);
}
/* readonly attribute nsIAccessible accFirstChild; */
NS_IMETHODIMP nsHTMLLabelAccessible::GetLastChild(nsIAccessible **aLastChild)
{
// A <label> is not necessarily a leaf!
return nsAccessible::GetLastChild(aLastChild);
}
/* readonly attribute long accChildCount; */
NS_IMETHODIMP nsHTMLLabelAccessible::GetChildCount(PRInt32 *aAccChildCount)
{
// A <label> is not necessarily a leaf!
return nsAccessible::GetChildCount(aAccChildCount);
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLIAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLLIAccessible::nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
const nsAString& aBulletText):
@ -290,8 +273,10 @@ void nsHTMLLIAccessible::CacheChildren()
}
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLListBulletAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLListBulletAccessible::
nsHTMLListBulletAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell,
const nsAString& aBulletText) :
@ -364,6 +349,7 @@ nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset
////////////////////////////////////////////////////////////////////////////////
// nsHTMLListAccessible
////////////////////////////////////////////////////////////////////////////////
nsresult
nsHTMLListAccessible::GetRoleInternal(PRUint32 *aRole)

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

@ -80,22 +80,16 @@ public:
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsHTMLLabelAccessible : public nsTextAccessible
class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
{
public:
nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
NS_IMETHOD GetChildCount(PRInt32 *aAccChildCount);
// nsAccessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
};
class nsHTMLListBulletAccessible : public nsLeafAccessible

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

@ -508,9 +508,11 @@ nsXULTreeAccessible::RefSelection(PRInt32 aIndex, nsIAccessible **aAccessible)
return NS_OK;
}
NS_IMETHODIMP nsXULTreeAccessible::SelectAllSelection(PRBool *_retval)
NS_IMETHODIMP
nsXULTreeAccessible::SelectAllSelection(PRBool *aIsMultiSelectable)
{
*_retval = PR_FALSE;
NS_ENSURE_ARG_POINTER(aIsMultiSelectable);
*aIsMultiSelectable = PR_FALSE;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -518,14 +520,15 @@ NS_IMETHODIMP nsXULTreeAccessible::SelectAllSelection(PRBool *_retval)
// see if we are multiple select if so set ourselves as such
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
if (element) {
nsAutoString selType;
element->GetAttribute(NS_LITERAL_STRING("seltype"), selType);
if (selType.IsEmpty() || !selType.EqualsLiteral("single")) {
*_retval = PR_TRUE;
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection)
nsCOMPtr<nsITreeSelection> selection;
mTreeView->GetSelection(getter_AddRefs(selection));
if (selection) {
PRBool single = PR_FALSE;
selection->GetSingle(&single);
if (!single) {
*aIsMultiSelectable = PR_TRUE;
selection->SelectAll();
}
}
}

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

@ -130,6 +130,7 @@ _TEST_FILES =\
test_relations_tree.xul \
test_role_nsHyperTextAcc.html \
test_role_table_cells.html \
test_selectable_tree.xul \
test_states.html \
test_states_doc.html \
test_states_docarticle.html \

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

@ -0,0 +1,160 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/a11y/accessible/treeview.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL tree selectable tests">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/states.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/events.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
// gA11yEventDumpID = "debug";
/**
* Event queue invoker object to test accessible states for XUL tree
* accessible.
*/
function statesChecker(aTreeID, aView)
{
this.DOMNode = getNode(aTreeID);
this.invoke = function invoke()
{
this.DOMNode.treeBoxObject.view = aView;
}
this.check = function check()
{
var tree = getAccessible(this.DOMNode);
var isTreeMultiSelectable = false;
var seltype = this.DOMNode.getAttribute("seltype");
if (seltype != "single" && seltype != "cell" && seltype != "text")
isTreeMultiSelectable = true;
// test SelectAllSelection correctly discerns multiselect vs single
var accSelectable = getAccessible(this.DOMNode,
[nsIAccessibleSelectable]);
ok(accSelectable, "tree is not selectable!");
if (accSelectable) {
is(accSelectable.selectAllSelection(), isTreeMultiSelectable,
"SelectAllSelection is not correct for seltype: " + seltype);
}
// test that the selection worked as expected
var rows = tree.children;
for (var i = 0; i < rows.length; i++) {
var row = rows.queryElementAt(i, nsIAccessible);
if (getRole(row) == (ROLE_OUTLINEITEM || ROLE_ROW)){
testStates(row, isTreeMultiSelectable? STATE_SELECTED : 0, 0, 0,
isTreeMultiSelectable? 0: STATE_SELECTED);
}
}
}
this.getID = function getID()
{
"tree processor for " + prettyName(aTreeID);
}
}
var gQueue = null;
function doTest()
{
gQueue = new eventQueue("TreeViewChanged");
gQueue.push(new statesChecker("tree", new nsTreeTreeView()));
gQueue.push(new statesChecker("treesingle", new nsTreeTreeView()));
gQueue.push(new statesChecker("treecell", new nsTreeTreeView()));
gQueue.push(new statesChecker("treetext", new nsTreeTreeView()));
gQueue.push(new statesChecker("tabletree", new nsTreeTreeView()));
gQueue.invoke(); // Will call SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=523118"
title="we mistake 'cell' and text' xul tree seltypes for multiselects">
Mozilla Bug 523118
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<tree id="treesingle" flex="1" seltype="single">
<treecols>
<treecol id="col_single" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<tree id="treecell" flex="1" seltype="cell">
<treecols>
<treecol id="col_cell" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<tree id="treetext" flex="1" seltype="text">
<treecols>
<treecol id="col_text" flex="1" primary="true" label="column"/>
</treecols>
<treechildren/>
</tree>
<tree id="tabletree" flex="1" editable="true">
<treecols>
<treecol id="tabletree_col1" cycler="true" label="cycler"/>
<treecol id="tabletree_col2" flex="1" primary="true" label="column1"/>
<treecol id="tabletree_col3" flex="1" label="column2"/>
<treecol id="tabletree_col4" flex="1" label="checker"
type="checkbox" editable="true"/>
</treecols>
<treechildren/>
</tree>
<vbox id="debug"/>
</vbox>
</hbox>
</window>

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

@ -138,7 +138,7 @@ const Ci = Components.interfaces;
// are useful for support and won't compromise the user's privacy. Note that
// entries are *prefixes*: for example, "accessibility." applies to all prefs
// under the "accessibility.*" branch.
const Whitelist = [
const PREFS_WHITELIST = [
"accessibility.",
"browser.fixup.",
"browser.history_expire_",
@ -165,10 +165,9 @@ const Whitelist = [
];
// The blacklist, unlike the whitelist, is a list of regular expressions.
const Blacklist = [
/^print[.]print_to_filename$/,
/^print[.].*[.]print_to_filename$/,
/^network[.]proxy[.].*$/
const PREFS_BLACKLIST = [
/^network[.]proxy[.]/,
/[.]print_to_filename$/,
];
window.onload = function () {
@ -221,12 +220,12 @@ function populatePreferencesSection() {
let sortedPrefs = modifiedPrefs.sort(comparePrefs);
let trPrefs = [];
for each (let pref in sortedPrefs) {
sortedPrefs.forEach(function (pref) {
let tdName = createElement("td", pref.name, "pref-name");
let tdValue = createElement("td", formatPrefValue(pref.value), "pref-value");
let tr = createParentElement("tr", [tdName, tdValue]);
trPrefs.push(tr);
}
});
appendChildren(document.getElementById("prefs-tbody"), trPrefs);
}
@ -261,15 +260,15 @@ function getModifiedPrefs() {
function getWhitelistedPrefNames(prefRootBranch) {
let results = [];
for each (let prefStem in Whitelist) {
PREFS_WHITELIST.forEach(function (prefStem) {
let prefNames = prefRootBranch.getChildList(prefStem, {});
results = results.concat(prefNames);
}
});
return results;
}
function isBlacklisted(prefName) {
return Blacklist.some(function (re) {return re.test(prefName);});
return PREFS_BLACKLIST.some(function (re) re.test(prefName));
}
function createParentElement(tagName, childElems) {

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

@ -156,6 +156,10 @@
type="checkbox"
accesskey="&blockImageCmd.accesskey;"
oncommand="gContextMenu.toggleImageBlocking(this.getAttribute('checked') == 'true');"/>
<menuitem id="context-viewimageinfo"
label="&viewImageInfoCmd.label;"
accesskey="&viewImageInfoCmd.accesskey;"
oncommand="gContextMenu.viewImageInfo();"/>
<menuitem id="context-savevideo"
label="&saveVideoCmd.label;"
accesskey="&saveVideoCmd.accesskey;"

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

@ -2085,9 +2085,10 @@ function BrowserViewSourceOfDocument(aDocument)
// doc - document to use for source, or null for this window's document
// initialTab - name of the initial tab to display, or null for the first tab
function BrowserPageInfo(doc, initialTab)
// imageUrl - url of an image to load in the Media Tab of the Page Info window; can be null/omitted
function BrowserPageInfo(doc, initialTab, imageUrl)
{
var args = {doc: doc, initialTab: initialTab};
var args = {doc: doc, initialTab: initialTab, imageUrl: imageUrl};
return toOpenDialogByTypeAndUrl("Browser:page-info",
doc ? doc.location : window.content.document.location,
"chrome://browser/content/pageinfo/pageInfo.xul",
@ -7062,6 +7063,14 @@ let gURLBarEmptyText = {
var LightWeightThemeWebInstaller = {
handleEvent: function (event) {
switch (event.type) {
case "InstallBrowserTheme":
case "PreviewBrowserTheme":
case "ResetBrowserThemePreview":
// ignore requests from background tabs
if (event.target.ownerDocument.defaultView.top != content)
return;
}
switch (event.type) {
case "InstallBrowserTheme":
this._installRequest(event);
@ -7072,6 +7081,10 @@ var LightWeightThemeWebInstaller = {
case "ResetBrowserThemePreview":
this._resetPreview(event);
break;
case "pagehide":
case "TabSelect":
this._resetPreview();
break;
}
},
@ -7164,6 +7177,7 @@ var LightWeightThemeWebInstaller = {
});
},
_previewWindow: null,
_preview: function (event) {
if (!this._isAllowed(event.target))
return;
@ -7172,13 +7186,24 @@ var LightWeightThemeWebInstaller = {
if (!data)
return;
this._resetPreview();
this._previewWindow = event.target.ownerDocument.defaultView;
this._previewWindow.addEventListener("pagehide", this, true);
gBrowser.tabContainer.addEventListener("TabSelect", this, false);
this._manager.previewTheme(data);
},
_resetPreview: function (event) {
if (!this._isAllowed(event.target))
if (!this._previewWindow ||
event && !this._isAllowed(event.target))
return;
this._previewWindow.removeEventListener("pagehide", this, true);
this._previewWindow = null;
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
this._manager.resetPreview();
},

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

@ -257,6 +257,8 @@ nsContextMenu.prototype = {
this.showItem("context-sep-viewbgimage", shouldShow && !this._hasMultipleBGImages);
document.getElementById("context-viewbgimage")
.disabled = !this.hasBGImage;
this.showItem("context-viewimageinfo", (this.onImage));
},
initMiscItems: function CM_initMiscItems() {
@ -776,6 +778,10 @@ nsContextMenu.prototype = {
BrowserPageInfo(this.target.ownerDocument.defaultView.top.document);
},
viewImageInfo: function() {
BrowserPageInfo(this.target.ownerDocument.defaultView.top.document,"mediaTab",this.mediaURL);
},
viewFrameInfo: function() {
BrowserPageInfo(this.target.ownerDocument);
},

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

@ -14,3 +14,8 @@ richlistitem[feed]:not([selected="true"]) .feed-subscribe {
groupbox[closed="true"] > .groupbox-body {
visibility: collapse;
}
/* This following entry can be removed when Bug 522850 is fixed. */
#thepreviewimage {
min-width: 1px;
}

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

@ -85,6 +85,8 @@ pageInfoTreeView.prototype = {
{
this.rows = this.data.push(row);
this.rowCountChanged(this.rows - 1, 1);
if (this.selection.count == 0 && this.rowCount)
this.selection.select(0);
},
rowCountChanged: function(index, count)
@ -146,6 +148,7 @@ pageInfoTreeView.prototype = {
// mmm, yummy. global variables.
var gWindow = null;
var gDocument = null;
var gImageUrl = null;
// column number to help using the data array
const COL_IMAGE_ADDRESS = 0;
@ -293,6 +296,11 @@ function onLoadPageInfo()
var imageTree = document.getElementById("imagetree");
imageTree.view = gImageView;
// set gImageUrl if present
if ("arguments" in window && window.arguments.length >= 1 &&
window.arguments[0] && window.arguments[0].imageUrl)
gImageUrl = window.arguments[0].imageUrl;
// build the content
loadPageInfo();
@ -523,6 +531,7 @@ function processFrames()
var iterator = doc.createTreeWalker(doc, NodeFilter.SHOW_ELEMENT, grabAll, true);
gFrameList.shift();
setTimeout(doGrab, 16, iterator);
onFinished.push(selectImgUrl);
}
else
onFinished.forEach(function(func) { func(); });
@ -539,14 +548,6 @@ function doGrab(iterator)
setTimeout(doGrab, 16, iterator);
}
function ensureSelection(view)
{
// only select something if nothing is currently selected
// and if there's anything to select
if (view.selection.count == 0 && view.rowCount)
view.selection.select(0);
}
function addImage(url, type, alt, elem, isBg)
{
if (!url)
@ -1169,3 +1170,17 @@ function doSelectAll()
if (elem && "treeBoxObject" in elem)
elem.view.selection.selectAll();
}
function selectImgUrl ()
{
if (gImageUrl) {
var tree = document.getElementById("imagetree");
for (var c = 0; c < tree.view.rowCount; c++)
{
if (gImageUrl == gImageView.data[c][COL_IMAGE_ADDRESS]) {
tree.view.selection.select(c);
return;
}
}
}
}

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

@ -119,7 +119,7 @@
<radio id="generalTab" label="&generalTab;" accesskey="&generalTab.accesskey;"
oncommand="showTab('general');"/>
<radio id="mediaTab" label="&mediaTab;" accesskey="&mediaTab.accesskey;"
oncommand="showTab('media'); ensureSelection(gImageView)" hidden="true"/>
oncommand="showTab('media');" hidden="true"/>
<radio id="feedTab" label="&feedTab;" accesskey="&feedTab.accesskey;"
oncommand="showTab('feed');" hidden="true"/>
<radio id="permTab" label="&permTab;" accesskey="&permTab.accesskey;"

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

@ -210,7 +210,8 @@ function runTest(testNum) {
"context-saveimage", true,
"context-sendimage", true,
"context-setDesktopBackground", true,
"context-blockimage", true]);
"context-blockimage", true,
"context-viewimageinfo", true]);
closeContextMenu();
openContextMenuFor(canvas); // Invoke context menu for next test.
break;
@ -242,7 +243,7 @@ function runTest(testNum) {
break;
case 9:
// Context menu for a video (with a INVALID media source)
// Context menu for a video (with an INVALID media source)
checkContextMenu(["context-media-play", false,
"context-media-mute", false,
"context-media-showcontrols", false,
@ -258,7 +259,7 @@ function runTest(testNum) {
break;
case 10:
// Context menu for a video (with a INVALID media source)
// Context menu for a video (with an INVALID media source)
checkContextMenu(["context-media-play", false,
"context-media-mute", false,
"context-media-showcontrols", false,

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

@ -265,6 +265,8 @@
<!ENTITY reloadImageCmd.accesskey "R">
<!ENTITY viewImageCmd.label "View Image">
<!ENTITY viewImageCmd.accesskey "I">
<!ENTITY viewImageInfoCmd.label "View Image Info">
<!ENTITY viewImageInfoCmd.accesskey "f">
<!ENTITY viewVideoCmd.label "View Video">
<!ENTITY viewVideoCmd.accesskey "I">
<!ENTITY viewBGImageCmd.label "View Background Image">

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

@ -238,6 +238,7 @@ user_pref("dom.allow_scripts_to_close_windows", true);
user_pref("dom.disable_open_during_load", false);
user_pref("dom.max_script_run_time", 0); // no slow script dialogs
user_pref("dom.max_chrome_script_run_time", 0);
user_pref("dom.popup_maximum", -1);
user_pref("signed.applets.codebase_principal_support", true);
user_pref("security.warn_submit_insecure", false);
user_pref("browser.shell.checkDefaultBrowser", false);

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

@ -105,7 +105,7 @@ def checkForCrashes(dumpDir, symbolsPath, testName=None):
dumps = glob.glob(os.path.join(dumpDir, '*.dmp'))
for d in dumps:
log.info("TEST-UNEXPECTED-FAIL | %s | application crashed (minidump found)", testName)
if symbolsPath and stackwalkPath:
if symbolsPath and stackwalkPath and os.path.exists(stackwalkPath):
nullfd = open(os.devnull, 'w')
# eat minidump_stackwalk errors
subprocess.call([stackwalkPath, d, symbolsPath], stderr=nullfd)
@ -115,6 +115,9 @@ def checkForCrashes(dumpDir, symbolsPath, testName=None):
print "No symbols path given, can't process dump."
if not stackwalkPath:
print "MINIDUMP_STACKWALK not set, can't process dump."
else:
if not os.path.exists(stackwalkPath):
print "MINIDUMP_STACKWALK binary not found: %s" % stackwalkPath
os.remove(d)
extra = os.path.splitext(d)[0] + ".extra"
if os.path.exists(extra):

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

@ -121,7 +121,7 @@ GLIB_VERSION=1.2.0
LIBIDL_VERSION=0.6.3
PERL_VERSION=5.006
PYTHON_VERSION=2.4
CAIRO_VERSION=1.6.0
CAIRO_VERSION=1.8.8
PANGO_VERSION=1.14.0
GTK2_VERSION=2.10.0
WINDRES_VERSION=2.14.90
@ -133,7 +133,7 @@ LIBGNOME_VERSION=2.0
GIO_VERSION=2.0
STARTUP_NOTIFICATION_VERSION=0.8
DBUS_VERSION=0.60
SQLITE_VERSION=3.6.18
SQLITE_VERSION=3.6.16
LIBNOTIFY_VERSION=0.4
MSMANIFEST_TOOL=

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

@ -43,12 +43,10 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
MODULE = content
PARALLEL_DIRS = base canvas html xml xul xbl xslt
PARALLEL_DIRS = base canvas events html smil xml xul xbl xslt
ifdef MOZ_MEDIA
PARALLEL_DIRS += \
media \
$(NULL)
PARALLEL_DIRS += media
endif
ifdef MOZ_SVG
@ -59,16 +57,10 @@ ifdef MOZ_XTF
PARALLEL_DIRS += xtf
endif
ifdef MOZ_SMIL
PARALLEL_DIRS += smil
endif
ifdef MOZ_MATHML
PARALLEL_DIRS += mathml
endif
PARALLEL_DIRS += events
ifdef ENABLE_TESTS
TOOL_DIRS += test
endif
@ -83,4 +75,3 @@ endif
endif # WINNT
include $(topsrcdir)/config/rules.mk

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

@ -84,13 +84,16 @@ interface nsIFrameLoader : nsISupports
[noscript] void updatePositionAndSize(in nsIFrame aIFrame);
};
[scriptable, uuid(641c2d90-4ada-4367-bdb1-80831614161d)]
native alreadyAddRefed_nsFrameLoader(already_AddRefed<nsFrameLoader>);
[scriptable, uuid(8f3b12a0-35ae-4e0d-9152-8e0d7e49d446)]
interface nsIFrameLoaderOwner : nsISupports
{
/**
* The frame loader owned by this nsIFrameLoaderOwner
*/
readonly attribute nsIFrameLoader frameLoader;
[noscript, notxpcom] alreadyAddRefed_nsFrameLoader GetFrameLoader();
/**
* Swap frame loaders with the given nsIFrameLoaderOwner. This may

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

@ -2974,13 +2974,16 @@ nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
if (aNotify) {
nsIDocument* doc = GetCurrentDoc();
NS_ABORT_IF_FALSE(doc, "Shouldn't be able to animate style on a node "
"unless it's in a document...");
nsPresShellIterator iter(doc);
nsCOMPtr<nsIPresShell> shell;
while (shell = iter.GetNextShell()) {
nsPresContext* presContext = shell->GetPresContext();
presContext->SMILOverrideStyleChanged(this);
// Only need to notify PresContexts if we're in a document. (We might not
// be in a document, if we're clearing animation effects on a target node
// that's been detached since the previous animation sample.)
if (doc) {
nsPresShellIterator iter(doc);
nsCOMPtr<nsIPresShell> shell;
while (shell = iter.GetNextShell()) {
nsPresContext* presContext = shell->GetPresContext();
presContext->SMILOverrideStyleChanged(this);
}
}
}

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

@ -326,6 +326,7 @@ GK_ATOM(dragleave, "dragleave")
GK_ATOM(dragover, "dragover")
GK_ATOM(dragSession, "dragSession")
GK_ATOM(dragstart, "dragstart")
GK_ATOM(drawintitlebar, "drawintitlebar")
GK_ATOM(drop, "drop")
GK_ATOM(dropAfter, "dropAfter")
GK_ATOM(dropBefore, "dropBefore")

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

@ -687,6 +687,14 @@ nsObjectLoadingContent::GetFrameLoader(nsIFrameLoader** aFrameLoader)
return NS_OK;
}
NS_IMETHODIMP_(already_AddRefed<nsFrameLoader>)
nsObjectLoadingContent::GetFrameLoader()
{
nsFrameLoader* loader = mFrameLoader;
NS_IF_ADDREF(loader);
return loader;
}
NS_IMETHODIMP
nsObjectLoadingContent::SwapFrameLoaders(nsIFrameLoaderOwner* aOtherLoader)
{

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

@ -321,6 +321,8 @@ _TEST_FILES = test_bug5141.html \
test_classList.html \
test_bug514487.html \
test_range_bounds.html \
test_bug475156.html \
bug475156.sjs \
$(NULL)
# Disabled; see bug 492181

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

@ -0,0 +1,27 @@
function handleRequest(request, response)
{
if (request.queryString == "")
{
var etag = request.hasHeader("If-Match") ? request.getHeader("If-Match") : null;
if (!etag || etag == getState("etag"))
{
response.setStatusLine(request.httpVersion, 200, "Ok");
response.setHeader("Content-Type", "text/html");
response.setHeader("ETag", getState("etag"));
response.setHeader("Cache-control", "max-age=36000");
response.write(getState("etag"));
}
else if (etag)
{
response.setStatusLine(request.httpVersion, 412, "Precondition Failed");
}
}
else
{
var etag = request.queryString.match(/^etag=(.*)$/);
if (etag)
setState("etag", etag[1]);
response.setStatusLine(request.httpVersion, 204, "No content");
}
}

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

@ -0,0 +1,288 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=475156
-->
<head>
<title>Test for Bug 475156</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body onload="drive(tests.shift());">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
var path = "http://localhost:8888/tests/content/base/test/";
function fromCache(xhr)
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var ch = xhr.channel.QueryInterface(Components.interfaces.nsICachingChannel);
return ch.isFromCache();
}
var tests = [
// First just init the file with an ETag
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs?etag=a1");
},
loading: function(xhr)
{
},
done: function(xhr)
{
},
},
// Try to load the file the first time regularly, we have to get 200 OK
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
},
loading: function(xhr)
{
is(fromCache(xhr), false, "Not coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We get a fresh version of the file");
is(xhr.getResponseHeader("Etag"), "a1", "We got correct ETag");
is(xhr.responseText, "a1", "We got the expected file body");
},
},
// Try to load the file the second time regularly, we have to get 304 Not Modified
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a1");
},
loading: function(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a1", "We got correct ETag");
is(xhr.responseText, "a1", "We got the expected file body");
},
},
// Try to load the file the third time regularly, we have to get 304 Not Modified
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a1");
},
loading: function(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a1", "We got correct ETag");
is(xhr.responseText, "a1", "We got the expected file body");
},
},
// Now modify the ETag
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs?etag=a2");
},
loading: function(xhr)
{
},
done: function(xhr)
{
},
},
// Try to load the file, we have to get 200 OK with the new content
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a2");
},
loading: function(xhr)
{
is(fromCache(xhr), false, "Not coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We get a fresh version of the file");
is(xhr.getResponseHeader("Etag"), "a2", "We got correct ETag");
is(xhr.responseText, "a2", "We got the expected file body");
},
},
// Try to load the file the second time regularly, we have to get 304 Not Modified
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a2");
},
loading: function(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a2", "We got correct ETag");
is(xhr.responseText, "a2", "We got the expected file body");
},
},
// Try to load the file the third time regularly, we have to get 304 Not Modified
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a2");
},
loading: function(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a2", "We got correct ETag");
is(xhr.responseText, "a2", "We got the expected file body");
},
},
// Now modify the ETag ones more
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs?etag=a3");
},
loading: function(xhr)
{
},
done: function(xhr)
{
},
},
// Try to load the file, we have to get 200 OK with the new content
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a3");
},
loading: function(xhr)
{
is(fromCache(xhr), false, "Not coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We get a fresh version of the file");
is(xhr.getResponseHeader("Etag"), "a3", "We got correct ETag");
is(xhr.responseText, "a3", "We got the expected file body");
},
},
// Try to load the file the second time regularly, we have to get 304 Not Modified
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a3");
},
loading: function(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a3", "We got correct ETag");
is(xhr.responseText, "a3", "We got the expected file body");
},
},
// Try to load the file the third time regularly, we have to get 304 Not Modified
{
init: function(xhr)
{
xhr.open("GET", path + "bug475156.sjs");
xhr.setRequestHeader("If-Match", "a3");
},
loading: function(xhr)
{
is(fromCache(xhr), true, "Coming from the cache");
},
done: function(xhr)
{
is(xhr.status, 200, "We got cached version");
is(xhr.getResponseHeader("Etag"), "a3", "We got correct ETag");
is(xhr.responseText, "a3", "We got the expected file body");
},
},
]
function drive(test)
{
var xhr = new XMLHttpRequest();
test.init(xhr);
xhr.onreadystatechange = function() {
if (this.readyState == 3) {
test.loading(this);
}
if (this.readyState == 4) {
test.done(this);
if (tests.length == 0)
SimpleTest.finish();
else
drive(tests.shift());
}
}
xhr.send();
}
</script>
</pre>
</body>
</html>

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

@ -42,8 +42,8 @@
#include "nsIDOMBeforeUnloadEvent.h"
#include "nsDOMEvent.h"
class nsDOMBeforeUnloadEvent : public nsIDOMBeforeUnloadEvent,
public nsDOMEvent
class nsDOMBeforeUnloadEvent : public nsDOMEvent,
public nsIDOMBeforeUnloadEvent
{
public:
nsDOMBeforeUnloadEvent(nsPresContext* aPresContext, nsEvent* aEvent)

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

@ -100,21 +100,6 @@ nsDOMDragEvent::InitDragEvent(const nsAString & aType,
return NS_OK;
}
NS_IMETHODIMP
nsDOMDragEvent::InitDragEventNS(const nsAString & aNamespaceURIArg,
const nsAString & aType,
PRBool aCanBubble, PRBool aCancelable,
nsIDOMAbstractView* aView, PRInt32 aDetail,
PRInt32 aScreenX, PRInt32 aScreenY,
PRInt32 aClientX, PRInt32 aClientY,
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
PRBool aMetaKey, PRUint16 aButton,
nsIDOMEventTarget *aRelatedTarget,
nsIDOMDataTransfer* aDataTransfer)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsDOMDragEvent::GetDataTransfer(nsIDOMDataTransfer** aDataTransfer)
{

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

@ -45,8 +45,8 @@
class nsIContent;
class nsEvent;
class nsDOMDragEvent : public nsIDOMDragEvent,
public nsDOMMouseEvent
class nsDOMDragEvent : public nsDOMMouseEvent,
public nsIDOMDragEvent
{
public:
nsDOMDragEvent(nsPresContext* aPresContext, nsInputEvent* aEvent);

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

@ -42,8 +42,8 @@
#include "nsIDOMKeyEvent.h"
#include "nsDOMUIEvent.h"
class nsDOMKeyboardEvent : public nsIDOMKeyEvent,
public nsDOMUIEvent
class nsDOMKeyboardEvent : public nsDOMUIEvent,
public nsIDOMKeyEvent
{
public:
nsDOMKeyboardEvent(nsPresContext* aPresContext, nsKeyEvent* aEvent);

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

@ -105,19 +105,6 @@ nsDOMMessageEvent::InitMessageEvent(const nsAString& aType,
return NS_OK;
}
NS_IMETHODIMP
nsDOMMessageEvent::InitMessageEventNS(const nsAString& aNamespaceURI,
const nsAString& aType,
PRBool aCanBubble,
PRBool aCancelable,
const nsAString& aData,
const nsAString& aOrigin,
const nsAString& aLastEventId,
nsIDOMWindow* aSource)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
nsresult
NS_NewDOMMessageEvent(nsIDOMEvent** aInstancePtrResult,
nsPresContext* aPresContext,

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

@ -50,8 +50,8 @@
* See http://www.whatwg.org/specs/web-apps/current-work/#messageevent for
* further details.
*/
class nsDOMMessageEvent : public nsIDOMMessageEvent,
public nsDOMEvent
class nsDOMMessageEvent : public nsDOMEvent,
public nsIDOMMessageEvent
{
public:
nsDOMMessageEvent(nsPresContext* aPresContext, nsEvent* aEvent)

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

@ -41,8 +41,8 @@
#include "nsIDOMMouseScrollEvent.h"
#include "nsDOMMouseEvent.h"
class nsDOMMouseScrollEvent : public nsIDOMMouseScrollEvent,
public nsDOMMouseEvent
class nsDOMMouseScrollEvent : public nsDOMMouseEvent,
public nsIDOMMouseScrollEvent
{
public:
nsDOMMouseScrollEvent(nsPresContext* aPresContext, nsInputEvent* aEvent);

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

@ -44,8 +44,8 @@
#include "nsDOMEvent.h"
#include "nsContentUtils.h"
class nsDOMMutationEvent : public nsIDOMMutationEvent,
public nsDOMEvent
class nsDOMMutationEvent : public nsDOMEvent,
public nsIDOMMutationEvent
{
public:
nsDOMMutationEvent(nsPresContext* aPresContext, nsMutationEvent* aEvent);

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

@ -45,8 +45,8 @@
class nsPaintRequestList;
class nsDOMNotifyPaintEvent : public nsIDOMNotifyPaintEvent,
public nsDOMEvent
class nsDOMNotifyPaintEvent : public nsDOMEvent,
public nsIDOMNotifyPaintEvent
{
public:
nsDOMNotifyPaintEvent(nsPresContext* aPresContext,

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

@ -40,7 +40,8 @@
#include "nsIDOMOrientationEvent.h"
#include "nsDOMEvent.h"
class nsDOMOrientationEvent : public nsIDOMOrientationEvent, public nsDOMEvent
class nsDOMOrientationEvent : public nsDOMEvent,
public nsIDOMOrientationEvent
{
public:

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

@ -42,8 +42,8 @@
#include "nsIDOMPageTransitionEvent.h"
#include "nsDOMEvent.h"
class nsDOMPageTransitionEvent : public nsIDOMPageTransitionEvent,
public nsDOMEvent
class nsDOMPageTransitionEvent : public nsDOMEvent,
public nsIDOMPageTransitionEvent
{
public:
nsDOMPageTransitionEvent(nsPresContext* aPresContext, nsEvent* aEvent) :

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

@ -43,8 +43,8 @@
#include "nsDOMEvent.h"
#include "nsIURI.h"
class nsDOMPopupBlockedEvent : public nsIDOMPopupBlockedEvent,
public nsDOMEvent
class nsDOMPopupBlockedEvent : public nsDOMEvent,
public nsIDOMPopupBlockedEvent
{
public:

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

@ -49,8 +49,8 @@
* See http://www.whatwg.org/specs/web-apps/current-work/#progress0 for
* further details.
*/
class nsDOMProgressEvent : public nsIDOMProgressEvent,
public nsDOMEvent
class nsDOMProgressEvent : public nsDOMEvent,
public nsIDOMProgressEvent
{
public:
nsDOMProgressEvent(nsPresContext* aPresContext, nsEvent* aEvent)

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

@ -42,8 +42,8 @@
class nsPresContext;
class nsDOMSimpleGestureEvent : public nsIDOMSimpleGestureEvent,
public nsDOMMouseEvent
class nsDOMSimpleGestureEvent : public nsDOMMouseEvent,
public nsIDOMSimpleGestureEvent
{
public:
nsDOMSimpleGestureEvent(nsPresContext*, nsSimpleGestureEvent*);

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

@ -45,10 +45,10 @@
#include "nsIPrivateCompositionEvent.h"
#include "nsDOMEvent.h"
class nsDOMUIEvent : public nsIDOMUIEvent,
class nsDOMUIEvent : public nsDOMEvent,
public nsIDOMUIEvent,
public nsIDOMNSUIEvent,
public nsIPrivateCompositionEvent,
public nsDOMEvent
public nsIPrivateCompositionEvent
{
public:
nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent);

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

@ -2787,6 +2787,14 @@ nsGenericHTMLFrameElement::GetFrameLoader(nsIFrameLoader **aFrameLoader)
return NS_OK;
}
NS_IMETHODIMP_(already_AddRefed<nsFrameLoader>)
nsGenericHTMLFrameElement::GetFrameLoader()
{
nsFrameLoader* loader = mFrameLoader;
NS_IF_ADDREF(loader);
return loader;
}
NS_IMETHODIMP
nsGenericHTMLFrameElement::SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner)
{

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

@ -930,7 +930,7 @@ protected:
nsresult LoadSrc();
nsresult GetContentDocument(nsIDOMDocument** aContentDocument);
nsCOMPtr<nsIFrameLoader> mFrameLoader;
nsRefPtr<nsFrameLoader> mFrameLoader;
};
//----------------------------------------------------------------------

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

@ -246,12 +246,28 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLDocument, nsDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mEmbeds)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLinks)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAnchors)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFragmentParser)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mForms, nsIDOMNodeList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mFormControls,
nsIDOMNodeList)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mWyciwygChannel)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMidasCommandManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFragmentParser)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLDocument, nsDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mImageMaps)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mImages)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mApplets)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mEmbeds)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mLinks)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAnchors)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mForms)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFormControls)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mWyciwygChannel)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mMidasCommandManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFragmentParser)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_ADDREF_INHERITED(nsHTMLDocument, nsDocument)
NS_IMPL_RELEASE_INHERITED(nsHTMLDocument, nsDocument)

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

@ -210,7 +210,7 @@ public:
void EndUpdate(nsUpdateType aUpdateType);
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsHTMLDocument, nsDocument)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLDocument, nsDocument)
virtual already_AddRefed<nsIParser> GetFragmentParser() {
return mFragmentParser.forget();

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

@ -80,6 +80,7 @@ _TEST_FILES = \
seek7.js \
seek8.js \
seek9.js \
seek10.js \
test_audio1.html \
test_audio2.html \
test_autobuffer.html \

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

@ -0,0 +1,30 @@
function test_seek10(v, seekTime, is, ok, finish) {
// Test bug 523335 - ensure that if we close a stream while seeking, we
// don't hang during shutdown. This test won't "fail" per se if it's regressed,
// it will instead start to cause random hangs in the mochitest harness on
// shutdown.
function startTest() {
// Must be duration*0.9 rather than seekTime, else we don't hit that problem.
// This is probably due to the seek bisection finishing too quickly, before
// we can close the stream.
v.currentTime = v.duration * 0.9;
}
function done(evt) {
evt.stopPropagation();
ok(true, "We don't acutally test anything...");
finish();
}
function seeking() {
v.onerror = done;
v.src = "not a valid video file.";
v.load(); // Cause the existing stream to close.
}
v.addEventListener("loadeddata", startTest, false);
v.addEventListener("seeking", seeking, false);
}

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

@ -15,6 +15,7 @@
<script type="text/javascript" src="seek7.js"></script>
<script type="text/javascript" src="seek8.js"></script>
<script type="text/javascript" src="seek9.js"></script>
<script type="text/javascript" src="seek10.js"></script>
</head>
<body>
<pre id="test">
@ -38,7 +39,7 @@ function doNextFile() {
return;
}
for (var i = 1; i <= 9; ++i) {
for (var i = 1; i <= 10; ++i) {
var v = document.createElement('video');
v.src = test.name;
document.body.appendChild(v);

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

@ -47,7 +47,13 @@ LIBRARY_NAME = gkconsmil_s
LIBXUL_LIBRARY = 1
CPPSRCS = \
# nsSMILKeySpline is used by CSS transitions -- need to build it regardless
# of whether SMIL is enabled.
CPPSRCS = nsSMILKeySpline.cpp
EXPORTS = nsSMILKeySpline.h
ifdef MOZ_SMIL
CPPSRCS += \
nsSMILAnimationController.cpp \
nsSMILAnimationFunction.cpp \
nsSMILCompositor.cpp \
@ -55,7 +61,6 @@ CPPSRCS = \
nsSMILCSSValueType.cpp \
nsSMILFloatType.cpp \
nsSMILInstanceTime.cpp \
nsSMILKeySpline.cpp \
nsSMILNullType.cpp \
nsSMILParserUtils.cpp \
nsSMILRepeatCount.cpp \
@ -66,17 +71,19 @@ CPPSRCS = \
nsSMILTimeValueSpec.cpp \
nsSMILValue.cpp \
$(NULL)
endif
include $(topsrcdir)/config/config.mk
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
ifdef MOZ_SMIL
ifdef ENABLE_TESTS
TOOL_DIRS += test
endif
endif # ENABLE_TESTS
EXPORTS = \
EXPORTS += \
nsISMILAnimationElement.h \
nsISMILAttr.h \
nsSMILAnimationController.h \
@ -86,11 +93,12 @@ EXPORTS = \
nsSMILTypes.h \
$(NULL)
include $(topsrcdir)/config/rules.mk
INCLUDES += \
-I$(srcdir)/../base/src \
-I$(srcdir)/../../layout/style \
$(NULL)
endif # MOZ_SMIL
include $(topsrcdir)/config/rules.mk
DEFINES += -D_IMPL_NS_LAYOUT

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

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg"
class="reftest-wait"
onload="setTimeout(removeNode, 0)">
<script>
function removeNode() {
var node = document.getElementById("myRect");
node.parentNode.removeChild(node);
document.documentElement.removeAttribute("class");
}
</script>
<rect id="myRect" x="20" y="20" height="50" width="50" stroke="blue">
<animate attributeName="stroke-width" from="1" to="9" begin="0s" dur="2s"/>
</rect>
</svg>

После

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

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

@ -0,0 +1 @@
load 523188-1.svg

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

@ -84,6 +84,9 @@ public:
/**
* Clears the animated value of this attribute.
*
* NOTE: The animation target is not guaranteed to be in a document when this
* method is called. (See bug 523188)
*/
virtual void ClearAnimValue() = 0;

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

@ -365,10 +365,10 @@ nsSMILAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
const nsSMILTime& dur = mSimpleDuration.GetMillis();
// Sanity Checks
NS_ASSERTION(mSampleTime >= 0.0f, "Sample time should not be negative...");
NS_ASSERTION(dur >= 0.0f, "Simple duration should not be negative...");
NS_ABORT_IF_FALSE(mSampleTime >= 0.0f, "Sample time should not be negative");
NS_ABORT_IF_FALSE(dur >= 0.0f, "Simple duration should not be negative");
if (mSampleTime >= dur || mSampleTime < 0) {
if (mSampleTime >= dur || mSampleTime < 0.0f) {
NS_ERROR("Animation sampled outside interval.");
return NS_ERROR_FAILURE;
}

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

@ -263,9 +263,9 @@ protected:
void UnsetKeySplines();
// Helpers
nsresult InterpolateResult(const nsSMILValueArray& aValues,
nsSMILValue& aResult,
nsSMILValue& aBaseValue);
virtual nsresult InterpolateResult(const nsSMILValueArray& aValues,
nsSMILValue& aResult,
nsSMILValue& aBaseValue);
nsresult AccumulateResult(const nsSMILValueArray& aValues,
nsSMILValue& aResult);

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

@ -232,19 +232,19 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
return PR_TRUE;
// PROPERTIES OF TYPE eCSSType_Value
// XXXdholbert: Many properties' types aren't yet supported by
// nsStyleAnimation (due to using enumerated values, float values, URI
// values). I'm commenting those properties out here for the time being,
// so that we don't try to animate them yet.
// case eCSSProperty_clip_rule:
// XXXdholbert: Some properties' types aren't yet supported by
// nsStyleAnimation (due to using URI values or string values). I'm
// commenting those properties out here for the time being, so that we
// don't try to animate them yet.
case eCSSProperty_clip_rule:
// case eCSSProperty_clip_path:
case eCSSProperty_color:
// case eCSSProperty_color_interpolation:
// case eCSSProperty_color_interpolation_filters:
// case eCSSProperty_display:
// case eCSSProperty_dominant_baseline:
case eCSSProperty_color_interpolation:
case eCSSProperty_color_interpolation_filters:
case eCSSProperty_display:
case eCSSProperty_dominant_baseline:
case eCSSProperty_fill_opacity:
// case eCSSProperty_fill_rule:
case eCSSProperty_fill_rule:
// case eCSSProperty_filter:
case eCSSProperty_flood_color:
case eCSSProperty_flood_opacity:
@ -252,10 +252,10 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
case eCSSProperty_font_size:
case eCSSProperty_font_size_adjust:
// case eCSSProperty_font_stretch:
// case eCSSProperty_font_style:
// case eCSSProperty_font_variant:
case eCSSProperty_font_style:
case eCSSProperty_font_variant:
// case eCSSProperty_font_weight:
// case eCSSProperty_image_rendering:
case eCSSProperty_image_rendering:
case eCSSProperty_letter_spacing:
case eCSSProperty_lighting_color:
// case eCSSProperty_marker_end:
@ -263,20 +263,20 @@ nsSMILCSSProperty::IsPropertyAnimatable(nsCSSProperty aPropID)
// case eCSSProperty_marker_start:
// case eCSSProperty_mask:
case eCSSProperty_opacity:
// case eCSSProperty_pointer_events:
// case eCSSProperty_shape_rendering:
case eCSSProperty_pointer_events:
case eCSSProperty_shape_rendering:
case eCSSProperty_stop_color:
case eCSSProperty_stop_opacity:
case eCSSProperty_stroke_dashoffset:
// case eCSSProperty_stroke_linecap:
// case eCSSProperty_stroke_linejoin:
case eCSSProperty_stroke_linecap:
case eCSSProperty_stroke_linejoin:
case eCSSProperty_stroke_miterlimit:
case eCSSProperty_stroke_opacity:
case eCSSProperty_stroke_width:
// case eCSSProperty_text_anchor:
// case eCSSProperty_text_decoration:
// case eCSSProperty_text_rendering:
// case eCSSProperty_visibility:
case eCSSProperty_text_anchor:
case eCSSProperty_text_decoration:
case eCSSProperty_text_rendering:
case eCSSProperty_visibility:
case eCSSProperty_word_spacing:
return PR_TRUE;

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

@ -97,10 +97,30 @@ nsSMILSetAnimationFunction::UnsetAttr(nsIAtom* aAttribute)
return nsSMILAnimationFunction::UnsetAttr(aAttribute);
}
nsSMILAnimationFunction::nsSMILCalcMode
nsSMILSetAnimationFunction::GetCalcMode() const
nsresult
nsSMILSetAnimationFunction::InterpolateResult(const nsSMILValueArray& aValues,
nsSMILValue& aResult,
nsSMILValue& aBaseValue)
{
return CALC_DISCRETE;
// Sanity Checks
const nsSMILTime& dur = mSimpleDuration.GetMillis();
NS_ABORT_IF_FALSE(mSampleTime >= 0.0f, "Sample time should not be negative");
NS_ABORT_IF_FALSE(dur >= 0.0f, "Simple duration should not be negative");
NS_ABORT_IF_FALSE(IsToAnimation(), "Set element only supports to-animation");
if (mSampleTime >= dur || mSampleTime < 0) {
NS_ERROR("Animation sampled outside interval.");
return NS_ERROR_FAILURE;
}
if (aValues.Length() != 1) {
NS_ERROR("Unexpected number of values.");
return NS_ERROR_FAILURE;
}
// End Sanity Checks
// Always use the 'to' value (which should be first & only elem in |aValues|)
aResult = aValues[0];
return NS_OK;
}
PRBool

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

@ -74,7 +74,9 @@ public:
virtual PRBool UnsetAttr(nsIAtom* aAttribute);
protected:
virtual nsSMILAnimationFunction::nsSMILCalcMode GetCalcMode() const;
NS_OVERRIDE virtual nsresult
InterpolateResult(const nsSMILValueArray& aValues,
nsSMILValue& aResult, nsSMILValue& aBaseValue);
virtual PRBool HasAttr(nsIAtom* aAttName) const;
virtual const nsAttrValue* GetAttr(nsIAtom* aAttName) const;

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

@ -63,14 +63,29 @@ var _fromByTestLists =
new AnimTestcaseFromBy("1.2", "-0.6", { midComp: "0.9", toComp: "0.6"},
"opacities with abs val >1 get clamped too early"),
],
paint: [
// The "none" keyword & URI values aren't addiditve, so the animations in
// these testcases are expected to have no effect.
// XXXdholbert Of course, we don't support animation between URI values yet
// (bug 520487), so the testcases that use URIs currently have no effect
// for that reason, too.
new AnimTestcaseFromBy("none", "none", { noEffect: 1 }),
new AnimTestcaseFromBy("url(#gradA)", "url(#gradB)", { noEffect: 1 }),
new AnimTestcaseFromBy("url(#gradA)", "url(#gradB) red", { noEffect: 1 }),
new AnimTestcaseFromBy("url(#gradA)", "none", { noEffect: 1 }),
new AnimTestcaseFromBy("red", "url(#gradA)", { noEffect: 1 }),
]
};
// List of attribute/testcase-list bundles to be tested
var gFromByBundles =
[
new TestcaseBundle(gPropList.fill, _fromByTestLists.color),
new TestcaseBundle(gPropList.fill, [].concat(_fromByTestLists.color,
_fromByTestLists.paint)),
new TestcaseBundle(gPropList.font_size, _fromByTestLists.lengthPx),
new TestcaseBundle(gPropList.font_size_adjust, [
// These testcases implicitly have no effect, because font-size-adjust is
// non-additive (and is declared as such in db_smilCSSPropertyList.js)
new AnimTestcaseFromBy("0.5", "0.1"),
new AnimTestcaseFromBy("none", "0.1"),
new AnimTestcaseFromBy("0.1", "none")

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

@ -77,6 +77,7 @@ var _fromToTestLists = {
midComp: "rgb(230, 230, 230)" }),
],
paintServer: [
new AnimTestcaseFromTo("none", "none"),
new AnimTestcaseFromTo("none", "blue", { toComp : "rgb(0, 0, 255)" }),
new AnimTestcaseFromTo("rgb(50, 50, 50)", "none"),
new AnimTestcaseFromTo("url(#gradA)", "url(#gradB) currentColor",
@ -162,7 +163,7 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.clip_rule, [
new AnimTestcaseFromTo("nonzero", "evenodd"),
new AnimTestcaseFromTo("evenodd", "inherit", { toComp: "nonzero" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.color,
[].concat(_fromToTestLists.color, [
// Note: inherited value is rgb(50, 50, 50) (set on <svg>)
@ -174,12 +175,12 @@ var gFromToBundles = [
new AnimTestcaseFromTo("sRGB", "auto", { fromComp: "srgb" }),
new AnimTestcaseFromTo("inherit", "linearRGB",
{ fromComp: "srgb", toComp: "linearrgb" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.color_interpolation_filters, [
new AnimTestcaseFromTo("sRGB", "auto", { fromComp: "srgb" }),
new AnimTestcaseFromTo("auto", "inherit",
{ toComp: "linearrgb" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.cursor, [
new AnimTestcaseFromTo("crosshair", "move"),
new AnimTestcaseFromTo("url('a.cur'), url('b.cur'), nw-resize", "sw-resize",
@ -196,15 +197,19 @@ var gFromToBundles = [
// my test runs with "display: none" on everything, and so the
// inherited value isn't always the same. (i.e. the computed value
// of 'inherit' will be different in different tests)
new AnimTestcaseFromTo("block", "table-cell", {}),
new AnimTestcaseFromTo("inline", "inline-table", {}),
new AnimTestcaseFromTo("table-row", "none", {}),
], "need support for enumerated values"),
new AnimTestcaseFromTo("block", "table-cell"),
new AnimTestcaseFromTo("inline", "inline-table"),
new AnimTestcaseFromTo("table-row", "none"),
]),
new TestcaseBundle(gPropList.dominant_baseline, [
new AnimTestcaseFromTo("use-script", "no-change"),
new AnimTestcaseFromTo("reset-size", "ideographic"),
new AnimTestcaseFromTo("text-after-edge", "text-before-edge"),
], "need support for enumerated values"),
new AnimTestcaseFromTo("alphabetic", "hanging"),
new AnimTestcaseFromTo("mathematical", "central"),
new AnimTestcaseFromTo("middle", "text-after-edge"),
new AnimTestcaseFromTo("text-before-edge", "auto"),
new AnimTestcaseFromTo("use-script", "inherit", { toComp: "auto" } ),
]),
// NOTE: Mozilla doesn't currently support "enable-background", but I'm
// testing it here in case we ever add support for it, because it's
// explicitly not animatable in the SVG spec.
@ -219,7 +224,7 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.fill_rule, [
new AnimTestcaseFromTo("nonzero", "evenodd"),
new AnimTestcaseFromTo("evenodd", "inherit", { toComp: "nonzero" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.filter, _fromToTestLists.URIsAndNone),
new TestcaseBundle(gPropList.flood_color,
[].concat(_fromToTestLists.color,
@ -273,12 +278,15 @@ var gFromToBundles = [
new AnimTestcaseFromTo("ultra-expanded", "inherit", { toComp: "normal" }),
], "need support for all properties that get stored in nsFont"),
new TestcaseBundle(gPropList.font_style, [
new AnimTestcaseFromTo("italic", "inherit", { toComp: "normal" }),
new AnimTestcaseFromTo("normal", "italic"),
new AnimTestcaseFromTo("italic", "oblique"),
], "need support for all properties that get stored in nsFont"),
new AnimTestcaseFromTo("oblique", "normal"),
]),
new TestcaseBundle(gPropList.font_variant, [
new AnimTestcaseFromTo("inherit", "small-caps", { fromComp: "normal" }),
], "need support for all properties that get stored in nsFont"),
new AnimTestcaseFromTo("small-caps", "normal"),
]),
new TestcaseBundle(gPropList.font_weight, [
new AnimTestcaseFromTo("100", "900"),
new AnimTestcaseFromTo("700", "100",
@ -304,7 +312,7 @@ var gFromToBundles = [
new AnimTestcaseFromTo("optimizeQuality", "optimizeSpeed",
{ fromComp: "optimizequality",
toComp: "optimizespeed" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.letter_spacing,
[].concat(_fromToTestLists.lengthPx,
_fromToTestLists.lengthPxPctSVG)),
@ -330,14 +338,14 @@ var gFromToBundles = [
{ fromComp: "visiblefill" }),
new AnimTestcaseFromTo("none", "visibleStroke",
{ toComp: "visiblestroke" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.shape_rendering, [
new AnimTestcaseFromTo("auto", "optimizeSpeed",
{ toComp: "optimizespeed" }),
new AnimTestcaseFromTo("crispEdges", "geometricPrecision",
{ fromComp: "crispedges",
toComp: "geometricprecision" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.stop_color,
[].concat(_fromToTestLists.color,
_fromToTestLists.colorFromInheritBlack)),
@ -364,11 +372,11 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.stroke_linecap, [
new AnimTestcaseFromTo("butt", "round"),
new AnimTestcaseFromTo("round", "square"),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.stroke_linejoin, [
new AnimTestcaseFromTo("miter", "round"),
new AnimTestcaseFromTo("round", "bevel"),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.stroke_miterlimit, [
new AnimTestcaseFromTo("1", "2", { midComp: "1.5" }),
new AnimTestcaseFromTo("20.1", "10.1", { midComp: "15.1" }),
@ -384,12 +392,12 @@ var gFromToBundles = [
new TestcaseBundle(gPropList.text_anchor, [
new AnimTestcaseFromTo("start", "middle"),
new AnimTestcaseFromTo("middle", "end"),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.text_decoration, [
new AnimTestcaseFromTo("none", "underline"),
new AnimTestcaseFromTo("overline", "line-through"),
new AnimTestcaseFromTo("blink", "underline"),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.text_rendering, [
new AnimTestcaseFromTo("auto", "optimizeSpeed",
{ toComp: "optimizespeed" }),
@ -399,14 +407,14 @@ var gFromToBundles = [
new AnimTestcaseFromTo("geometricPrecision", "optimizeLegibility",
{ fromComp: "geometricprecision",
toComp: "optimizelegibility" }),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.unicode_bidi, [
new AnimTestcaseFromTo("embed", "bidi-override"),
]),
new TestcaseBundle(gPropList.visibility, [
new AnimTestcaseFromTo("visible", "hidden"),
new AnimTestcaseFromTo("hidden", "collapse"),
], "need support for enumerated values"),
]),
new TestcaseBundle(gPropList.word_spacing,
[].concat(_fromToTestLists.lengthPx,
_fromToTestLists.lengthPxPctSVG)),

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

@ -198,6 +198,22 @@ var gPacedBundles =
}),
])
),
new TestcaseBundle(gPropList.font_size_adjust, [
new AnimTestcasePaced("0.2; 0.6; 0.8",
{ comp0: "0.2",
comp1_6: "0.3",
comp1_3: "0.4",
comp2_3: "0.6",
comp1: "0.8"
}),
new AnimTestcasePaced("none; none; 0.5",
{ comp0: "none",
comp1_6: "none",
comp1_3: "none",
comp2_3: "0.5",
comp1: "0.5"
}),
]),
new TestcaseBundle(gPropList.font_family, [
// Sanity check: 'font-family' isn't interpolatable. It should end up
// ignoring the calcMode="paced" and falling into discrete-mode.

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

@ -497,6 +497,10 @@ extend(AnimTestcaseFromTo, AnimTestcaseFrom);
* - midComp: Computed value that we expect to visit halfway through the
* animation (|aFrom| + |aBy|/2)
* - toComp: Computed value of the animation endpoint (|aFrom| + |aBy|)
* - noEffect: Special flag -- if set, indicates that this testcase is
* expected to have no effect on the computed value. (i.e. the
* attribute may be animatable and additive, but the particular
* "from" & "by" values that are used don't support addition.)
* @param aSkipReason If this test-case is known to currently fail, this
* parameter should be a string explaining why.
* Otherwise, this value should be null (or omitted).
@ -507,7 +511,8 @@ function AnimTestcaseFromBy(aFrom, aBy, aComputedValMap, aSkipReason)
this.by = aBy;
this.computedValMap = aComputedValMap;
this.skipReason = aSkipReason;
if (this.computedValMap && !this.computedValMap.toComp) {
if (this.computedValMap &&
!this.computedValMap.noEffect && !this.computedValMap.toComp) {
ok(false, "AnimTestcaseFromBy needs expected computed final value");
}
}
@ -527,7 +532,7 @@ AnimTestcaseFromBy.prototype =
},
buildSeekList : function(aAnimAttr, aBaseVal, aTimeData, aIsFreeze)
{
if (!aAnimAttr.isAdditive) {
if (!aAnimAttr.isAdditive || this.computedValMap.noEffect) {
return this.buildSeekListStatic(aAnimAttr, aBaseVal, aTimeData,
"defined as non-additive in SVG spec");
}

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

@ -41,8 +41,8 @@
#include "nsIDOMSVGEvent.h"
#include "nsDOMEvent.h"
class nsDOMSVGEvent : public nsIDOMSVGEvent,
public nsDOMEvent
class nsDOMSVGEvent : public nsDOMEvent,
public nsIDOMSVGEvent
{
public:
nsDOMSVGEvent(nsPresContext* aPresContext, nsEvent* aEvent);

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

@ -105,14 +105,13 @@ nsDOMSVGZoomEvent::nsDOMSVGZoomEvent(nsPresContext* aPresContext,
//----------------------------------------------------------------------
// nsISupports methods:
NS_IMPL_ADDREF_INHERITED(nsDOMSVGZoomEvent, nsDOMEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMSVGZoomEvent, nsDOMEvent)
NS_IMPL_ADDREF_INHERITED(nsDOMSVGZoomEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMSVGZoomEvent, nsDOMUIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMSVGZoomEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGZoomEvent)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMUIEvent,nsIDOMSVGZoomEvent)
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(SVGZoomEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
//----------------------------------------------------------------------

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

@ -42,8 +42,8 @@
#include "nsDOMUIEvent.h"
#include "nsIDOMSVGSVGElement.h"
class nsDOMSVGZoomEvent : public nsIDOMSVGZoomEvent,
public nsDOMUIEvent
class nsDOMSVGZoomEvent : public nsDOMUIEvent,
public nsIDOMSVGZoomEvent
{
public:
nsDOMSVGZoomEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent);

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

@ -2867,10 +2867,15 @@ nsSVGFETileElement::Filter(nsSVGFilterInstance *instance,
NS_ENSURE_SUCCESS(res, res); // asserts on failure (not
if (tile.IsEmpty())
return NS_OK;
NS_ENSURE_TRUE(instance->GetSurfaceRect().Contains(tile), NS_ERROR_UNEXPECTED);
const nsIntRect &surfaceRect = instance->GetSurfaceRect();
if (!tile.Intersects(surfaceRect)) {
// nothing to draw
return NS_OK;
}
// Get it into surface space
tile -= instance->GetSurfaceRect().TopLeft();
tile -= surfaceRect.TopLeft();
PRUint8* sourceData = aSources[0]->mImage->Data();
PRUint8* targetData = aTarget->mImage->Data();
@ -2882,10 +2887,14 @@ nsSVGFETileElement::Filter(nsSVGFilterInstance *instance,
nsIntPoint offset(-tile.x + tile.width, -tile.y + tile.height);
for (PRInt32 y = rect.y; y < rect.YMost(); y++) {
PRUint32 tileY = tile.y + WrapInterval(y + offset.y, tile.height);
for (PRInt32 x = rect.x; x < rect.XMost(); x++) {
PRUint32 tileX = tile.x + WrapInterval(x + offset.x, tile.width);
*(PRUint32*)(targetData + y * stride + 4 * x) =
*(PRUint32*)(sourceData + tileY * stride + 4 * tileX);
if (tileY < surfaceRect.height) {
for (PRInt32 x = rect.x; x < rect.XMost(); x++) {
PRUint32 tileX = tile.x + WrapInterval(x + offset.x, tile.width);
if (tileX < surfaceRect.width) {
*(PRUint32*)(targetData + y * stride + 4 * x) =
*(PRUint32*)(sourceData + tileY * stride + 4 * tileX);
}
}
}
}

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

@ -1097,44 +1097,41 @@ nsXULElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
if (aName == nsGkAtoms::hidechrome &&
mNodeInfo->Equals(nsGkAtoms::window) &&
aValue) {
HideWindowChrome(aValue && NS_LITERAL_STRING("true").Equals(*aValue));
HideWindowChrome(aValue->EqualsLiteral("true"));
}
// title, (in)activetitlebarcolor and drawintitlebar are settable on
// any root node (windows, dialogs, etc)
nsIDocument *document = GetCurrentDoc();
if (aName == nsGkAtoms::title &&
document && document->GetRootContent() == this) {
document->NotifyPossibleTitleChange(PR_FALSE);
}
// (in)activetitlebarcolor is settable on any root node (windows, dialogs, etc)
if ((aName == nsGkAtoms::activetitlebarcolor ||
aName == nsGkAtoms::inactivetitlebarcolor) &&
document && document->GetRootContent() == this) {
nscolor color = NS_RGBA(0, 0, 0, 0);
nsAttrValue attrValue;
attrValue.ParseColor(*aValue, document);
attrValue.GetColorValue(color);
SetTitlebarColor(color, aName == nsGkAtoms::activetitlebarcolor);
}
// if the localedir changed on the root element, reset the document direction
if (aName == nsGkAtoms::localedir &&
document && document->GetRootContent() == this) {
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(document);
if (xuldoc) {
xuldoc->ResetDocumentDirection();
if (document && document->GetRootContent() == this) {
if (aName == nsGkAtoms::title) {
document->NotifyPossibleTitleChange(PR_FALSE);
}
}
// if the lwtheme changed, make sure to reset the document lwtheme cache
if ((aName == nsGkAtoms::lwtheme ||
aName == nsGkAtoms::lwthemetextcolor) &&
document && document->GetRootContent() == this) {
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(document);
if (xuldoc) {
xuldoc->ResetDocumentLWTheme();
else if ((aName == nsGkAtoms::activetitlebarcolor ||
aName == nsGkAtoms::inactivetitlebarcolor)) {
nscolor color = NS_RGBA(0, 0, 0, 0);
nsAttrValue attrValue;
attrValue.ParseColor(*aValue, document);
attrValue.GetColorValue(color);
SetTitlebarColor(color, aName == nsGkAtoms::activetitlebarcolor);
}
else if (aName == nsGkAtoms::drawintitlebar) {
SetDrawsInTitlebar(aValue && aValue->EqualsLiteral("true"));
}
else if (aName == nsGkAtoms::localedir) {
// if the localedir changed on the root element, reset the document direction
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(document);
if (xuldoc) {
xuldoc->ResetDocumentDirection();
}
}
else if (aName == nsGkAtoms::lwtheme ||
aName == nsGkAtoms::lwthemetextcolor) {
// if the lwtheme changed, make sure to reset the document lwtheme cache
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(document);
if (xuldoc) {
xuldoc->ResetDocumentLWTheme();
}
}
}
@ -1377,29 +1374,29 @@ nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify)
HideWindowChrome(PR_FALSE);
}
if ((aName == nsGkAtoms::activetitlebarcolor ||
aName == nsGkAtoms::inactivetitlebarcolor) &&
doc && doc->GetRootContent() == this) {
// Use 0, 0, 0, 0 as the "none" color.
SetTitlebarColor(NS_RGBA(0, 0, 0, 0), aName == nsGkAtoms::activetitlebarcolor);
}
// if the localedir changed on the root element, reset the document direction
if (aName == nsGkAtoms::localedir &&
doc && doc->GetRootContent() == this) {
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(doc);
if (xuldoc) {
xuldoc->ResetDocumentDirection();
if (doc && doc->GetRootContent() == this) {
if ((aName == nsGkAtoms::activetitlebarcolor ||
aName == nsGkAtoms::inactivetitlebarcolor)) {
// Use 0, 0, 0, 0 as the "none" color.
SetTitlebarColor(NS_RGBA(0, 0, 0, 0), aName == nsGkAtoms::activetitlebarcolor);
}
}
// if the lwtheme changed, make sure to restyle appropriately
if ((aName == nsGkAtoms::lwtheme ||
aName == nsGkAtoms::lwthemetextcolor) &&
doc && doc->GetRootContent() == this) {
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(doc);
if (xuldoc) {
xuldoc->ResetDocumentLWTheme();
else if (aName == nsGkAtoms::localedir) {
// if the localedir changed on the root element, reset the document direction
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(doc);
if (xuldoc) {
xuldoc->ResetDocumentDirection();
}
}
else if ((aName == nsGkAtoms::lwtheme ||
aName == nsGkAtoms::lwthemetextcolor)) {
// if the lwtheme changed, make sure to restyle appropriately
nsCOMPtr<nsIXULDocument> xuldoc = do_QueryInterface(doc);
if (xuldoc) {
xuldoc->ResetDocumentLWTheme();
}
}
else if (aName == nsGkAtoms::drawintitlebar) {
SetDrawsInTitlebar(PR_FALSE);
}
}
@ -2032,14 +2029,22 @@ nsXULElement::LoadSrc()
nsresult
nsXULElement::GetFrameLoader(nsIFrameLoader **aFrameLoader)
{
*aFrameLoader = nsnull;
nsXULSlots* slots = static_cast<nsXULSlots*>(GetExistingSlots());
if (slots) {
NS_IF_ADDREF(*aFrameLoader = slots->mFrameLoader);
}
*aFrameLoader = GetFrameLoader().get();
return NS_OK;
}
already_AddRefed<nsFrameLoader>
nsXULElement::GetFrameLoader()
{
nsXULSlots* slots = static_cast<nsXULSlots*>(GetExistingSlots());
if (!slots)
return nsnull;
nsFrameLoader* loader = slots->mFrameLoader;
NS_IF_ADDREF(loader);
return loader;
}
nsresult
nsXULElement::SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner)
{
@ -2398,13 +2403,10 @@ nsXULElement::HideWindowChrome(PRBool aShouldHide)
return NS_OK;
}
void
nsXULElement::SetTitlebarColor(nscolor aColor, PRBool aActive)
nsIWidget*
nsXULElement::GetWindowWidget()
{
nsIDocument* doc = GetCurrentDoc();
if (!doc || doc->GetRootContent() != this) {
return;
}
// only top level chrome documents can set the titlebar color
if (doc->IsRootDisplayDocument()) {
@ -2413,11 +2415,28 @@ nsXULElement::SetTitlebarColor(nscolor aColor, PRBool aActive)
if (baseWindow) {
nsCOMPtr<nsIWidget> mainWidget;
baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
if (mainWidget) {
mainWidget->SetWindowTitlebarColor(aColor, aActive);
}
return mainWidget;
}
}
return nsnull;
}
void
nsXULElement::SetTitlebarColor(nscolor aColor, PRBool aActive)
{
nsIWidget* mainWidget = GetWindowWidget();
if (mainWidget) {
mainWidget->SetWindowTitlebarColor(aColor, aActive);
}
}
void
nsXULElement::SetDrawsInTitlebar(PRBool aState)
{
nsIWidget* mainWidget = GetWindowWidget();
if (mainWidget) {
mainWidget->SetDrawsInTitlebar(aState);
}
}
PRBool

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

@ -581,6 +581,7 @@ public:
nsresult GetStyle(nsIDOMCSSStyleDeclaration** aStyle);
nsresult GetFrameLoader(nsIFrameLoader** aFrameLoader);
already_AddRefed<nsFrameLoader> GetFrameLoader();
nsresult SwapFrameLoaders(nsIFrameLoaderOwner* aOtherOwner);
virtual void RecompileScriptEventListeners();
@ -682,11 +683,14 @@ protected:
PRBool aCompileEventHandlers);
void MaybeAddPopupListener(nsIAtom* aLocalName);
nsIWidget* GetWindowWidget();
nsresult HideWindowChrome(PRBool aShouldHide);
void SetTitlebarColor(nscolor aColor, PRBool aActive);
void SetDrawsInTitlebar(PRBool aState);
const nsAttrName* InternalGetExistingAttrNameFromQName(const nsAString& aStr) const;
void RemoveBroadcaster(const nsAString & broadcasterId);

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

@ -1,6 +1,6 @@
This is SQLite 3.6.18.
This is sqlite 3.6.16
-- Shawn Wilsher <me@shawnwilsher.com>, 10/2009
-- Shawn Wilsher <me@shawnwilsher.com>, 8/2009
See http://www.sqlite.org/ for more info.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -3431,7 +3431,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGZoomEvent, nsIDOMSVGZoomEvent)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGZoomEvent)
DOM_CLASSINFO_EVENT_MAP_ENTRIES
DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
#endif // MOZ_SVG

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

@ -41,7 +41,7 @@
interface nsIDOMAbstractView;
interface nsIDOMDataTransfer;
[scriptable, uuid(D52CF140-FB90-44DF-8D69-4B2BAB4D461F)]
[scriptable, uuid(98351627-62d7-4b07-bbf3-78009b20764b)]
interface nsIDOMDragEvent : nsIDOMMouseEvent
{
readonly attribute nsIDOMDataTransfer dataTransfer;
@ -62,22 +62,4 @@ interface nsIDOMDragEvent : nsIDOMMouseEvent
in unsigned short aButton,
in nsIDOMEventTarget aRelatedTarget,
in nsIDOMDataTransfer aDataTransfer);
void initDragEventNS(in DOMString namespaceURIArg,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in nsIDOMAbstractView aView,
in long aDetail,
in long aScreenX,
in long aScreenY,
in long aClientX,
in long aClientY,
in boolean aCtrlKey,
in boolean aAltKey,
in boolean aShiftKey,
in boolean aMetaKey,
in unsigned short aButton,
in nsIDOMEventTarget aRelatedTarget,
in nsIDOMDataTransfer aDataTransfer);
};

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

@ -45,7 +45,7 @@
* For more information on this interface, please see
* http://www.whatwg.org/specs/web-apps/current-work/#messageevent
*/
[scriptable, uuid(98150805-6A15-4667-815A-1A8C87CB4BBC)]
[scriptable, uuid(d02e9a24-e5b2-47e4-bd80-7e980bf56b45)]
interface nsIDOMMessageEvent : nsIDOMEvent
{
/**
@ -84,18 +84,4 @@ interface nsIDOMMessageEvent : nsIDOMEvent
in DOMString aOrigin,
in DOMString aLastEventId,
in nsIDOMWindow aSource);
/**
* Initializes this event with the given data, in a manner analogous to
* the similarly-named method on the Event interface, also setting the data,
* origin, source, and lastEventId attributes of this appropriately.
*/
void initMessageEventNS(in DOMString aNamespaceURI,
in DOMString aType,
in boolean aCanBubble,
in boolean aCancelable,
in DOMString aData,
in DOMString aOrigin,
in DOMString aLastEventId,
in nsIDOMWindow aSource);
};

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

@ -46,7 +46,7 @@
* Event sent to a window when a storage area changes.
*/
[scriptable, uuid(FC540C28-8EDD-4B7A-9C30-8638289B7A7D)]
[scriptable, uuid(8c021c75-f6b6-493c-914e-0b6c57ccc88d)]
interface nsIDOMStorageEvent : nsIDOMEvent
{
/**
@ -62,13 +62,4 @@ interface nsIDOMStorageEvent : nsIDOMEvent
in boolean canBubbleArg,
in boolean cancelableArg,
in DOMString domainArg);
/**
* Initialize a storage event.
*/
void initStorageEventNS(in DOMString namespaceURIArg,
in DOMString typeArg,
in boolean canBubbleArg,
in boolean cancelableArg,
in DOMString domainArg);
};

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

@ -152,44 +152,60 @@ IsCallerSecure()
return NS_SUCCEEDED(rv) && isHttps;
}
// Returns two quotas - A hard limit for which adding data will be an error,
// and a limit after which a warning event will be sent to the observer
// service. The warn limit may be -1, in which case there will be no warning.
static void
GetQuota(const nsACString &aDomain, PRInt32 *aQuota, PRInt32 *aWarnQuota)
PRUint32
GetOfflinePermission(const nsACString &aDomain)
{
// Fake a URI for the permission manager
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + aDomain);
PRUint32 perm;
if (uri) {
nsCOMPtr<nsIPermissionManager> permissionManager =
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
PRUint32 perm;
if (permissionManager &&
NS_SUCCEEDED(permissionManager->TestPermission(uri, "offline-app", &perm)) &&
perm != nsIPermissionManager::UNKNOWN_ACTION &&
perm != nsIPermissionManager::DENY_ACTION) {
// This is an offline app, give more space by default.
*aQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppQuota,
DEFAULT_OFFLINE_APP_QUOTA) * 1024);
NS_SUCCEEDED(permissionManager->TestPermission(uri, "offline-app", &perm)))
return perm;
}
if (perm == nsIOfflineCacheUpdateService::ALLOW_NO_WARN) {
*aWarnQuota = -1;
} else {
*aWarnQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppWarnQuota,
DEFAULT_OFFLINE_WARN_QUOTA) * 1024);
}
return;
return nsIPermissionManager::UNKNOWN_ACTION;
}
PRBool
IsOfflineAllowed(const nsACString &aDomain)
{
PRInt32 perm = GetOfflinePermission(aDomain);
return IS_PERMISSION_ALLOWED(perm);
}
// Returns two quotas - A hard limit for which adding data will be an error,
// and a limit after which a warning event will be sent to the observer
// service. The warn limit may be -1, in which case there will be no warning.
static PRUint32
GetQuota(const nsACString &aDomain, PRInt32 *aQuota, PRInt32 *aWarnQuota)
{
PRUint32 perm = GetOfflinePermission(aDomain);
if (IS_PERMISSION_ALLOWED(perm)) {
// This is an offline app, give more space by default.
*aQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppQuota,
DEFAULT_OFFLINE_APP_QUOTA) * 1024);
if (perm == nsIOfflineCacheUpdateService::ALLOW_NO_WARN) {
*aWarnQuota = -1;
} else {
*aWarnQuota = ((PRInt32)nsContentUtils::GetIntPref(kOfflineAppWarnQuota,
DEFAULT_OFFLINE_WARN_QUOTA) * 1024);
}
return perm;
}
// FIXME: per-domain quotas?
*aQuota = ((PRInt32)nsContentUtils::GetIntPref(kDefaultQuota,
DEFAULT_QUOTA) * 1024);
*aWarnQuota = -1;
return perm;
}
nsSessionStorageEntry::nsSessionStorageEntry(KeyTypePointer aStr)
@ -639,7 +655,10 @@ nsDOMStorage::InitAsLocalStorage(nsIPrincipal *aPrincipal)
// in that case because it produces broken entries w/o owner.
mUseDB = !mScopeDBKey.IsEmpty();
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(mDomain, PR_TRUE, mQuotaDomainDBKey);
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(mDomain,
PR_TRUE, PR_FALSE, mQuotaDomainDBKey);
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(mDomain,
PR_TRUE, PR_TRUE, mQuotaETLDplus1DomainDBKey);
#endif
mLocalStorage = PR_TRUE;
@ -660,7 +679,10 @@ nsDOMStorage::InitAsGlobalStorage(const nsACString &aDomainDemanded)
if (!(mUseDB = !mScopeDBKey.IsEmpty()))
mScopeDBKey.AppendLiteral(":");
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomainDemanded, PR_TRUE, mQuotaDomainDBKey);
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomainDemanded,
PR_TRUE, PR_FALSE, mQuotaDomainDBKey);
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomainDemanded,
PR_TRUE, PR_TRUE, mQuotaETLDplus1DomainDBKey);
#endif
return NS_OK;
}
@ -1034,7 +1056,7 @@ NS_IMETHODIMP nsDOMStorage::RemoveItem(const nsAString& aKey)
return NS_OK;
NS_ENSURE_SUCCESS(rv, rv);
rv = gStorageDB->RemoveKey(this, aKey,
rv = gStorageDB->RemoveKey(this, aKey, !IsOfflineAllowed(mDomain),
aKey.Length() + value.Length());
NS_ENSURE_SUCCESS(rv, rv);
@ -1195,44 +1217,15 @@ nsDOMStorage::SetDBValue(const nsAString& aKey,
nsresult rv = InitDB();
NS_ENSURE_SUCCESS(rv, rv);
// Get the current domain for quota enforcement
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
if (!ssm)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIPrincipal> subjectPrincipal;
ssm->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
nsCAutoString currentDomain;
if (subjectPrincipal) {
nsCOMPtr<nsIURI> unused;
rv = GetPrincipalURIAndHost(subjectPrincipal, getter_AddRefs(unused),
currentDomain);
// Don't bail out on NS_ERROR_DOM_SECURITY_ERR, since we want to allow
// trusted file:// URIs below.
if (NS_FAILED(rv) && rv != NS_ERROR_DOM_SECURITY_ERR) {
return rv;
}
if (currentDomain.IsEmpty()) {
// allow chrome urls and trusted file urls to write using
// the storage's domain
if (nsContentUtils::IsCallerTrustedForWrite())
currentDomain = mDomain;
else
return NS_ERROR_DOM_SECURITY_ERR;
}
} else {
currentDomain = mDomain;
}
PRInt32 offlineAppPermission;
PRInt32 quota;
PRInt32 warnQuota;
GetQuota(currentDomain, &quota, &warnQuota);
offlineAppPermission = GetQuota(mDomain, &quota, &warnQuota);
PRInt32 usage;
rv = gStorageDB->SetKey(this, aKey, aValue, aSecure, quota, &usage);
rv = gStorageDB->SetKey(this, aKey, aValue, aSecure, quota,
!IS_PERMISSION_ALLOWED(offlineAppPermission),
&usage);
NS_ENSURE_SUCCESS(rv, rv);
mItemsCached = PR_FALSE;
@ -1254,7 +1247,7 @@ nsDOMStorage::SetDBValue(const nsAString& aKey,
nsCOMPtr<nsIObserverService> os =
do_GetService("@mozilla.org/observer-service;1");
os->NotifyObservers(window, "dom-storage-warn-quota-exceeded",
NS_ConvertUTF8toUTF16(currentDomain).get());
NS_ConvertUTF8toUTF16(mDomain).get());
}
BroadcastChangeNotification();
@ -1886,18 +1879,3 @@ nsDOMStorageEvent::InitStorageEvent(const nsAString& aTypeArg,
return NS_OK;
}
NS_IMETHODIMP
nsDOMStorageEvent::InitStorageEventNS(const nsAString& aNamespaceURIArg,
const nsAString& aTypeArg,
PRBool aCanBubbleArg,
PRBool aCancelableArg,
const nsAString& aDomainArg)
{
// XXXjst: Figure out what to do with aNamespaceURIArg here!
nsresult rv = InitEvent(aTypeArg, aCanBubbleArg, aCancelableArg);
NS_ENSURE_SUCCESS(rv, rv);
mDomain = aDomainArg;
return NS_OK;
}

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

@ -47,6 +47,7 @@
#include "nsIDOMStorage.h"
#include "nsIDOMStorageList.h"
#include "nsIDOMStorageItem.h"
#include "nsIPermissionManager.h"
#include "nsInterfaceHashtable.h"
#include "nsVoidArray.h"
#include "nsTArray.h"
@ -61,6 +62,10 @@
#include "nsDOMStorageDBWrapper.h"
#endif
#define IS_PERMISSION_ALLOWED(perm) \
((perm) != nsIPermissionManager::UNKNOWN_ACTION && \
(perm) != nsIPermissionManager::DENY_ACTION)
class nsDOMStorage;
class nsIDOMStorage;
class nsDOMStorageItem;
@ -245,6 +250,7 @@ protected:
// keys are used for database queries.
// see comments of the getters bellow.
nsCString mScopeDBKey;
nsCString mQuotaETLDplus1DomainDBKey;
nsCString mQuotaDomainDBKey;
friend class nsIDOMStorage2;
@ -257,8 +263,11 @@ public:
nsCString& GetScopeDBKey() {return mScopeDBKey;}
// e.g. "moc.rab.%" - reversed eTLD+1 subpart of the domain or
// (in future) reversed offline application allowed domain.
nsCString& GetQuotaDomainDBKey() {return mQuotaDomainDBKey;}
// reversed offline application allowed domain.
nsCString& GetQuotaDomainDBKey(PRBool aOfflineAllowed)
{
return aOfflineAllowed ? mQuotaDomainDBKey : mQuotaETLDplus1DomainDBKey;
}
#ifdef MOZ_STORAGE
static nsDOMStorageDBWrapper* gStorageDB;
@ -447,4 +456,10 @@ NS_NewDOMStorage2(nsISupports* aOuter, REFNSIID aIID, void** aResult);
nsresult
NS_NewDOMStorageList(nsIDOMStorageList** aResult);
PRUint32
GetOfflinePermission(const nsACString &aDomain);
PRBool
IsOfflineAllowed(const nsACString &aDomain);
#endif /* nsDOMStorage_h___ */

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

@ -118,17 +118,18 @@ nsDOMStorageDBWrapper::SetKey(nsDOMStorage* aStorage,
const nsAString& aValue,
PRBool aSecure,
PRInt32 aQuota,
PRBool aExcludeOfflineFromUsage,
PRInt32 *aNewUsage)
{
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
return mPrivateBrowsingDB.SetKey(aStorage, aKey, aValue, aSecure,
aQuota, aNewUsage);
aQuota, aExcludeOfflineFromUsage, aNewUsage);
if (aStorage->SessionOnly())
return mSessionOnlyDB.SetKey(aStorage, aKey, aValue, aSecure,
aQuota, aNewUsage);
aQuota, aExcludeOfflineFromUsage, aNewUsage);
return mPersistentDB.SetKey(aStorage, aKey, aValue, aSecure,
aQuota, aNewUsage);
aQuota, aExcludeOfflineFromUsage, aNewUsage);
}
nsresult
@ -147,14 +148,15 @@ nsDOMStorageDBWrapper::SetSecure(nsDOMStorage* aStorage,
nsresult
nsDOMStorageDBWrapper::RemoveKey(nsDOMStorage* aStorage,
const nsAString& aKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 aKeyUsage)
{
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
return mPrivateBrowsingDB.RemoveKey(aStorage, aKey, aKeyUsage);
return mPrivateBrowsingDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
if (aStorage->SessionOnly())
return mSessionOnlyDB.RemoveKey(aStorage, aKey, aKeyUsage);
return mSessionOnlyDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
return mPersistentDB.RemoveKey(aStorage, aKey, aKeyUsage);
return mPersistentDB.RemoveKey(aStorage, aKey, aExcludeOfflineFromUsage, aKeyUsage);
}
nsresult
@ -244,14 +246,15 @@ nsDOMStorageDBWrapper::RemoveAll()
}
nsresult
nsDOMStorageDBWrapper::GetUsage(nsDOMStorage* aStorage, PRInt32 *aUsage)
nsDOMStorageDBWrapper::GetUsage(nsDOMStorage* aStorage,
PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage)
{
if (nsDOMStorageManager::gStorageManager->InPrivateBrowsingMode())
return mPrivateBrowsingDB.GetUsage(aStorage, aUsage);
return mPrivateBrowsingDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
if (aStorage->SessionOnly())
return mSessionOnlyDB.GetUsage(aStorage, aUsage);
return mSessionOnlyDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
return mPersistentDB.GetUsage(aStorage, aUsage);
return mPersistentDB.GetUsage(aStorage, aExcludeOfflineFromUsage, aUsage);
}
nsresult
@ -329,29 +332,34 @@ nsDOMStorageDBWrapper::CreateDomainScopeDBKey(const nsACString& aAsciiDomain,
nsresult
nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(const nsACString& aAsciiDomain,
PRBool aIncludeSubDomains,
PRBool aEffectiveTLDplus1Only,
nsACString& aKey)
{
nsresult rv;
nsCOMPtr<nsIEffectiveTLDService> eTLDService(do_GetService(
NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + aAsciiDomain);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString eTLDplusOne;
rv = eTLDService->GetBaseDomain(uri, 0, eTLDplusOne);
if (NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS == rv) {
// XXX bug 357323 - what to do for localhost/file exactly?
eTLDplusOne = aAsciiDomain;
rv = NS_OK;
}
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString subdomainsDBKey;
CreateDomainScopeDBKey(eTLDplusOne, subdomainsDBKey);
if (aEffectiveTLDplus1Only) {
nsCOMPtr<nsIEffectiveTLDService> eTLDService(do_GetService(
NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIURI> uri;
rv = NS_NewURI(getter_AddRefs(uri), NS_LITERAL_CSTRING("http://") + aAsciiDomain);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString eTLDplusOne;
rv = eTLDService->GetBaseDomain(uri, 0, eTLDplusOne);
if (NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS == rv) {
// XXX bug 357323 - what to do for localhost/file exactly?
eTLDplusOne = aAsciiDomain;
rv = NS_OK;
}
NS_ENSURE_SUCCESS(rv, rv);
CreateDomainScopeDBKey(eTLDplusOne, subdomainsDBKey);
}
else
CreateDomainScopeDBKey(aAsciiDomain, subdomainsDBKey);
if (!aIncludeSubDomains)
subdomainsDBKey.AppendLiteral(":");
@ -359,3 +367,15 @@ nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(const nsACString& aAsciiDomain,
aKey.Assign(subdomainsDBKey);
return NS_OK;
}
nsresult
nsDOMStorageDBWrapper::GetDomainFromScopeKey(const nsACString& aScope,
nsACString& aDomain)
{
nsCAutoString reverseDomain, scope;
scope = aScope;
scope.Left(reverseDomain, scope.FindChar(':')-1);
ReverseString(reverseDomain, aDomain);
return NS_OK;
}

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

@ -119,6 +119,7 @@ public:
const nsAString& aValue,
PRBool aSecure,
PRInt32 aQuota,
PRBool aExcludeOfflineFromUsage,
PRInt32* aNewUsage);
/**
@ -136,6 +137,7 @@ public:
nsresult
RemoveKey(nsDOMStorage* aStorage,
const nsAString& aKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 aKeyUsage);
/**
@ -180,7 +182,7 @@ public:
* Returns usage for a storage using its GetQuotaDomainDBKey() as a key.
*/
nsresult
GetUsage(nsDOMStorage* aStorage, PRInt32 *aUsage);
GetUsage(nsDOMStorage* aStorage, PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage);
/**
* Returns usage of the domain and optionaly by any subdomain.
@ -208,7 +210,11 @@ public:
* and appends a dot.
*/
static nsresult CreateQuotaDomainDBKey(const nsACString& aAsciiDomain,
PRBool aIncludeSubDomains, nsACString& aKey);
PRBool aIncludeSubDomains, PRBool aETLDplus1Only,
nsACString& aKey);
static nsresult GetDomainFromScopeKey(const nsACString& aScope,
nsACString& aDomain);
protected:
nsDOMStoragePersistentDB mPersistentDB;

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

@ -188,6 +188,7 @@ nsDOMStorageMemoryDB::SetKey(nsDOMStorage* aStorage,
const nsAString& aValue,
PRBool aSecure,
PRInt32 aQuota,
PRBool aExcludeOfflineFromUsage,
PRInt32 *aNewUsage)
{
nsresult rv;
@ -197,8 +198,8 @@ nsDOMStorageMemoryDB::SetKey(nsDOMStorage* aStorage,
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 usage = 0;
if (!aStorage->GetQuotaDomainDBKey().IsEmpty()) {
rv = GetUsage(aStorage, &usage);
if (!aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage).IsEmpty()) {
rv = GetUsage(aStorage, aExcludeOfflineFromUsage, &usage);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -258,6 +259,7 @@ nsDOMStorageMemoryDB::SetSecure(nsDOMStorage* aStorage,
nsresult
nsDOMStorageMemoryDB::RemoveKey(nsDOMStorage* aStorage,
const nsAString& aKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 aKeyUsage)
{
nsresult rv;
@ -385,9 +387,11 @@ nsDOMStorageMemoryDB::RemoveAll()
}
nsresult
nsDOMStorageMemoryDB::GetUsage(nsDOMStorage* aStorage, PRInt32 *aUsage)
nsDOMStorageMemoryDB::GetUsage(nsDOMStorage* aStorage,
PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage)
{
return GetUsageInternal(aStorage->GetQuotaDomainDBKey(), aUsage);
return GetUsageInternal(aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage),
aExcludeOfflineFromUsage, aUsage);
}
nsresult
@ -400,15 +404,17 @@ nsDOMStorageMemoryDB::GetUsage(const nsACString& aDomain,
nsCAutoString quotadomainDBKey;
rv = nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomain,
aIncludeSubDomains,
PR_FALSE,
quotadomainDBKey);
NS_ENSURE_SUCCESS(rv, rv);
return GetUsageInternal(quotadomainDBKey, aUsage);
return GetUsageInternal(quotadomainDBKey, PR_FALSE, aUsage);
}
struct GetUsageEnumStruc
{
PRInt32 mUsage;
PRInt32 mExcludeOfflineFromUsage;
nsCString mSubdomain;
};
@ -419,24 +425,35 @@ GetUsageEnum(const nsACString& key,
{
GetUsageEnumStruc* struc = (GetUsageEnumStruc*)closure;
if (StringBeginsWith(key, struc->mSubdomain))
if (StringBeginsWith(key, struc->mSubdomain)) {
if (struc->mExcludeOfflineFromUsage) {
nsCAutoString domain;
nsresult rv = nsDOMStorageDBWrapper::GetDomainFromScopeKey(key, domain);
if (NS_SUCCEEDED(rv) && IsOfflineAllowed(domain))
return PL_DHASH_NEXT;
}
struc->mUsage += storageData->mUsageDelta;
}
return PL_DHASH_NEXT;
}
nsresult
nsDOMStorageMemoryDB::GetUsageInternal(const nsACString& aQuotaDomainDBKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 *aUsage)
{
GetUsageEnumStruc struc;
struc.mUsage = 0;
struc.mExcludeOfflineFromUsage = aExcludeOfflineFromUsage;
struc.mSubdomain = aQuotaDomainDBKey;
if (mPreloadDB) {
nsresult rv;
rv = mPreloadDB->GetUsageInternal(aQuotaDomainDBKey, &struc.mUsage);
rv = mPreloadDB->GetUsageInternal(aQuotaDomainDBKey,
aExcludeOfflineFromUsage, &struc.mUsage);
NS_ENSURE_SUCCESS(rv, rv);
}

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

@ -112,6 +112,7 @@ public:
const nsAString& aValue,
PRBool aSecure,
PRInt32 aQuota,
PRBool aExcludeOfflineFromUsage,
PRInt32* aNewUsage);
/**
@ -129,6 +130,7 @@ public:
nsresult
RemoveKey(nsDOMStorage* aStorage,
const nsAString& aKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 aKeyUsage);
/**
@ -167,7 +169,7 @@ public:
* Returns usage for a storage using its GetQuotaDomainDBKey() as a key.
*/
nsresult
GetUsage(nsDOMStorage* aStorage, PRInt32 *aUsage);
GetUsage(nsDOMStorage* aStorage, PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage);
/**
* Returns usage of the domain and optionaly by any subdomain.
@ -182,7 +184,7 @@ protected:
PRBool mPreloading;
nsresult
GetUsageInternal(const nsACString& aQuotaDomainDBKey, PRInt32 *aUsage);
GetUsageInternal(const nsACString& aQuotaDomainDBKey, PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage);
};
#endif

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

@ -86,6 +86,43 @@ nsReverseStringSQLFunction::OnFunctionCall(
return NS_OK;
}
class nsIsOfflineSQLFunction : public mozIStorageFunction
{
NS_DECL_ISUPPORTS
NS_DECL_MOZISTORAGEFUNCTION
};
NS_IMPL_ISUPPORTS1(nsIsOfflineSQLFunction, mozIStorageFunction)
NS_IMETHODIMP
nsIsOfflineSQLFunction::OnFunctionCall(
mozIStorageValueArray *aFunctionArguments, nsIVariant **aResult)
{
nsresult rv;
nsCAutoString scope;
rv = aFunctionArguments->GetUTF8String(0, scope);
NS_ENSURE_SUCCESS(rv, rv);
nsCAutoString domain;
rv = nsDOMStorageDBWrapper::GetDomainFromScopeKey(scope, domain);
NS_ENSURE_SUCCESS(rv, rv);
PRBool hasOfflinePermission = IsOfflineAllowed(domain);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIWritableVariant> outVar(do_CreateInstance(
NS_VARIANT_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
rv = outVar->SetAsBool(hasOfflinePermission);
NS_ENSURE_SUCCESS(rv, rv);
*aResult = outVar.get();
outVar.forget();
return NS_OK;
}
nsresult
nsDOMStoragePersistentDB::Init()
{
@ -126,10 +163,16 @@ nsDOMStoragePersistentDB::Init()
" ON webappsstore2(scope, key)"));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<mozIStorageFunction> function(new nsReverseStringSQLFunction());
NS_ENSURE_TRUE(function, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<mozIStorageFunction> function1(new nsReverseStringSQLFunction());
NS_ENSURE_TRUE(function1, NS_ERROR_OUT_OF_MEMORY);
rv = mConnection->CreateFunction(NS_LITERAL_CSTRING("REVERSESTRING"), 1, function);
rv = mConnection->CreateFunction(NS_LITERAL_CSTRING("REVERSESTRING"), 1, function1);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<mozIStorageFunction> function2(new nsIsOfflineSQLFunction());
NS_ENSURE_TRUE(function2, NS_ERROR_OUT_OF_MEMORY);
rv = mConnection->CreateFunction(NS_LITERAL_CSTRING("ISOFFLINE"), 1, function2);
NS_ENSURE_SUCCESS(rv, rv);
PRBool exists;
@ -244,12 +287,21 @@ nsDOMStoragePersistentDB::Init()
getter_AddRefs(mRemoveAllStatement));
NS_ENSURE_SUCCESS(rv, rv);
// check the usage for a given owner
// check the usage for a given owner that is an offline-app allowed domain
rv = mConnection->CreateStatement(
NS_LITERAL_CSTRING("SELECT SUM(LENGTH(key) + LENGTH(value)) "
"FROM webappsstore2 "
"WHERE scope GLOB ?1"),
getter_AddRefs(mGetUsageStatement));
getter_AddRefs(mGetFullUsageStatement));
NS_ENSURE_SUCCESS(rv, rv);
// check the usage for a given owner that is not an offline-app allowed domain
rv = mConnection->CreateStatement(
NS_LITERAL_CSTRING("SELECT SUM(LENGTH(key) + LENGTH(value)) "
"FROM webappsstore2 "
"WHERE scope GLOB ?1 "
"AND NOT ISOFFLINE(scope)"),
getter_AddRefs(mGetOfflineExcludedUsageStatement));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -330,14 +382,15 @@ nsDOMStoragePersistentDB::SetKey(nsDOMStorage* aStorage,
const nsAString& aValue,
PRBool aSecure,
PRInt32 aQuota,
PRBool aExcludeOfflineFromUsage,
PRInt32 *aNewUsage)
{
mozStorageStatementScoper scope(mGetKeyValueStatement);
PRInt32 usage = 0;
nsresult rv;
if (!aStorage->GetQuotaDomainDBKey().IsEmpty()) {
rv = GetUsage(aStorage, &usage);
if (!aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage).IsEmpty()) {
rv = GetUsage(aStorage, aExcludeOfflineFromUsage, &usage);
NS_ENSURE_SUCCESS(rv, rv);
}
@ -410,8 +463,8 @@ nsDOMStoragePersistentDB::SetKey(nsDOMStorage* aStorage,
NS_ENSURE_SUCCESS(rv, rv);
}
if (!aStorage->GetQuotaDomainDBKey().IsEmpty()) {
mCachedOwner = aStorage->GetQuotaDomainDBKey();
if (!aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage).IsEmpty()) {
mCachedOwner = aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage);
mCachedUsage = usage;
}
@ -442,11 +495,12 @@ nsDOMStoragePersistentDB::SetSecure(nsDOMStorage* aStorage,
nsresult
nsDOMStoragePersistentDB::RemoveKey(nsDOMStorage* aStorage,
const nsAString& aKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 aKeyUsage)
{
mozStorageStatementScoper scope(mRemoveKeyStatement);
if (aStorage->GetQuotaDomainDBKey() == mCachedOwner) {
if (aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage) == mCachedOwner) {
mCachedUsage -= aKeyUsage;
}
@ -567,9 +621,13 @@ nsDOMStoragePersistentDB::RemoveAll()
}
nsresult
nsDOMStoragePersistentDB::GetUsage(nsDOMStorage* aStorage, PRInt32 *aUsage)
nsDOMStoragePersistentDB::GetUsage(nsDOMStorage* aStorage,
PRBool aExcludeOfflineFromUsage,
PRInt32 *aUsage)
{
return GetUsageInternal(aStorage->GetQuotaDomainDBKey(), aUsage);
return GetUsageInternal(aStorage->GetQuotaDomainDBKey(!aExcludeOfflineFromUsage),
aExcludeOfflineFromUsage,
aUsage);
}
nsresult
@ -582,14 +640,16 @@ nsDOMStoragePersistentDB::GetUsage(const nsACString& aDomain,
nsCAutoString quotadomainDBKey;
rv = nsDOMStorageDBWrapper::CreateQuotaDomainDBKey(aDomain,
aIncludeSubDomains,
PR_FALSE,
quotadomainDBKey);
NS_ENSURE_SUCCESS(rv, rv);
return GetUsageInternal(quotadomainDBKey, aUsage);
return GetUsageInternal(quotadomainDBKey, PR_FALSE, aUsage);
}
nsresult
nsDOMStoragePersistentDB::GetUsageInternal(const nsACString& aQuotaDomainDBKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 *aUsage)
{
if (aQuotaDomainDBKey == mCachedOwner) {
@ -597,16 +657,21 @@ nsDOMStoragePersistentDB::GetUsageInternal(const nsACString& aQuotaDomainDBKey,
return NS_OK;
}
mozStorageStatementScoper scope(mGetUsageStatement);
mozIStorageStatement* statement = aExcludeOfflineFromUsage
? mGetOfflineExcludedUsageStatement : mGetFullUsageStatement;
mozStorageStatementScoper scope(statement);
nsresult rv;
rv = mGetUsageStatement->BindUTF8StringParameter(0, aQuotaDomainDBKey +
NS_LITERAL_CSTRING("*"));
nsCAutoString scopeValue(aQuotaDomainDBKey);
scopeValue += NS_LITERAL_CSTRING("*");
rv = statement->BindUTF8StringParameter(0, scopeValue);
NS_ENSURE_SUCCESS(rv, rv);
PRBool exists;
rv = mGetUsageStatement->ExecuteStep(&exists);
rv = statement->ExecuteStep(&exists);
NS_ENSURE_SUCCESS(rv, rv);
if (!exists) {
@ -614,7 +679,7 @@ nsDOMStoragePersistentDB::GetUsageInternal(const nsACString& aQuotaDomainDBKey,
return NS_OK;
}
rv = mGetUsageStatement->GetInt32(0, aUsage);
rv = statement->GetInt32(0, aUsage);
NS_ENSURE_SUCCESS(rv, rv);
if (!aQuotaDomainDBKey.IsEmpty()) {

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

@ -83,6 +83,7 @@ public:
const nsAString& aValue,
PRBool aSecure,
PRInt32 aQuota,
PRBool aExcludeOfflineFromUsage,
PRInt32* aNewUsage);
/**
@ -100,6 +101,7 @@ public:
nsresult
RemoveKey(nsDOMStorage* aStorage,
const nsAString& aKey,
PRBool aExcludeOfflineFromUsage,
PRInt32 aKeyUsage);
/**
@ -131,7 +133,7 @@ public:
* Returns usage for a storage using its GetQuotaDomainDBKey() as a key.
*/
nsresult
GetUsage(nsDOMStorage* aStorage, PRInt32 *aUsage);
GetUsage(nsDOMStorage* aStorage, PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage);
/**
* Returns usage of the domain and optionaly by any subdomain.
@ -157,7 +159,8 @@ protected:
nsCOMPtr<mozIStorageStatement> mRemoveOwnerStatement;
nsCOMPtr<mozIStorageStatement> mRemoveStorageStatement;
nsCOMPtr<mozIStorageStatement> mRemoveAllStatement;
nsCOMPtr<mozIStorageStatement> mGetUsageStatement;
nsCOMPtr<mozIStorageStatement> mGetOfflineExcludedUsageStatement;
nsCOMPtr<mozIStorageStatement> mGetFullUsageStatement;
nsCString mCachedOwner;
PRInt32 mCachedUsage;
@ -165,7 +168,7 @@ protected:
friend class nsDOMStorageDBWrapper;
friend class nsDOMStorageMemoryDB;
nsresult
GetUsageInternal(const nsACString& aQuotaDomainDBKey, PRInt32 *aUsage);
GetUsageInternal(const nsACString& aQuotaDomainDBKey, PRBool aExcludeOfflineFromUsage, PRInt32 *aUsage);
};
#endif /* nsDOMStorageDB_h___ */

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

@ -77,6 +77,7 @@ _TEST_FILES = \
test_localStorageQuota.html \
test_localStorageQuotaPrivateBrowsing.html \
test_localStorageQuotaSessionOnly.html \
test_localStorageQuotaSessionOnly2.html \
test_localStorageKeyOrder.html \
test_removeOwnersAPI.html \
test_removeOwnersAPISessionOnly.html \

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

@ -80,7 +80,7 @@ function doStep()
break;
case "":
default:
switch (operation)
{
case "clear":

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

@ -14,7 +14,28 @@ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var currentTest = 1;
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var quota;
var quota, quotaOffline;
function addOfflineApp(url)
{
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
permissionManager.add(uri, "offline-app",
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
}
function removeOfflineApp(url)
{
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
permissionManager.remove(uri.host, "offline-app");
}
function doNextTest()
{
@ -33,6 +54,12 @@ function doNextTest()
quota = 5*1024;
}
prefs.setIntPref("dom.storage.default_quota", 1);
try {
quotaOffline = prefs.getIntPref("offline-apps.quota.max");
} catch (ex) {
quotaOffline = 200*1024;
}
prefs.setIntPref("offline-apps.quota.max", 2);
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
@ -83,28 +110,90 @@ function doNextTest()
case 8:
// Do a clean up...
// TODO Bug 455070, use just ?clear what invokes call
// of clear() in the target frame. W/o clear method we must
// call clear implemented as removeItem for each item in
// the localStorage.
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear&A&";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
case 9:
// Do a clean up...
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear&B&";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
case 10:
// Do a clean up...
slaveOrigin = "https://test2.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear&C&";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
case 11:
// test1.example.com is now using its own offline app quota
addOfflineApp("http://test1.example.com");
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
break;
case 12:
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
break;
case 13:
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
// Now we have 1503 bytes stored, this exceeds the default storage quota
break;
case 14:
// Now check that upper level domain that is not set as an offline app
// domain is allowed to store data and is using the default quota
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
break;
case 15:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
break;
case 16:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
break;
case 17:
slaveOrigin = "http://test2.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&failure";
break;
case 18:
// check an offline app domain may store some more data
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&success";
break;
case 19:
// check an offline app domain is using its own (larger) quota
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&failure";
break;
case 20:
// Do a clean up...
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
case 21:
// Do a clean up...
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
default: // end
removeOfflineApp("http://test1.example.com");
prefs.setIntPref("dom.storage.default_quota", quota);
prefs.setIntPref("offline-apps.quota.max", quotaOffline);
SimpleTest.finish();
}

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

@ -22,7 +22,28 @@ var cp = Components.classes["@mozilla.org/cookie/permission;1"]
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
var quota;
var quota, quotaOffline;
function addOfflineApp(url)
{
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
permissionManager.add(uri, "offline-app",
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
}
function removeOfflineApp(url)
{
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
permissionManager.remove(uri.host, "offline-app");
}
function doNextTest()
{
@ -41,6 +62,13 @@ function doNextTest()
quota = 5*1024;
}
prefs.setIntPref("dom.storage.default_quota", 1);
try {
quotaOffline = prefs.getIntPref("offline-apps.quota.max");
} catch (ex) {
quotaOffline = 200*1024;
}
prefs.setIntPref("offline-apps.quota.max", 2);
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
@ -91,28 +119,90 @@ function doNextTest()
case 8:
// Do a clean up...
// TODO Bug 455070, use just ?clear what invokes call
// of clear() in the target frame. W/o clear method we must
// call clear implemented as removeItem for each item in
// the localStorage.
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear&A&";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
break;
case 9:
// Do a clean up...
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear&B&";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
break;
case 10:
// Do a clean up...
slaveOrigin = "https://test2.example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear&C&";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
break;
case 11:
// test1.example.com is now using its own offline app quota
addOfflineApp("http://test1.example.com");
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
break;
case 12:
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
break;
case 13:
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
// Now we have 1503 bytes stored, this exceeds the default storage quota
break;
case 14:
// Now check that upper level domain that is not set as an offline app
// domain is allowed to store data and is using the default quota
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
break;
case 15:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
break;
case 16:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
break;
case 17:
slaveOrigin = "http://test2.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&failure";
break;
case 18:
// check an offline app domain may store some more data
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&success";
break;
case 19:
// check an offline app domain is using its own (larger) quota
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&failure";
break;
case 20:
// Do a clean up...
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
case 21:
// Do a clean up...
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
default:
removeOfflineApp("http://test1.example.com");
prefs.setIntPref("dom.storage.default_quota", quota);
prefs.setIntPref("offline-apps.quota.max", quotaOffline);
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
SimpleTest.finish();
}

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

@ -0,0 +1,227 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>localStorage and DOM quota test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="interOriginTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var currentTest = 1;
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var io = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var uri = io.newURI(window.location, "", null);
var cp = Components.classes["@mozilla.org/cookie/permission;1"]
.getService(Components.interfaces.nsICookiePermission);
var quota, quotaOffline;
function addOfflineApp(url)
{
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
permissionManager.add(uri, "offline-app",
Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
}
function removeOfflineApp(url)
{
var permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);
var uri = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService)
.newURI(url, null, null);
permissionManager.remove(uri.host, "offline-app");
}
function doNextTest()
{
slave = frame;
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
switch (currentTest)
{
// Initialy setup the quota to testing value of 1024B and
// set a 500 bytes key with name length 1 (allocate 501 bytes)
case 1:
try {
quota = prefs.getIntPref("dom.storage.default_quota");
} catch (ex) {
quota = 5*1024;
}
prefs.setIntPref("dom.storage.default_quota", 1);
try {
quotaOffline = prefs.getIntPref("offline-apps.quota.max");
} catch (ex) {
quotaOffline = 200*1024;
}
prefs.setIntPref("offline-apps.quota.max", 2);
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&A&success";
break;
// In subdomain now set another key with length 500 bytes, i.e.
// allocate 501 bytes
case 2:
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
break;
// Try to set the same key value again to check we don't fail
// even 1002 bytes has already been exhausted from the quota
// We just change the value of an existing key.
case 3:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&B&success";
break;
// Try to set the same key to a larger value that would lead to
// quota reach and check that the value is still the old one
case 4:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add2&B&failure";
break;
// Try to set a new 500 bytes key
// and check we fail because we are over the quota
case 5:
slaveOrigin = "https://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&failure";
break;
// Remove the key inherited from the non-session-only database
case 6:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?remove&A&success";
break;
// Now try again to set 500 bytes key, it must succeed.
case 7:
slaveOrigin = "https://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?add&C&success";
break;
case 8:
// Do a clean up...
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuotaSessionOnly.html?clear";
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
break;
case 9:
// test1.example.com is now using its own offline app quota
addOfflineApp("http://test1.example.com");
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
break;
case 10:
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
break;
case 11:
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_SESSION);
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&success";
// Now we have 1503 bytes stored, this exceeds the default storage quota
break;
case 12:
// Now check that upper level domain that is not set as an offline app
// domain is allowed to store data and is using the default quota
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&A&success";
break;
case 13:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&B&success";
break;
case 14:
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&C&failure";
break;
case 15:
slaveOrigin = "http://test2.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&failure";
break;
case 16:
// Check an offline app domain may store some more data
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&D&success";
break;
case 17:
// Check an offline app domain is using its own (larger) quota
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&failure";
break;
case 18:
// This test checks we correctly subtract A from the usage. A is inherited
// from the persistent database before we switch to session-only cookies
// mode
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?remove&A&success";
break;
case 19:
// now we shold have more space to store a new value
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?add&E&success";
break;
case 20:
// Do a clean up...
slaveOrigin = "http://example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
case 21:
// Do a clean up...
slaveOrigin = "http://test1.example.com";
slave.location = slaveOrigin + slavePath + "frameQuota.html?clear";
break;
default:
removeOfflineApp("http://test1.example.com");
prefs.setIntPref("dom.storage.default_quota", quota);
prefs.setIntPref("offline-apps.quota.max", quotaOffline);
cp.setAccess(uri, Components.interfaces.nsICookiePermission.ACCESS_DEFAULT);
SimpleTest.finish();
}
++currentTest;
}
function doStep()
{
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body onload="doNextTest();">
<iframe src="" name="frame"></iframe>
</body>
</html>

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

@ -0,0 +1,80 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
function run_test() {
var cs = Cc["@mozilla.org/cookieService;1"].getService(Ci.nsICookieService);
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
var pb = null;
try {
pb = Cc["@mozilla.org/privatebrowsing;1"].getService(Ci.nsIPrivateBrowsingService);
} catch (e) {}
// accept all cookies and clear the table
prefs.setIntPref("network.cookie.lifetimePolicy", 0);
cs.removeAll();
// saturate the cookie table
addCookies(0, 5000);
// check how many cookies we have
var count = getCookieCount();
do_check_neq(count, 0);
// if private browsing is available
if (pb) {
// enter private browsing mode
pb.privateBrowsingEnabled = true;
// check that we have zero cookies
do_check_eq(getCookieCount(), 0);
// saturate the cookie table again
addCookies(5000, 5000);
// check we have the same number of cookies
do_check_eq(getCookieCount(), count);
// remove them all
cs.removeAll();
do_check_eq(getCookieCount(), 0);
// leave private browsing mode
pb.privateBrowsingEnabled = false;
}
// make sure our cookies are back
do_check_eq(getCookieCount(), count);
// set a few more, to trigger a purge
addCookies(10000, 1000);
// check we have the same number of cookies
var count = getCookieCount();
do_check_eq(getCookieCount(), count);
// remove them all
cs.removeAll();
do_check_eq(getCookieCount(), 0);
}
function getCookieCount() {
var count = 0;
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
var enumerator = cm.enumerator;
while (enumerator.hasMoreElements()) {
if (!(enumerator.getNext() instanceof Ci.nsICookie2))
throw new Error("not a cookie");
++count;
}
return count;
}
function addCookies(start, count) {
var cm = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
var expiry = (Date.now() + 1000) * 1000;
for (var i = start; i < start + count; ++i)
cm.add(i + ".bar", "", "foo", "bar", false, false, true, expiry);
}

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

@ -201,6 +201,9 @@ static EGLDisplay _cairo_ddraw_egl_dpy = EGL_NO_DISPLAY;
static EGLContext _cairo_ddraw_egl_dummy_ctx = EGL_NO_CONTEXT;
static EGLSurface _cairo_ddraw_egl_dummy_surface = EGL_NO_SURFACE;
static GLint _cairo_ddraw_ogl_max_texture_size;
static cairo_status_t _cairo_ddraw_ogl_init(void);
static cairo_status_t
@ -1505,6 +1508,10 @@ _cairo_ddraw_ogl_analyze_pattern (const cairo_pattern_t * pattern,
_cairo_surface_get_extents (surface, &extents);
if (extents.width > _cairo_ddraw_ogl_max_texture_size ||
extents.height > _cairo_ddraw_ogl_max_texture_size)
return CAIRO_DDRAW_OGL_TEXTURE_UNSUPPORTED;
if (extents_out)
*extents_out = extents;
@ -1911,6 +1918,8 @@ _cairo_ddraw_ogl_init()
_cairo_ddraw_ogl_next_scratch_buffer = 0;
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &_cairo_ddraw_ogl_max_texture_size);
atexit (_cairo_ddraw_ogl_fini);
return CAIRO_STATUS_SUCCESS;

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

@ -11141,23 +11141,6 @@ TraceRecorder::setProp(jsval &l, JSPropCacheEntry* entry, JSScopeProperty* sprop
if (OBJ_GET_CLASS(cx, obj) == &js_CallClass)
return setCallProp(obj, obj_ins, sprop, v_ins, v);
/*
* Setting a function-valued property might need to rebrand the object, so
* we emit a call to the method write barrier. There's no need to guard on
* this, because functions have distinct trace-type from other values and
* branded-ness is implied by the shape, which we've already guarded on.
*/
if (scope->branded() && VALUE_IS_FUNCTION(cx, v) && entry->directHit()) {
if (obj == globalObj)
RETURN_STOP("can't trace function-valued property set in branded global scope");
enterDeepBailCall();
LIns* args[] = { v_ins, INS_CONSTSPROP(sprop), obj_ins, cx_ins };
LIns* ok_ins = lir->insCall(&MethodWriteBarrier_ci, args);
guard(false, lir->ins_eq0(ok_ins), OOM_EXIT);
leaveDeepBailCall();
}
// Find obj2. If entry->adding(), the TAG bits are all 0.
JSObject* obj2 = obj;
for (jsuword i = PCVCAP_TAG(entry->vcap) >> PCVCAP_PROTOBITS; i; i--)
@ -11176,6 +11159,23 @@ TraceRecorder::setProp(jsval &l, JSPropCacheEntry* entry, JSScopeProperty* sprop
JS_ASSERT(scope->has(sprop));
JS_ASSERT_IF(obj2 != obj, sprop->attrs & JSPROP_SHARED);
/*
* Setting a function-valued property might need to rebrand the object, so
* we emit a call to the method write barrier. There's no need to guard on
* this, because functions have distinct trace-type from other values and
* branded-ness is implied by the shape, which we've already guarded on.
*/
if (scope->branded() && VALUE_IS_FUNCTION(cx, v) && entry->directHit()) {
if (obj == globalObj)
RETURN_STOP("can't trace function-valued property set in branded global scope");
enterDeepBailCall();
LIns* args[] = { v_ins, INS_CONSTSPROP(sprop), obj_ins, cx_ins };
LIns* ok_ins = lir->insCall(&MethodWriteBarrier_ci, args);
guard(false, lir->ins_eq0(ok_ins), OOM_EXIT);
leaveDeepBailCall();
}
// Add a property to the object if necessary.
if (entry->adding()) {
JS_ASSERT(!(sprop->attrs & JSPROP_SHARED));

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

@ -49,7 +49,7 @@ script 15.9.5.11-5.js
script 15.9.5.11-6.js
script 15.9.5.11-7.js
script 15.9.5.12-1.js
skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&XPCOMABI.match(/x86_64/)) script 15.9.5.12-2.js # bug xxx crash
skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script 15.9.5.12-2.js # bug xxx crash
script 15.9.5.12-3.js
script 15.9.5.12-4.js
script 15.9.5.12-5.js
@ -66,7 +66,7 @@ script 15.9.5.13-7.js
script 15.9.5.13-8.js
script 15.9.5.14.js
script 15.9.5.15.js
skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&XPCOMABI.match(/x86_64/)) script 15.9.5.16.js # bug xxx crash
skip-if(!xulRuntime.shell&&xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script 15.9.5.16.js # bug xxx crash
script 15.9.5.17.js
script 15.9.5.18.js
script 15.9.5.19.js

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

@ -5,7 +5,7 @@ script regress-101964.js
script regress-107138.js
fails script regress-108440.js
script regress-154338.js
skip-if(xulRuntime.OS=="Linux"&&XPCOMABI.match(/x86_64/)) script regress-157652.js # No test results
skip-if(xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script regress-157652.js # No test results
script regress-178722.js
script regress-255555.js
script regress-299644.js
@ -14,7 +14,7 @@ script regress-310351.js
script regress-311515.js
script regress-313153.js
script regress-315509-01.js
skip-if(xulRuntime.OS=="Linux"&&XPCOMABI.match(/x86_64/)) script regress-330812.js # No test results
skip-if(xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script regress-330812.js # No test results
script regress-345961.js
script regress-348810.js
script regress-350256-01.js

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

@ -114,7 +114,7 @@ script regress-295052.js
script regress-295666.js
script regress-299209.js
script regress-299641.js
skip-if(XPCOMABI.match(/x86_64/)||(xulRuntime.OS=="WINNT"&&isDebugBuild)) script regress-303213.js # slow
skip-if(xulRuntime.XPCOMABI.match(/x86_64/)||(xulRuntime.OS=="WINNT"&&isDebugBuild)) script regress-303213.js # slow
script regress-306633.js
script regress-306727.js
script regress-306794.js
@ -209,7 +209,7 @@ skip-if(isDebugBuild) script regress-360969-06.js # slow
script regress-361467.js
script regress-361617.js
skip script regress-362583.js # obsolete test
fails-if(xulRuntime.OS=="WINNT") random-if(xulRuntime.OS=="Linux"&&!XPCOMABI.match(/x86_64/)) skip-if(xulRuntime.OS=="Linux"&&XPCOMABI.match(/x86_64/)) script regress-3649-n.js # No test results on windows, sometimes no test results on 32 bit linux, hangs os/consumes ram/swap on 64bit linux.
fails-if(xulRuntime.OS=="WINNT") random-if(xulRuntime.OS=="Linux"&&!xulRuntime.XPCOMABI.match(/x86_64/)) skip-if(xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script regress-3649-n.js # No test results on windows, sometimes no test results on 32 bit linux, hangs os/consumes ram/swap on 64bit linux.
script regress-366122.js
script regress-366468.js
script regress-366601.js
@ -243,7 +243,7 @@ skip-if(xulRuntime.OS=="WINNT"&&isDebugBuild) script regress-418540.js # slow
script regress-419018.js
script regress-419803.js
script regress-420919.js
fails-if(xulRuntime.OS=="Linux"&&XPCOMABI.match(/x86_64/)) script regress-422348.js # No test results
fails-if(xulRuntime.OS=="Linux"&&xulRuntime.XPCOMABI.match(/x86_64/)) script regress-422348.js # No test results
script regress-424311.js
skip-if(xulRuntime.OS=="WINNT"&&isDebugBuild) script regress-425360.js # slow
script regress-426827.js

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

@ -5,5 +5,5 @@ random script regress-157334-01.js # BigO
script regress-179068.js
random script regress-314890.js # BigO
random script regress-322772.js # BigO
random skip-if(xulRuntime.OS=="Linux"&&!isDebugBuild&&!XPCOMABI.match(/x86_64/)) script regress-56940-01.js # BigO, slow if Linux 32bit opt
random skip-if(xulRuntime.OS=="Linux"&&!isDebugBuild&&!xulRuntime.XPCOMABI.match(/x86_64/)) script regress-56940-01.js # BigO, slow if Linux 32bit opt
random script regress-56940-02.js # BigO

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

@ -0,0 +1,17 @@
// This test should not assert in a debug build.
var q1={};
var $native = function () {
for (var i = 0, l = arguments.length; i < l; i++) {
arguments[i].extend = function (props) {};
}
};
$native(q1, Array, String, Number);
Array.extend({});
Number.extend({});
Object.Native = function () {
for (var i = 0; i < arguments.length; i++) {
arguments[i].eeeeee = (function(){});
}
};
new Object.Native(q1, Array, String, Number);

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

@ -107,12 +107,7 @@ nsCounterUseNode::GetText(nsString& aResult)
stack.AppendElement(n->mScopePrev);
const nsCSSValue& styleItem = mCounterStyle->Item(mAllCounters ? 2 : 1);
PRInt32 style;
if (styleItem.GetUnit() == eCSSUnit_None) {
style = NS_STYLE_LIST_STYLE_NONE;
} else {
style = styleItem.GetIntValue();
}
PRInt32 style = styleItem.GetIntValue();
const PRUnichar* separator;
if (mAllCounters)
separator = mCounterStyle->Item(1).GetStringBufferValue();

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

@ -186,11 +186,9 @@ SHARED_LIBRARY_LIBS += \
$(NULL)
endif
ifdef MOZ_SMIL
SHARED_LIBRARY_LIBS += \
$(DEPTH)/content/smil/$(LIB_PREFIX)gkconsmil_s.$(LIB_SUFFIX) \
$(NULL)
endif
ifdef MOZ_PLAINTEXT_EDITOR_ONLY
DEFINES += -DMOZILLA_PLAINTEXT_EDITOR_ONLY

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

@ -87,7 +87,7 @@ function do_test() {
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(test);
addLoadEvent(do_test);
</script>
</pre>

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

@ -1,3 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sw=2 et tw=79: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -47,8 +49,8 @@
/*****************************************************************************
* This implementation does not currently operaate according to the W3C spec.
* So far, only parentNode() and nextNode() are implemented, and are not
* interoperable.
* In particular it does NOT handle DOM mutations during the walk. It also
* ignores whatToShow and the filter.
*****************************************************************************/
////////////////////////////////////////////////////
@ -162,78 +164,195 @@ inDeepTreeWalker::ParentNode(nsIDOMNode** _retval)
*_retval = nsnull;
if (!mCurrentNode) return NS_OK;
if (!mDOMUtils) {
mDOMUtils = do_GetService("@mozilla.org/inspector/dom-utils;1");
if (!mDOMUtils) {
return NS_ERROR_OUT_OF_MEMORY;
}
if (mStack.Length() == 1) {
// No parent
return NS_OK;
}
nsresult rv = mDOMUtils->GetParentForNode(mCurrentNode, mShowAnonymousContent,
_retval);
mCurrentNode = *_retval;
return rv;
// Pop off the current node, and push the new one
mStack.RemoveElementAt(mStack.Length()-1);
DeepTreeStackItem& top = mStack.ElementAt(mStack.Length() - 1);
mCurrentNode = top.node;
top.lastIndex = 0;
NS_ADDREF(*_retval = mCurrentNode);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::FirstChild(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
*_retval = nsnull;
if (!mCurrentNode) {
return NS_OK;
}
DeepTreeStackItem& top = mStack.ElementAt(mStack.Length() - 1);
nsCOMPtr<nsIDOMNode> kid;
top.kids->Item(0, getter_AddRefs(kid));
if (!kid) {
return NS_OK;
}
top.lastIndex = 1;
PushNode(kid);
kid.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::LastChild(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
*_retval = nsnull;
if (!mCurrentNode) {
return NS_OK;
}
DeepTreeStackItem& top = mStack.ElementAt(mStack.Length() - 1);
nsCOMPtr<nsIDOMNode> kid;
PRUint32 length;
top.kids->GetLength(&length);
top.kids->Item(length - 1, getter_AddRefs(kid));
if (!kid) {
return NS_OK;
}
top.lastIndex = length;
PushNode(kid);
kid.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::PreviousSibling(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
*_retval = nsnull;
if (!mCurrentNode) {
return NS_OK;
}
NS_ASSERTION(mStack.Length() > 0, "Should have things in mStack");
if (mStack.Length() == 1) {
// No previous sibling
return NS_OK;
}
DeepTreeStackItem& parent = mStack.ElementAt(mStack.Length()-2);
nsCOMPtr<nsIDOMNode> previousSibling;
parent.kids->Item(parent.lastIndex-2, getter_AddRefs(previousSibling));
if (!previousSibling) {
return NS_OK;
}
// Our mStack's topmost element is our current node. Since we're trying to
// change that to the previous sibling, pop off the current node, and push
// the new one.
mStack.RemoveElementAt(mStack.Length() - 1);
parent.lastIndex--;
PushNode(previousSibling);
previousSibling.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::NextSibling(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
*_retval = nsnull;
if (!mCurrentNode) {
return NS_OK;
}
NS_ASSERTION(mStack.Length() > 0, "Should have things in mStack");
if (mStack.Length() == 1) {
// No next sibling
return NS_OK;
}
DeepTreeStackItem& parent = mStack.ElementAt(mStack.Length()-2);
nsCOMPtr<nsIDOMNode> nextSibling;
parent.kids->Item(parent.lastIndex, getter_AddRefs(nextSibling));
if (!nextSibling) {
return NS_OK;
}
// Our mStack's topmost element is our current node. Since we're trying to
// change that to the next sibling, pop off the current node, and push
// the new one.
mStack.RemoveElementAt(mStack.Length() - 1);
parent.lastIndex++;
PushNode(nextSibling);
nextSibling.forget(_retval);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::PreviousNode(nsIDOMNode **_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
if (!mCurrentNode || mStack.Length() == 1) {
// Nowhere to go from here
*_retval = nsnull;
return NS_OK;
}
nsCOMPtr<nsIDOMNode> node;
PreviousSibling(getter_AddRefs(node));
if (!node) {
return ParentNode(_retval);
}
// Now we're positioned at our previous sibling. But since the DOM tree
// traversal is depth-first, the previous node is its most deeply nested last
// child. Just loop until LastChild() returns null; since the LastChild()
// call that returns null won't affect our position, we will then be
// positioned at the correct node.
while (node) {
LastChild(getter_AddRefs(node));
}
NS_ADDREF(*_retval = mCurrentNode);
return NS_OK;
}
NS_IMETHODIMP
inDeepTreeWalker::NextNode(nsIDOMNode **_retval)
{
if (!mCurrentNode) return NS_OK;
nsCOMPtr<nsIDOMNode> next;
while (1) {
DeepTreeStackItem& top = mStack.ElementAt(mStack.Length()-1);
nsCOMPtr<nsIDOMNodeList> kids = top.kids;
PRUint32 childCount;
kids->GetLength(&childCount);
// First try our kids
FirstChild(_retval);
if (top.lastIndex == childCount) {
mStack.RemoveElementAt(mStack.Length()-1);
if (mStack.Length() == 0) {
mCurrentNode = nsnull;
break;
}
} else {
kids->Item(top.lastIndex++, getter_AddRefs(next));
PushNode(next);
break;
if (*_retval) {
return NS_OK;
}
// Now keep trying next siblings up the parent chain, but if we
// discover there's nothing else restore our state.
#ifdef DEBUG
nsIDOMNode* origCurrentNode = mCurrentNode;
#endif
PRUint32 lastChildCallsToMake = 0;
while (1) {
NextSibling(_retval);
if (*_retval) {
return NS_OK;
}
}
*_retval = next;
NS_IF_ADDREF(*_retval);
nsCOMPtr<nsIDOMNode> parent;
ParentNode(getter_AddRefs(parent));
if (!parent) {
// Nowhere else to go; we're done. Restore our state.
while (lastChildCallsToMake--) {
nsCOMPtr<nsIDOMNode> dummy;
LastChild(getter_AddRefs(dummy));
}
NS_ASSERTION(mCurrentNode == origCurrentNode,
"Didn't go back to the right node?");
*_retval = nsnull;
return NS_OK;
}
++lastChildCallsToMake;
}
NS_NOTREACHED("how did we get here?");
return NS_OK;
}

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

@ -52,7 +52,8 @@ struct DeepTreeStackItem
{
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIDOMNodeList> kids;
PRUint32 lastIndex;
PRUint32 lastIndex; // Index one bigger than the index of whatever
// kid we're currently at in |kids|.
};
////////////////////////////////////////////////////

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

@ -47,6 +47,7 @@ include $(topsrcdir)/config/rules.mk
_TEST_FILES =\
test_bug462787.html \
test_bug462789.html \
test_bug522601.xhtml \
$(NULL)
libs:: $(_TEST_FILES)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше