Bug 492219. Rename globalStorage constructor to StorageObsolete and localStorage constuctor to Storage. r+sr=jst

This commit is contained in:
Honza Bombas 2009-05-15 15:17:55 +12:00
Родитель 1efad9eaf2
Коммит ffaa9a6009
6 изменённых файлов: 47 добавлений и 9 удалений

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

@ -1182,7 +1182,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
// since a call to addProperty() is always followed by a call to
// setProperty(), except in the case when a getter or setter is set
// for a property. But we don't care about getters or setters here.
NS_DEFINE_CLASSINFO_DATA(Storage, nsStorageSH,
NS_DEFINE_CLASSINFO_DATA(StorageObsolete, nsStorageSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_NEWRESOLVE |
nsIXPCScriptable::WANT_GETPROPERTY |
@ -1191,7 +1191,7 @@ static nsDOMClassInfoData sClassInfoData[] = {
nsIXPCScriptable::DONT_ENUM_STATIC_PROPS |
nsIXPCScriptable::WANT_NEWENUMERATE)
NS_DEFINE_CLASSINFO_DATA(Storage2, nsStorage2SH,
NS_DEFINE_CLASSINFO_DATA(Storage, nsStorage2SH,
DOM_DEFAULT_SCRIPTABLE_FLAGS |
nsIXPCScriptable::WANT_NEWRESOLVE |
nsIXPCScriptable::WANT_GETPROPERTY |
@ -3396,11 +3396,11 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMXPathResult)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(Storage, nsIDOMStorage)
DOM_CLASSINFO_MAP_BEGIN(StorageObsolete, nsIDOMStorage)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorage)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(Storage2, nsIDOMStorage2)
DOM_CLASSINFO_MAP_BEGIN(Storage, nsIDOMStorage2)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMStorage2)
DOM_CLASSINFO_MAP_END

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

@ -382,8 +382,8 @@ enum nsDOMClassInfoID {
eDOMClassInfo_XPathResult_id,
// WhatWG WebApps Objects
eDOMClassInfo_StorageObsolete_id,
eDOMClassInfo_Storage_id,
eDOMClassInfo_Storage2_id,
eDOMClassInfo_StorageList_id,
eDOMClassInfo_StorageItem_id,
eDOMClassInfo_StorageEvent_id,

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

@ -471,7 +471,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMStorage)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorage)
NS_INTERFACE_MAP_ENTRY(nsIDOMStorage)
NS_INTERFACE_MAP_ENTRY(nsPIDOMStorage)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Storage)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(StorageObsolete)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
@ -1342,7 +1342,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMStorage2)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMStorage2)
NS_INTERFACE_MAP_ENTRY(nsIDOMStorage2)
NS_INTERFACE_MAP_ENTRY(nsPIDOMStorage)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Storage2)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Storage)
NS_INTERFACE_MAP_END
nsresult

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

@ -9,10 +9,10 @@ function test_DOMStorage_global()
is(globalStorage instanceof StorageList, true, "globalStorage property");
var storage = globalStorage.namedItem(currentDomain);
is(storage instanceof Storage, true, "StorageList namedItem");
is(storage instanceof StorageObsolete, true, "StorageList namedItem");
var storage2 = globalStorage[currentDomain];
is(storage2 instanceof Storage, true, "StorageList property syntax");
is(storage2 instanceof StorageObsolete, true, "StorageList property syntax");
is(storage, storage2, "StorageList namedItem and array return same value");

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

@ -71,6 +71,7 @@ _TEST_FILES = \
test_localStorageQuota.html \
test_localStorageKeyOrder.html \
test_removeOwnersAPI.html \
test_storageConstructor.html \
$(NULL)
_CHROME_FILES = \

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

@ -0,0 +1,37 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>localStorage different port numbers</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="interOriginTest2.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
function startTest()
{
var functionCalled = false;
is(localStorage instanceof Storage, true, "localStorage is instance of Storage");
Storage.prototype.exists = function(key) {
functionCalled = true;
return this.getItem(key) != null;
}
localStorage.setItem("test_prototype", "value");
is(functionCalled, false, "Overridden function not called");
is(localStorage.exists("test_prototype"), true, "Prototype overridden");
is(functionCalled, true, "Overridden function called");
localStorage.clear();
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body onload="startTest();">
</body>
</html>