Bug 554693 - Implement stub for indexedDB

r=hanzab
sr=vlad
This commit is contained in:
Shawn Wilsher 2010-04-22 11:52:04 -07:00
parent 8222b230c0
commit 45426d5201
7 changed files with 147 additions and 3 deletions

View File

@ -7480,6 +7480,13 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage)
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::GetIndexedDB(nsIIndexedDatabaseRequest** _indexedDB)
{
*_indexedDB = nsnull;
return NS_OK;
}
//*****************************************************************************
// nsGlobalWindow::nsIInterfaceRequestor
//*****************************************************************************

View File

@ -63,6 +63,7 @@ SDK_XPIDLSRCS = \
nsIDOMStorageItem.idl \
nsIDOMStorageList.idl \
nsIDOMStorageWindow.idl \
nsIIndexedDatabaseRequest.idl \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -39,8 +39,8 @@
/**
* Interface for a client side storage. See
* http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side
* for more information.
* http://www.whatwg.org/specs/web-apps/current-work/#scs-client-side and
* http://www.w3.org/TR/IndexedDB/ for more information.
*
* Allows access to contextual storage areas.
*/
@ -48,8 +48,9 @@
interface nsIDOMStorageObsolete;
interface nsIDOMStorage;
interface nsIDOMStorageList;
interface nsIIndexedDatabaseRequest;
[scriptable, uuid(A44581FE-DD9B-4fd7-9893-00C4AB43F12E)]
[scriptable, uuid(b6f6efd8-1bdc-43af-b8ef-6685d6260931)]
interface nsIDOMStorageWindow : nsISupports
{
/**
@ -66,4 +67,9 @@ interface nsIDOMStorageWindow : nsISupports
* Local storage for the current browsing context.
*/
readonly attribute nsIDOMStorage localStorage;
/**
* Indexed Databases for the current browsing context.
*/
readonly attribute nsIIndexedDatabaseRequest indexedDB;
};

View File

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Indexed Database code.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsISupports.idl"
/**
* Interface that defines the indexedDB property on a window. See
* http://dev.w3.org/2006/webapi/WebSimpleDB/#idl-def-IndexedDatabaseRequest
* for more information.
*/
[scriptable, uuid(043161e0-93b8-43b4-94d8-f34046d679b4)]
interface nsIIndexedDatabaseRequest : nsISupports
{
};

View File

@ -56,6 +56,7 @@ DIRS += \
localstorage \
sessionstorage \
storageevent \
indexeddb \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,52 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Indexed Database Test Code.
#
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Shawn Wilsher <me@shawnwilsher.com>
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
DEPTH = ../../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = dom/tests/mochitest/indexeddb
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = \
test_property_on_window.html \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)

View File

@ -0,0 +1,27 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Indexed Database Property Test</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"/>
<script type="text/javascript">
function run_test()
{
ok("indexedDB" in window, "indexedDB property exists on the window");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
</script>
</head>
<body onload="run_test();">
</body>
</html>