Merge m-c to inbound, a=merge
MozReview-Commit-ID: EgmkxLul9DE
|
@ -1642,7 +1642,7 @@ var BookmarkingUI = {
|
|||
},
|
||||
|
||||
_hasBookmarksObserver: false,
|
||||
_itemGuids: [],
|
||||
_itemGuids: new Set(),
|
||||
uninit: function BUI_uninit() {
|
||||
this._updateBookmarkPageMenuItem(true);
|
||||
CustomizableUI.removeListener(this);
|
||||
|
@ -1667,14 +1667,14 @@ var BookmarkingUI = {
|
|||
|
||||
updateStarState: function BUI_updateStarState() {
|
||||
this._uri = gBrowser.currentURI;
|
||||
this._itemGuids = [];
|
||||
let aItemGuids = [];
|
||||
this._itemGuids.clear();
|
||||
let guids = new Set();
|
||||
|
||||
// those objects are use to check if we are in the current iteration before
|
||||
// returning any result.
|
||||
let pendingUpdate = this._pendingUpdate = {};
|
||||
|
||||
PlacesUtils.bookmarks.fetch({url: this._uri}, b => aItemGuids.push(b.guid))
|
||||
PlacesUtils.bookmarks.fetch({url: this._uri}, b => guids.add(b.guid), { concurrent: true })
|
||||
.catch(Components.utils.reportError)
|
||||
.then(() => {
|
||||
if (pendingUpdate != this._pendingUpdate) {
|
||||
|
@ -1684,9 +1684,11 @@ var BookmarkingUI = {
|
|||
// It's possible that onItemAdded gets called before the async statement
|
||||
// calls back. For such an edge case, retain all unique entries from the
|
||||
// array.
|
||||
this._itemGuids = this._itemGuids.filter(
|
||||
guid => !aItemGuids.includes(guid)
|
||||
).concat(aItemGuids);
|
||||
if (this._itemGuids.size > 0) {
|
||||
this._itemGuids = new Set(...this._itemGuids, ...guids);
|
||||
} else {
|
||||
this._itemGuids = guids;
|
||||
}
|
||||
|
||||
this._updateStar();
|
||||
|
||||
|
@ -1713,7 +1715,7 @@ var BookmarkingUI = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this._itemGuids.length > 0) {
|
||||
if (this._itemGuids.size > 0) {
|
||||
this.broadcaster.setAttribute("starred", "true");
|
||||
this.broadcaster.setAttribute("buttontooltiptext", this._starredTooltip);
|
||||
if (this.button.getAttribute("overflowedItem") == "true") {
|
||||
|
@ -1733,7 +1735,7 @@ var BookmarkingUI = {
|
|||
* to the default (Bookmark This Page) for OS X.
|
||||
*/
|
||||
_updateBookmarkPageMenuItem: function BUI__updateBookmarkPageMenuItem(forceReset) {
|
||||
let isStarred = !forceReset && this._itemGuids.length > 0;
|
||||
let isStarred = !forceReset && this._itemGuids.size > 0;
|
||||
let label = isStarred ? "editlabel" : "bookmarklabel";
|
||||
if (this.broadcaster) {
|
||||
this.broadcaster.setAttribute("label", this.broadcaster.getAttribute(label));
|
||||
|
@ -1830,7 +1832,7 @@ var BookmarkingUI = {
|
|||
}
|
||||
|
||||
// Handle special case when the button is in the panel.
|
||||
let isBookmarked = this._itemGuids.length > 0;
|
||||
let isBookmarked = this._itemGuids.size > 0;
|
||||
|
||||
if (this._currentAreaType == CustomizableUI.TYPE_MENU_PANEL) {
|
||||
this._showSubview();
|
||||
|
@ -1912,10 +1914,10 @@ var BookmarkingUI = {
|
|||
onItemAdded(aItemId, aParentId, aIndex, aItemType, aURI, aTitle, aDateAdded, aGuid) {
|
||||
if (aURI && aURI.equals(this._uri)) {
|
||||
// If a new bookmark has been added to the tracked uri, register it.
|
||||
if (!this._itemGuids.includes(aGuid)) {
|
||||
this._itemGuids.push(aGuid);
|
||||
if (!this._itemGuids.has(aGuid)) {
|
||||
this._itemGuids.add(aGuid);
|
||||
// Only need to update the UI if it wasn't marked as starred before:
|
||||
if (this._itemGuids.length == 1) {
|
||||
if (this._itemGuids.size == 1) {
|
||||
this._updateStar();
|
||||
}
|
||||
}
|
||||
|
@ -1923,12 +1925,11 @@ var BookmarkingUI = {
|
|||
},
|
||||
|
||||
onItemRemoved(aItemId, aParentId, aIndex, aItemType, aURI, aGuid) {
|
||||
let index = this._itemGuids.indexOf(aGuid);
|
||||
// If one of the tracked bookmarks has been removed, unregister it.
|
||||
if (index != -1) {
|
||||
this._itemGuids.splice(index, 1);
|
||||
if (this._itemGuids.has(aGuid)) {
|
||||
this._itemGuids.delete(aGuid);
|
||||
// Only need to update the UI if the page is no longer starred
|
||||
if (this._itemGuids.length == 0) {
|
||||
if (this._itemGuids.size == 0) {
|
||||
this._updateStar();
|
||||
}
|
||||
}
|
||||
|
@ -1937,20 +1938,19 @@ var BookmarkingUI = {
|
|||
onItemChanged(aItemId, aProperty, aIsAnnotationProperty, aNewValue, aLastModified,
|
||||
aItemType, aParentId, aGuid) {
|
||||
if (aProperty == "uri") {
|
||||
let index = this._itemGuids.indexOf(aGuid);
|
||||
// If the changed bookmark was tracked, check if it is now pointing to
|
||||
// a different uri and unregister it.
|
||||
if (index != -1 && aNewValue != this._uri.spec) {
|
||||
this._itemGuids.splice(index, 1);
|
||||
if (this._itemGuids.has(aGuid) && aNewValue != this._uri.spec) {
|
||||
this._itemGuids.delete(aGuid);
|
||||
// Only need to update the UI if the page is no longer starred
|
||||
if (this._itemGuids.length == 0) {
|
||||
if (this._itemGuids.size == 0) {
|
||||
this._updateStar();
|
||||
}
|
||||
} else if (index == -1 && aNewValue == this._uri.spec) {
|
||||
} else if (!this._itemGuids.has(aGuid) && aNewValue == this._uri.spec) {
|
||||
// If another bookmark is now pointing to the tracked uri, register it.
|
||||
this._itemGuids.push(aGuid);
|
||||
this._itemGuids.add(aGuid);
|
||||
// Only need to update the UI if it wasn't marked as starred before:
|
||||
if (this._itemGuids.length == 1) {
|
||||
if (this._itemGuids.size == 1) {
|
||||
this._updateStar();
|
||||
}
|
||||
}
|
||||
|
@ -1985,8 +1985,8 @@ var BookmarkingUI = {
|
|||
this._starButtonLabel = currentLabel;
|
||||
|
||||
if (currentLabel == this._starButtonLabel) {
|
||||
let desiredLabel = this._itemGuids.length > 0 ? this._starButtonOverflowedStarredLabel
|
||||
: this._starButtonOverflowedLabel;
|
||||
let desiredLabel = this._itemGuids.size > 0 ? this._starButtonOverflowedStarredLabel
|
||||
: this._starButtonOverflowedLabel;
|
||||
aNode.setAttribute("label", desiredLabel);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -232,8 +232,8 @@ toolbar[customizing] > .overflow-button {
|
|||
/* The ids are ugly, but this should be reasonably performant, and
|
||||
* using a tagname as the last item would be less so.
|
||||
*/
|
||||
#widget-overflow:not([hasdynamicitems]) #widget-overflow-fixed-separator,
|
||||
#widget-overflow-fixed-list:empty + #widget-overflow-fixed-separator {
|
||||
#widget-overflow-list:empty + #widget-overflow-fixed-separator,
|
||||
#widget-overflow:not([hasfixeditems]) #widget-overflow-fixed-separator {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,13 +36,13 @@ function checkControlPanelIcons() {
|
|||
.getComputedStyle(document.getElementById("identity-popup-security-content"))
|
||||
.getPropertyValue("background-image");
|
||||
is(connectionIconImage,
|
||||
"url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
|
||||
"url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg\")",
|
||||
"Using expected icon image in the identity block");
|
||||
is(securityViewBG,
|
||||
"url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
|
||||
"url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg\")",
|
||||
"Using expected icon image in the Control Center main view");
|
||||
is(securityContentBG,
|
||||
"url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
|
||||
"url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg\")",
|
||||
"Using expected icon image in the Control Center subview");
|
||||
|
||||
gIdentityHandler._identityPopup.hidden = true;
|
||||
|
|
|
@ -52,7 +52,7 @@ add_task(async function test_simple() {
|
|||
.getComputedStyle(document.getElementById("identity-popup-security-content"))
|
||||
.getPropertyValue("background-image");
|
||||
is(connectionIconImage,
|
||||
"url(\"chrome://browser/skin/connection-mixed-active-loaded.svg#icon\")",
|
||||
"url(\"chrome://browser/skin/connection-mixed-active-loaded.svg\")",
|
||||
"Using expected icon image in the identity block");
|
||||
is(securityViewBG,
|
||||
"url(\"chrome://browser/skin/controlcenter/mcb-disabled.svg\")",
|
||||
|
|
|
@ -31,18 +31,18 @@ add_task(async function() {
|
|||
|
||||
// check that a warning is shown when loading a page with mixed content and an overridden certificate
|
||||
await loadBadCertPage(MIXED_CONTENT_URL);
|
||||
checkIdentityPopup("connection-mixed-passive-loaded.svg#icon");
|
||||
checkIdentityPopup("connection-mixed-passive-loaded.svg");
|
||||
|
||||
// check that the crossed out icon is shown when disabling mixed content protection
|
||||
gIdentityHandler.disableMixedContentProtection();
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
|
||||
checkIdentityPopup("connection-mixed-active-loaded.svg#icon");
|
||||
checkIdentityPopup("connection-mixed-active-loaded.svg");
|
||||
|
||||
// check that a warning is shown even without mixed content
|
||||
await BrowserTestUtils.loadURI(gBrowser.selectedBrowser, "https://self-signed.example.com");
|
||||
await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
|
||||
checkIdentityPopup("connection-mixed-passive-loaded.svg#icon");
|
||||
checkIdentityPopup("connection-mixed-passive-loaded.svg");
|
||||
|
||||
// remove cert exception
|
||||
let certOverrideService = Cc["@mozilla.org/security/certoverride;1"]
|
||||
|
|
|
@ -181,7 +181,7 @@ function assertMixedContentBlockingState(tabbrowser, states = {}) {
|
|||
|
||||
ok(!is_hidden(connectionIcon), "connection icon should be visible");
|
||||
if (activeLoaded) {
|
||||
is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-active-loaded.svg#icon\")",
|
||||
is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-active-loaded.svg\")",
|
||||
"Using active loaded icon");
|
||||
}
|
||||
if (activeBlocked && !passiveLoaded) {
|
||||
|
@ -189,11 +189,11 @@ function assertMixedContentBlockingState(tabbrowser, states = {}) {
|
|||
"Using active blocked icon");
|
||||
}
|
||||
if (passiveLoaded && !(activeLoaded || activeBlocked)) {
|
||||
is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
|
||||
is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg\")",
|
||||
"Using passive loaded icon");
|
||||
}
|
||||
if (passiveLoaded && activeBlocked) {
|
||||
is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg#icon\")",
|
||||
is(connectionIconImage, "url(\"chrome://browser/skin/connection-mixed-passive-loaded.svg\")",
|
||||
"Using active blocked and passive loaded icon");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4215,7 +4215,6 @@ OverflowableToolbar.prototype = {
|
|||
CustomizableUI.addListener(this);
|
||||
}
|
||||
this._toolbar.setAttribute("overflowing", "true");
|
||||
this._panel.setAttribute("hasdynamicitems", true);
|
||||
}
|
||||
child = prevChild;
|
||||
}
|
||||
|
@ -4278,7 +4277,6 @@ OverflowableToolbar.prototype = {
|
|||
if (!this._collapsed.size) {
|
||||
this._toolbar.removeAttribute("overflowing");
|
||||
CustomizableUI.removeListener(this);
|
||||
this._panel.removeAttribute("hasdynamicitems");
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -4369,7 +4367,6 @@ OverflowableToolbar.prototype = {
|
|||
if (!this._collapsed.size) {
|
||||
this._toolbar.removeAttribute("overflowing");
|
||||
CustomizableUI.removeListener(this);
|
||||
this._panel.removeAttribute("hasdynamicitems");
|
||||
}
|
||||
} else if (aNode.previousSibling) {
|
||||
// but if it still is, it must have changed places. Bookkeep:
|
||||
|
|
|
@ -526,7 +526,7 @@ CustomizeMode.prototype = {
|
|||
window.PanelUI.menuButton.disabled = false;
|
||||
if (gPhotonStructure) {
|
||||
let overflowContainer = document.getElementById("widget-overflow-scroller");
|
||||
overflowContainer.insertBefore(window.PanelUI.overflowFixedList, overflowContainer.firstElementChild);
|
||||
overflowContainer.appendChild(window.PanelUI.overflowFixedList);
|
||||
document.getElementById("nav-bar-overflow-button").disabled = false;
|
||||
} else {
|
||||
window.PanelUI.setMainView(window.PanelUI.mainView);
|
||||
|
|
|
@ -380,10 +380,10 @@
|
|||
<panelview id="widget-overflow-mainView"
|
||||
context="toolbar-context-menu">
|
||||
<vbox id="widget-overflow-scroller">
|
||||
<vbox id="widget-overflow-fixed-list" class="widget-overflow-list" hidden="true"/>
|
||||
<toolbarseparator id="widget-overflow-fixed-separator" hidden="true"/>
|
||||
<vbox id="widget-overflow-list" class="widget-overflow-list"
|
||||
overflowfortoolbar="nav-bar"/>
|
||||
<toolbarseparator id="widget-overflow-fixed-separator" hidden="true"/>
|
||||
<vbox id="widget-overflow-fixed-list" class="widget-overflow-list" hidden="true"/>
|
||||
</vbox>
|
||||
</panelview>
|
||||
</panelmultiview>
|
||||
|
|
|
@ -40,6 +40,7 @@ const PanelUI = {
|
|||
addonNotificationContainer: gPhotonStructure ? "appMenu-addon-banners" : "PanelUI-footer-addons",
|
||||
|
||||
overflowFixedList: gPhotonStructure ? "widget-overflow-fixed-list" : "",
|
||||
overflowPanel: gPhotonStructure ? "widget-overflow" : "",
|
||||
navbar: "nav-bar",
|
||||
};
|
||||
},
|
||||
|
@ -85,7 +86,8 @@ const PanelUI = {
|
|||
_initPhotonPanel() {
|
||||
if (gPhotonStructure) {
|
||||
this.overflowFixedList.hidden = false;
|
||||
this.overflowFixedList.nextSibling.hidden = false;
|
||||
// Also unhide the separator. We use CSS to hide/show it based on the panel's content.
|
||||
this.overflowFixedList.previousSibling.hidden = false;
|
||||
CustomizableUI.registerMenuPanel(this.overflowFixedList, CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
|
||||
this.navbar.setAttribute("photon-structure", "true");
|
||||
this.updateOverflowStatus();
|
||||
|
@ -608,7 +610,9 @@ const PanelUI = {
|
|||
let hasKids = this.overflowFixedList.hasChildNodes();
|
||||
if (hasKids && !this.navbar.hasAttribute("nonemptyoverflow")) {
|
||||
this.navbar.setAttribute("nonemptyoverflow", "true");
|
||||
this.overflowPanel.setAttribute("hasfixeditems", "true");
|
||||
} else if (!hasKids && this.navbar.hasAttribute("nonemptyoverflow")) {
|
||||
this.overflowPanel.removeAttribute("hasfixeditems");
|
||||
this.navbar.removeAttribute("nonemptyoverflow");
|
||||
}
|
||||
},
|
||||
|
|
|
@ -61,5 +61,7 @@
|
|||
}
|
||||
|
||||
#PopupAutoComplete > richlistbox > richlistitem[originaltype="insecureWarning"] > .ac-site-icon {
|
||||
list-style-image: url(chrome://browser/skin/connection-mixed-active-loaded.svg#icon);
|
||||
list-style-image: url(chrome://browser/skin/connection-mixed-active-loaded.svg);
|
||||
-moz-context-properties: fill;
|
||||
fill: GrayText;
|
||||
}
|
||||
|
|
|
@ -239,10 +239,12 @@ toolbar:-moz-lwtheme-darktext {
|
|||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
%filter substitution
|
||||
%define selectorSuffix :-moz-lwtheme-brighttext
|
||||
%define iconVariant -white
|
||||
%include identity-block/icons.inc.css
|
||||
#identity-icon:-moz-lwtheme-brighttext,
|
||||
#tracking-protection-icon:-moz-lwtheme-brighttext,
|
||||
#connection-icon:-moz-lwtheme-brighttext,
|
||||
#extension-icon:-moz-lwtheme-brighttext {
|
||||
fill: rgba(255,255,255,.7);
|
||||
}
|
||||
|
||||
#urlbar {
|
||||
%ifndef MOZ_PHOTON_THEME
|
||||
|
|
|
@ -4,6 +4,5 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="64" height="64" viewBox="0 0 64 64">
|
||||
#include ../icon-colors.inc.svg
|
||||
<path class="fieldtext" d="M42,62c2.2,0,4-1.8,4-4l0-14.2c0,0,0.4-3.7,2.8-3.7c2.4,0,2.2,3.9,6.7,3.9c2.3,0,6.2-1.2,6.2-8.2 c0-7-3.9-7.9-6.2-7.9c-4.5,0-4.3,3.7-6.7,3.7c-2.4,0-2.8-3.8-2.8-3.8V22c0-2.2-1.8-4-4-4H31.5c0,0-3.4-0.6-3.4-3 c0-2.4,3.8-2.6,3.8-7.1c0-2.3-1.3-5.9-8.3-5.9s-8,3.6-8,5.9c0,4.5,3.4,4.7,3.4,7.1c0,2.4-3.4,3-3.4,3H6c-2.2,0-4,1.8-4,4l0,7.8 c0,0-0.4,6,4.4,6c3.1,0,3.2-4.1,7.3-4.1c2,0,4,1.9,4,6c0,4.2-2,6.3-4,6.3c-4,0-4.2-4.1-7.3-4.1c-4.8,0-4.4,5.8-4.4,5.8L2,58 c0,2.2,1.8,4,4,4H19c0,0,6.3,0.4,6.3-4.4c0-3.1-4-3.6-4-7.7c0-2,2.2-4.5,6.4-4.5c4.2,0,6.6,2.5,6.6,4.5c0,4-3.9,4.6-3.9,7.7 c0,4.9,6.3,4.4,6.3,4.4H42z"/>
|
||||
<path fill="context-fill" d="M42,62c2.2,0,4-1.8,4-4l0-14.2c0,0,0.4-3.7,2.8-3.7c2.4,0,2.2,3.9,6.7,3.9c2.3,0,6.2-1.2,6.2-8.2 c0-7-3.9-7.9-6.2-7.9c-4.5,0-4.3,3.7-6.7,3.7c-2.4,0-2.8-3.8-2.8-3.8V22c0-2.2-1.8-4-4-4H31.5c0,0-3.4-0.6-3.4-3 c0-2.4,3.8-2.6,3.8-7.1c0-2.3-1.3-5.9-8.3-5.9s-8,3.6-8,5.9c0,4.5,3.4,4.7,3.4,7.1c0,2.4-3.4,3-3.4,3H6c-2.2,0-4,1.8-4,4l0,7.8 c0,0-0.4,6,4.4,6c3.1,0,3.2-4.1,7.3-4.1c2,0,4,1.9,4,6c0,4.2-2,6.3-4,6.3c-4,0-4.2-4.1-7.3-4.1c-4.8,0-4.4,5.8-4.4,5.8L2,58 c0,2.2,1.8,4,4,4H19c0,0,6.3,0.4,6.3-4.4c0-3.1-4-3.6-4-7.7c0-2,2.2-4.5,6.4-4.5c4.2,0,6.6,2.5,6.6,4.5c0,4-3.9,4.6-3.9,7.7 c0,4.9,6.3,4.4,6.3,4.4H42z"/>
|
||||
</svg>
|
||||
|
|
До Ширина: | Высота: | Размер: 1.0 KiB После Ширина: | Высота: | Размер: 1017 B |
|
@ -240,7 +240,9 @@
|
|||
|
||||
#identity-popup[connection=secure-cert-user-overridden] #identity-popup-securityView,
|
||||
#identity-popup[connection=secure-cert-user-overridden] #identity-popup-security-content {
|
||||
background-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg#icon);
|
||||
background-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg);
|
||||
-moz-context-properties: fill;
|
||||
fill: GrayText;
|
||||
}
|
||||
|
||||
#identity-popup[loginforms=insecure] #identity-popup-securityView,
|
||||
|
@ -253,6 +255,8 @@
|
|||
#identity-popup[connection=extension] #identity-popup-securityView,
|
||||
#identity-popup[connection=extension] #identity-popup-security-content {
|
||||
background-image: url(chrome://browser/skin/controlcenter/extension.svg);
|
||||
-moz-context-properties: fill;
|
||||
fill: #60bf4c;
|
||||
}
|
||||
|
||||
#identity-popup-security-descriptions > description {
|
||||
|
|
|
@ -1,29 +1,11 @@
|
|||
<style>
|
||||
|
||||
.fieldtext {
|
||||
fill: -moz-fieldtext;
|
||||
#ifdef MOZ_WIDGET_GTK
|
||||
/* The fill-opacity needs to be sufficient for high-contrast settings, and
|
||||
pathological Gtk themes where -moz-fieldtext provides low contrast by
|
||||
default. */
|
||||
fill-opacity: .7;
|
||||
#else
|
||||
fill-opacity: .5;
|
||||
#endif
|
||||
fill: GrayText;
|
||||
}
|
||||
|
||||
#ifdef XP_WIN
|
||||
@media (-moz-windows-default-theme: 0) {
|
||||
/* more opacity for high-contrast themes */
|
||||
.fieldtext {
|
||||
fill-opacity: .8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
.highlighttext {
|
||||
fill: highlighttext;
|
||||
fill-opacity: 1;
|
||||
}
|
||||
|
||||
.black {
|
||||
|
|
|
@ -4,12 +4,6 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="16" height="16" viewBox="0 0 16 16">
|
||||
#include ../icon-colors.inc.svg
|
||||
<style>
|
||||
svg > g:not(:target) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
<rect id="shape-lock-clasp-outer" x="4" y="2" width="8" height="10" rx="4" ry="4" />
|
||||
|
@ -37,18 +31,6 @@
|
|||
<line id="strike-through-red" x1="2" y1="14.1" x2="14" y2="2.5" stroke="#d92d21" stroke-width="1.8"/>
|
||||
</defs>
|
||||
|
||||
<g id="icon">
|
||||
<use xlink:href="#lock" class="fieldtext"/>
|
||||
<use xlink:href="#strike-through-red"/>
|
||||
</g>
|
||||
|
||||
<g id="icon-black">
|
||||
<use xlink:href="#lock" class="black"/>
|
||||
<use xlink:href="#strike-through-red"/>
|
||||
</g>
|
||||
|
||||
<g id="icon-white">
|
||||
<use xlink:href="#lock" class="white"/>
|
||||
<use xlink:href="#strike-through-red"/>
|
||||
</g>
|
||||
<use fill="context-fill" xlink:href="#lock"/>
|
||||
<use xlink:href="#strike-through-red"/>
|
||||
</svg>
|
||||
|
|
До Ширина: | Высота: | Размер: 2.0 KiB После Ширина: | Высота: | Размер: 1.6 KiB |
|
@ -4,12 +4,6 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="16" height="16" viewBox="0 0 16 16">
|
||||
#include ../icon-colors.inc.svg
|
||||
<style>
|
||||
svg > g:not(:target) {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
<rect id="shape-lock-clasp-outer" x="2" y="1" width="8" height="10" rx="4" ry="4" />
|
||||
|
@ -35,18 +29,6 @@
|
|||
</g>
|
||||
</defs>
|
||||
|
||||
<g id="icon">
|
||||
<rect width="16" height="16" mask="url(#mask-lock)" class="fieldtext"/>
|
||||
<use xlink:href="#warning-triangle"/>
|
||||
</g>
|
||||
|
||||
<g id="icon-black">
|
||||
<rect width="16" height="16" mask="url(#mask-lock)" class="black"/>
|
||||
<use xlink:href="#warning-triangle"/>
|
||||
</g>
|
||||
|
||||
<g id="icon-white">
|
||||
<rect width="16" height="16" mask="url(#mask-lock)" class="white"/>
|
||||
<use xlink:href="#warning-triangle"/>
|
||||
</g>
|
||||
<rect fill="context-fill" width="16" height="16" mask="url(#mask-lock)"/>
|
||||
<use xlink:href="#warning-triangle"/>
|
||||
</svg>
|
||||
|
|
До Ширина: | Высота: | Размер: 2.2 KiB После Ширина: | Высота: | Размер: 1.7 KiB |
|
@ -1,63 +0,0 @@
|
|||
%if 0
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
%endif
|
||||
|
||||
#identity-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#normal@iconVariant@);
|
||||
}
|
||||
|
||||
#identity-box:hover > #identity-icon:not(.no-hover)@selectorSuffix@,
|
||||
#identity-box[open=true] > #identity-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#hover@iconVariant@);
|
||||
}
|
||||
|
||||
#identity-box.extensionPage > #extension-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/controlcenter/extension.svg);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#identity-box.grantedPermissions > #identity-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#notice@iconVariant@);
|
||||
}
|
||||
|
||||
#identity-box.grantedPermissions:hover > #identity-icon:not(.no-hover)@selectorSuffix@,
|
||||
#identity-box.grantedPermissions[open=true] > #identity-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#notice-hover@iconVariant@);
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.chromeUI > #identity-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://branding/content/identity-icons-brand.svg);
|
||||
}
|
||||
|
||||
|
||||
#tracking-protection-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#enabled@iconVariant@);
|
||||
}
|
||||
|
||||
#tracking-protection-icon[state="loaded-tracking-content"]@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#disabled@iconVariant@);
|
||||
}
|
||||
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.verifiedDomain > #connection-icon@selectorSuffix@,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity > #connection-icon@selectorSuffix@,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveBlocked > #connection-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/connection-secure.svg);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.weakCipher > #connection-icon@selectorSuffix@,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContent > #connection-icon@selectorSuffix@,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContentLoadedActiveBlocked > #connection-icon@selectorSuffix@,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.certUserOverridden > #connection-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg#icon@iconVariant@);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.insecureLoginForms > #connection-icon@selectorSuffix@,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveContent > #connection-icon@selectorSuffix@ {
|
||||
list-style-image: url(chrome://browser/skin/connection-mixed-active-loaded.svg#icon@iconVariant@);
|
||||
visibility: visible;
|
||||
}
|
|
@ -4,16 +4,6 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
%endif
|
||||
|
||||
%filter substitution
|
||||
|
||||
%define selectorSuffix
|
||||
%define iconVariant
|
||||
%include icons.inc.css
|
||||
|
||||
%define selectorSuffix :-moz-lwtheme
|
||||
%define iconVariant -black
|
||||
%include icons.inc.css
|
||||
|
||||
#identity-box {
|
||||
font-size: .9em;
|
||||
padding: 3px 5px;
|
||||
|
@ -61,11 +51,45 @@
|
|||
}
|
||||
%endif
|
||||
|
||||
#identity-icon,
|
||||
#tracking-protection-icon,
|
||||
#connection-icon,
|
||||
#extension-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
-moz-context-properties: fill;
|
||||
fill: GrayText;
|
||||
}
|
||||
|
||||
#identity-icon:-moz-lwtheme,
|
||||
#tracking-protection-icon:-moz-lwtheme,
|
||||
#connection-icon:-moz-lwtheme,
|
||||
#extension-icon:-moz-lwtheme {
|
||||
fill: rgba(0,0,0,.6);
|
||||
}
|
||||
|
||||
/* MAIN IDENTITY ICON */
|
||||
|
||||
#identity-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#normal);
|
||||
}
|
||||
|
||||
#identity-box:hover > #identity-icon:not(.no-hover),
|
||||
#identity-box[open=true] > #identity-icon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#hover);
|
||||
}
|
||||
|
||||
#identity-box.grantedPermissions > #identity-icon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#notice);
|
||||
}
|
||||
|
||||
#identity-box.grantedPermissions:hover > #identity-icon:not(.no-hover),
|
||||
#identity-box.grantedPermissions[open=true] > #identity-icon {
|
||||
list-style-image: url(chrome://browser/skin/identity-icon.svg#notice-hover);
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.chromeUI > #identity-icon {
|
||||
list-style-image: url(chrome://branding/content/identity-icons-brand.svg);
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="invalid"] > #identity-box > #identity-icon {
|
||||
|
@ -73,19 +97,11 @@
|
|||
}
|
||||
|
||||
#urlbar[actiontype="searchengine"] > #identity-box > #identity-icon {
|
||||
-moz-image-region: inherit;
|
||||
list-style-image: url(chrome://global/skin/icons/autocomplete-search.svg);
|
||||
-moz-context-properties: fill;
|
||||
fill: GrayText;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
#urlbar[actiontype="extension"] > #identity-box > #identity-icon {
|
||||
-moz-image-region: inherit;
|
||||
list-style-image: url(chrome://browser/skin/addons/addon-install-anchor.svg);
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
/* SHARING ICON */
|
||||
|
@ -133,12 +149,15 @@
|
|||
/* TRACKING PROTECTION ICON */
|
||||
|
||||
#tracking-protection-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#enabled);
|
||||
margin-inline-start: 2px;
|
||||
margin-inline-end: 0;
|
||||
}
|
||||
|
||||
#tracking-protection-icon[state="loaded-tracking-content"] {
|
||||
list-style-image: url(chrome://browser/skin/tracking-protection-16.svg#disabled);
|
||||
}
|
||||
|
||||
#tracking-protection-icon[animate] {
|
||||
transition: margin-left 200ms ease-out, margin-right 200ms ease-out;
|
||||
}
|
||||
|
@ -157,13 +176,38 @@
|
|||
|
||||
/* CONNECTION ICON, EXTENSION ICON */
|
||||
|
||||
#connection-icon, #extension-icon {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
#connection-icon,
|
||||
#extension-icon {
|
||||
margin-inline-start: 2px;
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.verifiedDomain > #connection-icon,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.verifiedIdentity > #connection-icon,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveBlocked > #connection-icon {
|
||||
list-style-image: url(chrome://browser/skin/connection-secure.svg);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.weakCipher > #connection-icon,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContent > #connection-icon,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedDisplayContentLoadedActiveBlocked > #connection-icon,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.certUserOverridden > #connection-icon {
|
||||
list-style-image: url(chrome://browser/skin/connection-mixed-passive-loaded.svg);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.insecureLoginForms > #connection-icon,
|
||||
#urlbar[pageproxystate="valid"] > #identity-box.mixedActiveContent > #connection-icon {
|
||||
list-style-image: url(chrome://browser/skin/connection-mixed-active-loaded.svg);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
#identity-box.extensionPage > #extension-icon {
|
||||
list-style-image: url(chrome://browser/skin/controlcenter/extension.svg);
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/* REMOTE CONTROL ICON */
|
||||
|
||||
#main-window[remotecontrol] #remote-control-icon {
|
||||
|
|
|
@ -3,16 +3,11 @@
|
|||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
class="fieldtext"
|
||||
width="16" height="16" viewBox="0 0 16 16">
|
||||
#include ../icon-colors.inc.svg
|
||||
<style>
|
||||
use:not(:target) {
|
||||
display: none;
|
||||
}
|
||||
use {
|
||||
fill-rule: evenodd;
|
||||
}
|
||||
</style>
|
||||
|
||||
<defs>
|
||||
|
@ -22,18 +17,8 @@
|
|||
<path id="glyph-notice-hover" d="M107.5,202a2.5,2.5,0,1,1,2.5-2.5A2.5,2.5,0,0,1,107.5,202Zm0,1.039a3.5,3.5,0,0,0,1.125-.2,7.124,7.124,0,1,1-4.464-4.464,3.5,3.5,0,0,0-.2,1.125A3.54,3.54,0,0,0,107.5,203.039ZM102,201a1,1,0,1,0,1,1A1,1,0,0,0,102,201Zm1,4a1,1,0,0,0-2,0v3a1,1,0,0,0,2,0v-3Z" transform="translate(-94 -197)"/>
|
||||
</defs>
|
||||
|
||||
<use id="normal" xlink:href="#glyph-normal"/>
|
||||
<use id="hover" xlink:href="#glyph-hover"/>
|
||||
<use id="notice" xlink:href="#glyph-notice"/>
|
||||
<use id="notice-hover" xlink:href="#glyph-notice-hover"/>
|
||||
|
||||
<use class="black" id="normal-black" xlink:href="#glyph-normal"/>
|
||||
<use class="black" id="hover-black" xlink:href="#glyph-hover"/>
|
||||
<use class="black" id="notice-black" xlink:href="#glyph-notice"/>
|
||||
<use class="black" id="notice-hover-black" xlink:href="#glyph-notice-hover"/>
|
||||
|
||||
<use class="white" id="normal-white" xlink:href="#glyph-normal"/>
|
||||
<use class="white" id="hover-white" xlink:href="#glyph-hover"/>
|
||||
<use class="white" id="notice-white" xlink:href="#glyph-notice"/>
|
||||
<use class="white" id="notice-hover-white" xlink:href="#glyph-notice-hover"/>
|
||||
<use fill="context-fill" fill-rule="evenodd" id="normal" xlink:href="#glyph-normal"/>
|
||||
<use fill="context-fill" fill-rule="evenodd" id="hover" xlink:href="#glyph-hover"/>
|
||||
<use fill="context-fill" fill-rule="evenodd" id="notice" xlink:href="#glyph-notice"/>
|
||||
<use fill="context-fill" fill-rule="evenodd" id="notice-hover" xlink:href="#glyph-notice-hover"/>
|
||||
</svg>
|
||||
|
|
До Ширина: | Высота: | Размер: 2.4 KiB После Ширина: | Высота: | Размер: 1.9 KiB |
|
@ -4,7 +4,6 @@
|
|||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
width="16" height="16" viewBox="0 0 16 16">
|
||||
#include ../icon-colors.inc.svg
|
||||
<style>
|
||||
g:not(:target) {
|
||||
display: none;
|
||||
|
@ -35,25 +34,11 @@
|
|||
</defs>
|
||||
|
||||
<g id="enabled">
|
||||
<use class="fieldtext" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout)"/>
|
||||
</g>
|
||||
<g id="enabled-black">
|
||||
<use class="black" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout)"/>
|
||||
</g>
|
||||
<g id="enabled-white">
|
||||
<use class="white" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout)"/>
|
||||
<use fill="context-fill" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout)"/>
|
||||
</g>
|
||||
|
||||
<g id="disabled">
|
||||
<use class="fieldtext" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout-disabled)"/>
|
||||
<use xlink:href="#strike-through-red"/>
|
||||
</g>
|
||||
<g id="disabled-black">
|
||||
<use class="black" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout-disabled)"/>
|
||||
<use xlink:href="#strike-through-red"/>
|
||||
</g>
|
||||
<g id="disabled-white">
|
||||
<use class="white" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout-disabled)"/>
|
||||
<use fill="context-fill" xlink:href="#shape-shield-outer" mask="url(#mask-shield-cutout-disabled)"/>
|
||||
<use xlink:href="#strike-through-red"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
|
До Ширина: | Высота: | Размер: 2.6 KiB После Ширина: | Высота: | Размер: 2.0 KiB |
|
@ -28,7 +28,7 @@
|
|||
* skin/classic/browser/controlcenter/conn-not-secure.svg (../shared/controlcenter/conn-not-secure.svg)
|
||||
* skin/classic/browser/controlcenter/connection.svg (../shared/controlcenter/connection.svg)
|
||||
* skin/classic/browser/controlcenter/mcb-disabled.svg (../shared/controlcenter/mcb-disabled.svg)
|
||||
* skin/classic/browser/controlcenter/extension.svg (../shared/controlcenter/extension.svg)
|
||||
skin/classic/browser/controlcenter/extension.svg (../shared/controlcenter/extension.svg)
|
||||
* skin/classic/browser/controlcenter/permissions.svg (../shared/controlcenter/permissions.svg)
|
||||
* skin/classic/browser/controlcenter/tracking-protection.svg (../shared/controlcenter/tracking-protection.svg)
|
||||
skin/classic/browser/controlcenter/warning-gray.svg (../shared/controlcenter/warning-gray.svg)
|
||||
|
@ -65,14 +65,14 @@
|
|||
skin/classic/browser/heartbeat-star-lit.svg (../shared/heartbeat-star-lit.svg)
|
||||
skin/classic/browser/heartbeat-star-off.svg (../shared/heartbeat-star-off.svg)
|
||||
skin/classic/browser/connection-secure.svg (../shared/identity-block/connection-secure.svg)
|
||||
* skin/classic/browser/connection-mixed-passive-loaded.svg (../shared/identity-block/connection-mixed-passive-loaded.svg)
|
||||
* skin/classic/browser/connection-mixed-active-loaded.svg (../shared/identity-block/connection-mixed-active-loaded.svg)
|
||||
* skin/classic/browser/identity-icon.svg (../shared/identity-block/identity-icon.svg)
|
||||
skin/classic/browser/connection-mixed-passive-loaded.svg (../shared/identity-block/connection-mixed-passive-loaded.svg)
|
||||
skin/classic/browser/connection-mixed-active-loaded.svg (../shared/identity-block/connection-mixed-active-loaded.svg)
|
||||
skin/classic/browser/identity-icon.svg (../shared/identity-block/identity-icon.svg)
|
||||
skin/classic/browser/info.svg (../shared/info.svg)
|
||||
* skin/classic/browser/menuPanel.svg (../shared/menuPanel.svg)
|
||||
* skin/classic/browser/menuPanel-small.svg (../shared/menuPanel-small.svg)
|
||||
* skin/classic/browser/notification-icons.svg (../shared/notification-icons.svg)
|
||||
* skin/classic/browser/tracking-protection-16.svg (../shared/identity-block/tracking-protection-16.svg)
|
||||
skin/classic/browser/tracking-protection-16.svg (../shared/identity-block/tracking-protection-16.svg)
|
||||
skin/classic/browser/newtab/close.png (../shared/newtab/close.png)
|
||||
skin/classic/browser/newtab/controls.svg (../shared/newtab/controls.svg)
|
||||
skin/classic/browser/panel-icons.svg (../shared/panel-icons.svg)
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
# Firefox Developer Tools
|
||||
|
||||
Hello! This documentation is for developers who want to work on the developer tools.
|
||||
**Hello!**
|
||||
|
||||
If you are looking for general docs about how to use the tools, checkout [this MDN page](https://developer.mozilla.org/en-US/docs/Tools) instead.
|
||||
This documentation is for developers who want to work on the developer tools. [Get started here](./getting-started/).
|
||||
|
||||
If you are looking for a getting started guide on the developer tools, all of this information is documented on the [Hacking](https://wiki.mozilla.org/DevTools/Hacking) wiki page.
|
||||
If you are looking for end user documentation, check out [this MDN page](https://developer.mozilla.org/en-US/docs/Tools) instead.
|
||||
|
||||
[GitBook](https://github.com/GitbookIO/gitbook) is used to generate online documentation from the markdown files here.
|
||||
Here is how you can re-generate the book:
|
||||
Happy developing!
|
||||
|
||||
## About this documentation
|
||||
|
||||
This guide is built with MarkDown files and [GitBook](https://github.com/GitbookIO/gitbook).
|
||||
|
||||
The source code for this documentation is distributed with the source code for the tools, in the `docs/` folder.
|
||||
|
||||
If you want to contribute to the documentation, [clone the repository](./getting-started/build.md#getting-the-code), make your changes locally, and then regenerate the book to see how it looks like before submitting a patch:
|
||||
|
||||
```bash
|
||||
# Install GitBook locally
|
||||
|
@ -19,6 +26,8 @@ cd /path/to/mozilla-central/devtools/docs/
|
|||
# Generate the docs and start a local server
|
||||
gitbook serve
|
||||
|
||||
# Or just built the book
|
||||
# You can now navigate to localhost:4000 to see the output
|
||||
|
||||
# Or build the book only (this places the output into `docs/_book`)
|
||||
gitbook build
|
||||
```
|
||||
```
|
||||
|
|
|
@ -1,6 +1,14 @@
|
|||
|
||||
# Summary
|
||||
|
||||
* [Getting started](getting-started/README.md)
|
||||
* [Where is the code?](getting-started/where-is-the-code.md)
|
||||
* [Architecture overview](getting-started/architecture-overview.md)
|
||||
* [Set up to build DevTools](getting-started/build.md)
|
||||
* [Development profiles](getting-started/development-profiles.md)
|
||||
* [Bugs and issue trackers](bugs-issues.md)
|
||||
* [Files and directories](files/README.md)
|
||||
* [Adding New Files](files/adding-files.md)
|
||||
* [Tool Architectures](tools/tools.md)
|
||||
* [Inspector](tools/inspector.md)
|
||||
* [Panel Architecture](tools/inspector-panel.md)
|
||||
|
@ -29,8 +37,6 @@
|
|||
* [Writing Actors With protocol.js](backend/protocol.js.md)
|
||||
* [Registering A New Actor](backend/actor-registration.md)
|
||||
* [Actor Best Practices](backend/actor-best-practices.md)
|
||||
* [Files and directories](files/README.md)
|
||||
* [Adding New Files](files/adding-files.md)
|
||||
* [Automated tests](tests/README.md)
|
||||
* Running tests
|
||||
* [`xpcshell`](tests/xpcshell.md)
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# Bugs and issue trackers
|
||||
|
||||
Since we have code in two different places, issues and bugs are to be found in two different places:
|
||||
|
||||
* For code in `m-c`: [http://firefox-dev.tools/](http://firefox-dev.tools/) which also lets you filter by good bugs for beginners.
|
||||
* For code in `devtools-html`: [this page](https://github.com/search?l=&q=org%3Adevtools-html+state%3Aopen&type=Issues) lists all the issues across the organisation and these are [available issues](https://github.com/search?l=&q=org%3Adevtools-html+state%3Aopen+label%3Aavailable&type=Issues) i.e. ready to be worked on.
|
|
@ -6,7 +6,7 @@ This page provides a very top level overview of what is on each directory in the
|
|||
* `devtools/shared/client`: Code for the [Remote Debugging Protocol](../backend/protocol.md) (RDP) client. You may wonder why this is not in `devtools/client` below: it's mainly because tests in server also need access to the RDP client.
|
||||
* `devtools/shared/locales`: Strings used in either the server only, or shared with both the client and server.
|
||||
* `devtools/server`: Code for the [RDP](../backend/protocol.md) server and transport layer.
|
||||
* `devtools/server/actors`: [RDP Actors](../backend/protocol.md#actors). Note that if you're modifying actors, you may need to worry about [backwards compatibility](../backend/backwards-compatibility.md) with older clients.
|
||||
* `devtools/server/actors`: [RDP Actors](../backend/protocol.md#actors). Note that if you're modifying actors, you may need to worry about [backwards compatibility](../backend/backward-compatibility.md) with older clients.
|
||||
* `devtools/client`: Code for the front-end side of our tools. In theory, each directory corresponds to a panel, but this is not always the case. This directory is only shipped with desktop Firefox, as opposed to other directories above, which are shipped with all Gecko products (Firefox for Android, etc.)
|
||||
* `devtools/client/locales`: Strings used in the client front-end.
|
||||
* `devtools/client/themes`: CSS and images used in the client front-end.
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# Getting started
|
||||
|
||||
1. Learn [where the code is](./getting-started/where-is-the-code.md) and about the [architecture](./getting-started/servers-and-actors.md) of the tools.
|
||||
2. [Set up your machine](./getting-started/build.md) to build the tools, then [configure a development profile](getting-started/development-profiles.md).
|
||||
3. You can now experiment by changing things and rebuilding, look at the [files and directories overview](../files/README.md) or you could also [find something to work on](./bugs-issues.md).
|
||||
|
||||
## Additional documentation
|
||||
|
||||
* [Mozilla Developer Network](http://developer.mozilla.org/) (also known as *MDN*) has a lot of information about XUL elements, HTML, JS, DOM, Web APIs, Gecko-specific APIs, and more.
|
||||
* [DXR](http://dxr.mozilla.org/mozilla-central/source/) is a source code search engine - search for symbols you want to learn about, eg. `nsIDocument`. [Searchfox](http://searchfox.org/mozilla-central/source) is an alternative.
|
||||
|
||||
It is a good idea to [add smart keyword searches](https://support.mozilla.org/en-US/kb/how-search-from-address-bar) for DXR and MDN, so you can search faster.
|
|
@ -0,0 +1,13 @@
|
|||
# Architecture overview
|
||||
|
||||
Broadly speaking, the tools are divided in two parts: the server and the client. A **server** is anything that can be debugged: for example, your browser, but it could also be Firefox for Android, running on another device. The **client** is the front-end side of the tools, and it is what developers interact with when using the tools.
|
||||
|
||||
Since these two parts are decoupled, we can connect to any server using the same client. This enables us to debug multiple types of servers, using the same protocol to communicate.
|
||||
|
||||
You will often hear about `actors`. Each feature that can be debugged (for example, network) is exposed via an `actor`, which provides data about that specific feature. It's up to each server to implement some or all actors; the client needs to find out and decide what it can render on the front-side when it connects to the server. So when we want to debug a new feature, we might need to do work in two parts of the code: the server (perhaps implementing a new actor, or extending existing ones) and the client (to display the debugging data returned by the actor).
|
||||
|
||||
Often, an actor will correspond to a panel. But a panel might want to get data from multiple actors.
|
||||
|
||||
You might also hear about `the toolbox`. The toolbox is what everyone else calls `developer tools` i.e. the front-end that you see when you open the tools in your browser.
|
||||
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
# Set up to build Firefox Developer Tools
|
||||
|
||||
These are the steps we're going to look at:
|
||||
|
||||
* [Getting the code](#getting-the-code)
|
||||
* [using Mercurial](#using-mercurial-hg)
|
||||
* [using Git](#using-git)
|
||||
* [Building and running locally](#building-and-running-locally)
|
||||
* [Rebuilding](#rebuilding)
|
||||
* [Artifact builds](#building-even-faster-with-artifact-builds) for even faster builds
|
||||
* [Maybe you don't even need to build](#maybe-you-dont-even-need-to-build)
|
||||
|
||||
## Getting the code
|
||||
|
||||
The code is officially hosted on [a Mercurial repository](https://hg.mozilla.org/mozilla-central/). Despair not! There are ways of accessing this via git. We will explain this too.
|
||||
|
||||
Either way takes a long time, because the repository is **B I G**. So be prepared to be patient.
|
||||
|
||||
### Using Mercurial (hg)
|
||||
|
||||
```bash
|
||||
hg clone http://hg.mozilla.org/mozilla-central
|
||||
```
|
||||
|
||||
### Using git
|
||||
|
||||
There is a tool called [git-cinnabar](https://github.com/glandium/git-cinnabar/) that lets you use git on top of a Mercurial repository. There's a bit of setup involved, so we've written [a script to automate](https://github.com/sole/cinnabarify) installing `git-cinnabar` and obtaining the code.
|
||||
|
||||
## Building and running locally
|
||||
|
||||
Whatever method you used to obtain the code, the build step is the same. Fortunately, the Firefox team has made a very good job of automating this with bootstrap scripts and putting [documentation](https://developer.mozilla.org/En/Simple_Firefox_build) together.
|
||||
|
||||
Run:
|
||||
|
||||
```bash
|
||||
./mach build
|
||||
```
|
||||
|
||||
If your system needs additional dependencies installed (for example, Python, or a compiler, etc), various diagnostic messages will be printed to your screen. Follow their advice and try building again.
|
||||
|
||||
Building also takes a long time (specially on slow computers).
|
||||
|
||||
**Note:** if using Windows, you might need to type `mach build` instead (without the `./`).
|
||||
|
||||
### Running your own compiled version of Firefox
|
||||
|
||||
To run the Firefox you just compiled:
|
||||
|
||||
```bash
|
||||
./mach run
|
||||
```
|
||||
|
||||
This will run using an empty temporary profile which is discarded when you close the browser. We will look more into [persistent development profiles later](./development-profiles.md).
|
||||
|
||||
### Rebuilding
|
||||
|
||||
Suppose you pulled the latest changes from the remote repository (or made your own changes) and want to build again.
|
||||
|
||||
You can ask the `mach` script to build only changed files:
|
||||
|
||||
```bash
|
||||
./mach build faster
|
||||
```
|
||||
|
||||
This should be faster (a matter of seconds).
|
||||
|
||||
Sometimes, if you haven't updated in a while, you'll be told that you need to *clobber*, or basically delete precompiled stuff and start from scratch, because there are too many changes. The way to do it is:
|
||||
|
||||
```bash
|
||||
./mach clobber
|
||||
./mach build
|
||||
```
|
||||
|
||||
### Building even faster with artifact builds
|
||||
|
||||
If you are *not* going to modify any C/C++ code (which is rare when working on DevTools), you can use artifact builds. This method downloads prebuilt binary components, and then the build process becomes faster.
|
||||
|
||||
Create a file on the root of the repository, called `mozconfig`, with the following content:
|
||||
|
||||
```
|
||||
# Automatically download and use compiled C++ components:
|
||||
ac_add_options --enable-artifact-builds
|
||||
|
||||
# Write build artifacts to:
|
||||
mk_add_options MOZ_OBJDIR=./objdir-frontend
|
||||
```
|
||||
|
||||
And then you can follow the normal build process again (only *faster*!)
|
||||
|
||||
On MacOS you might want to use `MOZ_OBJDIR=./objdir-frontend.noindex` instead. Using the `.noindex` file extension prevents the Spotlight from indexing your `objdir`, which is slow.
|
||||
|
||||
For more information on aspects such as technical limitations of artifact builds, read the [Artifact Builds](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Artifact_builds) page.
|
||||
|
||||
## Maybe you don't even need to build
|
||||
|
||||
Working in DevTools generally involves editing JavaScript files only. This means that often you don't even need to run `./mach build`.
|
||||
|
||||
Instead, what you need to do is to save the files you modified, quit Firefox, and reopen it again to use the recently saved files.
|
||||
|
||||
With pseudocode:
|
||||
|
||||
```
|
||||
# 1. Build
|
||||
./mach build
|
||||
# 2. Run
|
||||
./mach run
|
||||
# 3. you try out things in the browser that opens
|
||||
# 4. fully close the browser, e.g. ⌘Q in MacOS
|
||||
# 5. edit JS files on the `devtools` folder, save
|
||||
# 6. Back to step 2!
|
||||
./mach run
|
||||
```
|
||||
|
||||
While not as fast as the average "save file and reload the website" *web development workflow*, or newer workflows such as React's reloading, this can still be quite fast.
|
||||
|
||||
And certainly faster than building each time, even with artifact builds.
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
# Setting up a development profile
|
||||
|
||||
You can have various [Firefox profiles](https://developer.mozilla.org/en-US/Firefox/Multiple_profiles) (think of something like "user accounts"), each one with different settings, addons, appearance, etc.
|
||||
|
||||
This page will guide you through configuring a new profile to enable development features such as additional logging, dumping of network packets, remote debugging, etc. which will help when working in DevTools.
|
||||
|
||||
Many of these changes are achieved by modifying preferences in `about:config`, a special page you can access by entering that in Firefox's URL bar. The first time, it will show you a warning page. Click through and then you can start searching for preferences to modify.
|
||||
|
||||
Here's [a support article](https://support.mozilla.org/t5/Manage-preferences-and-add-ons/Configuration-Editor-for-Firefox/ta-p/35030) if you need help.
|
||||
|
||||
## Create a permanent profile
|
||||
|
||||
We were using a temporary profile in the previous step, [building DevTools](./build.md). The contents of this profile are deleted each time the browser is closed, which means any preferences we set will not persist.
|
||||
|
||||
The solution is to create a new profile:
|
||||
|
||||
```
|
||||
./mach -P development
|
||||
```
|
||||
|
||||
If this profile doesn't exist yet (quite likely), a window will open offering you options to create a new profile, and asking you which name you want to use. Create a new one, and name it `development`. Then start Firefox by clicking on `Start Nightly`.
|
||||
|
||||
Next time you start Firefox with `./mach -P development`, the new profile will be automatically used, and settings will persist between browser launches.
|
||||
|
||||
## Enable additional logging
|
||||
|
||||
You can change the value of these preferences by going to `about:config`:
|
||||
|
||||
| Preference name | Value | Comments |
|
||||
| --------------- | --------------- | -------- |
|
||||
| `browser.dom.window.dump.enabled` | `true` | Adds global `dump` function to log strings to `stdout` |
|
||||
| `devtools.debugger.log` (*) | `true` | Dump packets sent over remote debugging protocol to `stdout`.<br /><br />The [remote protocol inspector add-on](https://github.com/firebug/rdp-inspector/wiki) might be useful too. |
|
||||
| `devtools.dump.emit` (*) | `true` | Log event notifications from the EventEmitter class<br />(found at `devtools/shared/event-emitter.js`). |
|
||||
|
||||
Preferences marked with a (`*`) also require `browser.dom.window.dump.enabled` in order to work. You might not want to enable *all* of those all the time, as they can cause the output to be way too verbose, but they might be useful if you're working on a server actor, for example<!--TODO link to actors doc-->.
|
||||
|
||||
Restart the browser to apply configuration changes.
|
||||
|
||||
## Enable remote debugging and the Browser Toolbox
|
||||
|
||||
These settings allow you to use the [browser toolbox](https://developer.mozilla.org/docs/Tools/Browser_Toolbox) to inspect the DevTools themselves, set breakpoints inside of DevTools code, and run the [Scratchpad](https://developer.mozilla.org/en-US/docs/Tools/Scratchpad) in the *Browser* environment.
|
||||
|
||||
Open DevTools, and click the "Toolbox Options" gear icon in the top right (the image underneath is outdated). <!--TODO update image-->
|
||||
|
||||
Make sure the following two options are checked:
|
||||
|
||||
- Enable browser chrome and add-on debugging toolboxes
|
||||
- Enable remote debugging
|
||||
|
||||
![Settings for developer tools - "Enable Chrome Debugging" and "Enable Remote Debugging"](../resources/DevToolsDeveloperSettings.png)
|
||||
|
||||
In `about:config`, set `devtools.debugger.prompt-connection` to `false`.
|
||||
|
||||
This will get rid of the prompt displayed every time you open the browser toolbox.
|
||||
|
||||
## Enable DevTools assertions
|
||||
|
||||
When assertions are enabled, assertion failures are fatal, log console warnings, and throw errors.
|
||||
|
||||
When assertions are not enabled, the `assert` function is a no-op.
|
||||
|
||||
It also enables the "debug" builds of certain third party libraries, such as React.
|
||||
|
||||
To enable assertions, add this to your `.mozconfig`:
|
||||
|
||||
```
|
||||
ac_add_options --enable-debug-js-modules
|
||||
```
|
||||
|
||||
And assert your own invariants like this:
|
||||
|
||||
```
|
||||
const { assert } = require("devtools/shared/DevToolsUtils");
|
||||
// ...
|
||||
assert(1 + 1 === 2, "I really hope this is true...");
|
||||
```
|
||||
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Where is the code? (or: `mozilla-central` vs `devtools-html`)
|
||||
|
||||
Most of the code is hosted in the Firefox repository (we call it `mozilla-central`, often abbreviated as `m-c`), in the [devtools](https://dxr.mozilla.org/mozilla-central/source/devtools) folder. Development of newer pieces of the tools is happening in GitHub, on the [devtools-html](https://github.com/devtools-html/) organisation.
|
||||
|
||||
<!--TODO: table listing components and locations (m-c vs github)-->
|
||||
|
||||
Code in `m-c` takes longer to obtain and build, as it involves checking out Firefox's repository and installing tools such as a compiler to build a version of Firefox in your machine.
|
||||
|
||||
On the other hand, the repositories in `devtools-html` are more straightforward if you're used to *the GitHub workflow*: you clone them, and then run `npm install && npm run` or similar. Roughly, you can work with each repository individually, and we periodically generate JavaScript bundles that are then copied into `m-c`.
|
||||
|
||||
Even if you only want to work on a tool whose code is on `devtools-html`, you might still need to go through the step of getting and compiling the code from `mozilla-central` in order to do integration work (such as updating a tool bundle).
|
||||
|
||||
From now on, this guide will focus on building the full DevTools within Firefox. Please refer to individual project instructions for tools hosted in `devtools-html`.
|
||||
|
После Ширина: | Высота: | Размер: 137 KiB |
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"extends": [
|
||||
"plugin:mozilla/recommended",
|
||||
"plugin:mozilla/xpcshell-test",
|
||||
],
|
||||
"plugins": [
|
||||
"mozilla"
|
||||
],
|
||||
"rules": {
|
||||
"brace-style": "off",
|
||||
"no-shadow": "off",
|
||||
}
|
||||
};
|
|
@ -3,6 +3,8 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/* import-globals-from xpcshell-head-parent-process.js */
|
||||
|
||||
function ok(cond, msg) {
|
||||
dump("ok(" + cond + ", \"" + msg + "\")");
|
||||
do_check_true(!!cond, Components.stack.caller);
|
||||
|
|
|
@ -18,7 +18,7 @@ GlobalObjectsComponent.prototype =
|
|||
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
|
||||
|
||||
runTest: function() {
|
||||
runTest() {
|
||||
const name = "Splendid Test";
|
||||
|
||||
let ok = this.ok;
|
||||
|
|
|
@ -13,7 +13,7 @@ this.GlobalObjectsModule = function GlobalObjectsModule() {
|
|||
}
|
||||
|
||||
GlobalObjectsModule.prototype = {
|
||||
runTest: function() {
|
||||
runTest() {
|
||||
const name = "Splendid Test";
|
||||
|
||||
let ok = this.ok;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/* import-globals-from xpcshell-head-parent-process.js */
|
||||
|
||||
function runTest() {
|
||||
const name = "Splendid Test";
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ function* testSteps()
|
|||
request.onerror = expectedErrorHandler("AbortError");
|
||||
txn.abort();
|
||||
try {
|
||||
index.get('foo');
|
||||
index.get("foo");
|
||||
ok(false, "TransactionInactiveError shall be thrown right after a deletion of an index is aborted.");
|
||||
} catch (e) {
|
||||
ok(e instanceof DOMException, "got a database exception");
|
||||
|
@ -66,7 +66,7 @@ function* testSteps()
|
|||
yield undefined;
|
||||
|
||||
try {
|
||||
index.get('foo');
|
||||
index.get("foo");
|
||||
ok(false, "TransactionInactiveError shall be thrown after the transaction is inactive.");
|
||||
} catch (e) {
|
||||
ok(e instanceof DOMException, "got a database exception");
|
||||
|
|
|
@ -52,7 +52,7 @@ function* testSteps()
|
|||
request.onerror = expectedErrorHandler("AbortError");
|
||||
txn.abort();
|
||||
try {
|
||||
objectStore.get('foo');
|
||||
objectStore.get("foo");
|
||||
ok(false, "TransactionInactiveError shall be thrown if the transaction is inactive.");
|
||||
} catch (e) {
|
||||
ok(e instanceof DOMException, "got a database exception");
|
||||
|
@ -62,7 +62,7 @@ function* testSteps()
|
|||
yield undefined;
|
||||
|
||||
try {
|
||||
objectStore.get('foo');
|
||||
objectStore.get("foo");
|
||||
ok(false, "TransactionInactiveError shall be thrown if the transaction is inactive.");
|
||||
} catch (e) {
|
||||
ok(e instanceof DOMException, "got a database exception");
|
||||
|
|
|
@ -14,7 +14,6 @@ function* testSteps()
|
|||
openRequest.onsuccess = unexpectedSuccessHandler;
|
||||
let event = yield undefined;
|
||||
let db = event.target.result;
|
||||
let trans = event.target.transaction;
|
||||
|
||||
for (let autoincrement of [true, false]) {
|
||||
for (let keypath of [false, true, "missing", "invalid"]) {
|
||||
|
@ -36,11 +35,11 @@ function* testSteps()
|
|||
{ autoIncrement: autoincrement,
|
||||
keyPath: (keypath ? "id" : null) });
|
||||
|
||||
test = " for test " + JSON.stringify({ autoincrement: autoincrement,
|
||||
keypath: keypath,
|
||||
method: method,
|
||||
explicit: explicit === undefined ? "undefined" : explicit,
|
||||
existing: existing });
|
||||
let test = " for test " + JSON.stringify({ autoincrement,
|
||||
keypath,
|
||||
method,
|
||||
explicit: explicit === undefined ? "undefined" : explicit,
|
||||
existing });
|
||||
|
||||
// Insert "existing" data if needed
|
||||
if (existing) {
|
||||
|
@ -64,7 +63,7 @@ function* testSteps()
|
|||
}
|
||||
|
||||
// Which arguments are passed to function
|
||||
args = [value];
|
||||
let args = [value];
|
||||
if (explicit === true) {
|
||||
args.push(5);
|
||||
}
|
||||
|
@ -138,7 +137,7 @@ function* testSteps()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function expectedResult(method, keypath, explicit, autoincrement, existing) {
|
||||
if (keypath && explicit)
|
||||
return "throw";
|
||||
|
|
|
@ -202,13 +202,13 @@ function* testSteps()
|
|||
// Test separate transactions doesn't generate overlapping numbers
|
||||
test = " for test non-overlapping counts";
|
||||
trans = db.transaction("store1", RW);
|
||||
trans2 = db.transaction("store1", RW);
|
||||
let trans2 = db.transaction("store1", RW);
|
||||
trans2.objectStore("store1").put({ over: 2 }).onsuccess =
|
||||
genCheck(c1 + 1, { over: 2 }, "first" + test,
|
||||
{ trans: trans2 });
|
||||
trans.objectStore("store1").put({ over: 1 }).onsuccess =
|
||||
genCheck(c1, { over: 1 }, "second" + test,
|
||||
{ trans: trans });
|
||||
{ trans });
|
||||
c1 += 2;
|
||||
yield undefined; yield undefined;
|
||||
|
||||
|
@ -219,7 +219,7 @@ function* testSteps()
|
|||
{ trans: trans2 });
|
||||
trans.objectStore("store2").put({ over: 1 }).onsuccess =
|
||||
genCheck(c2, { over: 1, id: c2 }, "fourth" + test,
|
||||
{ trans: trans });
|
||||
{ trans });
|
||||
c2 += 2;
|
||||
yield undefined; yield undefined;
|
||||
|
||||
|
|
|
@ -17,9 +17,9 @@ function* testSteps()
|
|||
|
||||
let objectStore = db.createObjectStore("foo", { keyPath: "id",
|
||||
autoIncrement: true });
|
||||
objectStore.createIndex("first","first");
|
||||
objectStore.createIndex("second","second");
|
||||
objectStore.createIndex("third","third");
|
||||
objectStore.createIndex("first", "first");
|
||||
objectStore.createIndex("second", "second");
|
||||
objectStore.createIndex("third", "third");
|
||||
|
||||
let data = { first: "foo", second: "foo", third: "foo" };
|
||||
|
||||
|
@ -39,17 +39,17 @@ function* testSteps()
|
|||
first.get("foo").onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
is (event.target.result.id, 1, "Entry in first");
|
||||
is(event.target.result.id, 1, "Entry in first");
|
||||
|
||||
second.get("foo").onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
is (event.target.result.id, 1, "Entry in second");
|
||||
is(event.target.result.id, 1, "Entry in second");
|
||||
|
||||
third.get("foo").onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
is (event.target.result.id, 1, "Entry in third");
|
||||
is(event.target.result.id, 1, "Entry in third");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ function* testSteps()
|
|||
|
||||
info("Creating temp file");
|
||||
|
||||
SpecialPowers.createFiles([{data:fileData, options:{type:fileType}}], function (files) {
|
||||
SpecialPowers.createFiles([{data: fileData, options: {type: fileType}}], function(files) {
|
||||
testGenerator.next(files[0]);
|
||||
});
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ function* testSteps()
|
|||
|
||||
let request = indexedDB.openForPrincipal(getPrincipal(spec), name);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
request.onsuccess = unexpectedSuccessHandler;
|
||||
|
||||
yield undefined;
|
||||
|
@ -99,7 +99,7 @@ function* testSteps()
|
|||
j = 1;
|
||||
|
||||
trans = db.transaction(objectStoreName, "cleanup");
|
||||
trans.onabort = unexpectedSuccessHandler;;
|
||||
trans.onabort = unexpectedSuccessHandler;
|
||||
trans.oncomplete = grabEventAndContinueHandler;
|
||||
|
||||
yield undefined;
|
||||
|
@ -124,7 +124,7 @@ function* testSteps()
|
|||
let trans = db.transaction(objectStoreName, "cleanup");
|
||||
trans.objectStore(objectStoreName).delete(1);
|
||||
|
||||
trans.onabort = unexpectedSuccessHandler;;
|
||||
trans.onabort = unexpectedSuccessHandler;
|
||||
trans.oncomplete = grabEventAndContinueHandler;
|
||||
|
||||
yield undefined;
|
||||
|
|
|
@ -35,7 +35,7 @@ function* testSteps()
|
|||
{ keyPath: "foo.", exception: true },
|
||||
{ keyPath: "fo o", exception: true },
|
||||
{ keyPath: "foo ", exception: true },
|
||||
{ keyPath: "foo[bar]",exception: true },
|
||||
{ keyPath: "foo[bar]", exception: true },
|
||||
{ keyPath: "foo[1]", exception: true },
|
||||
{ keyPath: "$('id').stuff", exception: true },
|
||||
{ keyPath: "foo.2.bar", exception: true },
|
||||
|
@ -100,7 +100,7 @@ function* testSteps()
|
|||
let store = stores[indexName];
|
||||
|
||||
try {
|
||||
request = store.add(info.value);
|
||||
var request = store.add(info.value);
|
||||
ok("key" in info, "successfully created request to insert value" + test);
|
||||
} catch (e) {
|
||||
ok(!("key" in info), "threw when attempted to insert" + test);
|
||||
|
@ -143,7 +143,7 @@ function* testSteps()
|
|||
eval("newValue." + destProp + " = 'newKeyValue'");
|
||||
}
|
||||
else {
|
||||
newValue = 'newKeyValue';
|
||||
newValue = "newKeyValue";
|
||||
}
|
||||
let didThrow;
|
||||
try {
|
||||
|
@ -185,18 +185,18 @@ function* testSteps()
|
|||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let index = indexes[indexName];
|
||||
|
||||
request = store.add(info.value, 1);
|
||||
if ("key" in info) {
|
||||
index.getKey(info.key).onsuccess = grabEventAndContinueHandler;
|
||||
e = yield undefined;
|
||||
let e = yield undefined;
|
||||
is(e.target.result, 1, "found value when reading" + test);
|
||||
}
|
||||
else {
|
||||
index.count().onsuccess = grabEventAndContinueHandler;
|
||||
e = yield undefined;
|
||||
let e = yield undefined;
|
||||
is(e.target.result, 0, "should be empty" + test);
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ function* testSteps()
|
|||
store.add(info.v);
|
||||
ok(false, "should throw" + test);
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "did throw" + test);
|
||||
ok(e instanceof DOMException, "Got a DOMException" + test);
|
||||
is(e.name, "DataError", "expect a DataError" + test);
|
||||
|
|
|
@ -38,7 +38,7 @@ function* testSteps()
|
|||
request = objectStore.createIndex("Hola");
|
||||
ok(false, "createIndex with no keyPath should throw");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "createIndex with no keyPath should throw");
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ function* testSteps()
|
|||
try {
|
||||
objectStore.createIndex("Hola", ["foo"], { multiEntry: true });
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ex = e;
|
||||
}
|
||||
ok(ex, "createIndex with array keyPath and multiEntry should throw");
|
||||
|
@ -58,7 +58,7 @@ function* testSteps()
|
|||
objectStore.createIndex("foo", "bar", 10);
|
||||
ok(false, "createIndex with bad options should throw");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "createIndex with bad options threw");
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ function* testSteps()
|
|||
request = objectStore.createIndex("Hola");
|
||||
ok(false, "createIndex with no keyPath should throw");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "createIndex with no keyPath should throw");
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ function* testSteps()
|
|||
try {
|
||||
objectStore.createIndex("Hola", ["foo"], { multiEntry: true });
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ex = e;
|
||||
}
|
||||
ok(ex, "createIndex with array keyPath and multiEntry should throw");
|
||||
|
@ -59,7 +59,7 @@ function* testSteps()
|
|||
objectStore.createIndex("foo", "bar", 10);
|
||||
ok(false, "createIndex with bad options should throw");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "createIndex with bad options threw");
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ function* testSteps()
|
|||
db.createObjectStore("foo", "bar");
|
||||
ok(false, "createObjectStore with bad options should throw");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "createObjectStore with bad options");
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ function* testSteps()
|
|||
is(objectStore.keyPath, info.options && info.options.keyPath ?
|
||||
info.options.keyPath : null,
|
||||
"Bad keyPath");
|
||||
if(objectStore.indexNames.length, 0, "Bad indexNames");
|
||||
if (objectStore.indexNames.length, 0, "Bad indexNames");
|
||||
|
||||
ok(event.target.transaction, "event has a transaction");
|
||||
ok(event.target.transaction.db === db, "transaction has the right db");
|
||||
|
@ -104,7 +104,7 @@ function* testSteps()
|
|||
try {
|
||||
db.createObjectStore("storefail", { keyPath: "", autoIncrement: true });
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ex = e;
|
||||
}
|
||||
ok(ex, "createObjectStore with empty keyPath and autoIncrement should throw");
|
||||
|
@ -116,7 +116,7 @@ function* testSteps()
|
|||
try {
|
||||
db.createObjectStore("storefail", { keyPath: ["a"], autoIncrement: true });
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ex = e;
|
||||
}
|
||||
ok(ex, "createObjectStore with array keyPath and autoIncrement should throw");
|
||||
|
|
|
@ -26,11 +26,11 @@ function* testSteps()
|
|||
let info = objectStoreInfo[i];
|
||||
|
||||
ok(true, "1");
|
||||
request = indexedDB.open(name, i + 1);
|
||||
let request = indexedDB.open(name, i + 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
let event = yield undefined;
|
||||
|
||||
let db = event.target.result;
|
||||
|
||||
|
@ -95,4 +95,3 @@ function* testSteps()
|
|||
|
||||
finishTest();
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
ok(!event.target.result, "No results");
|
||||
testGenerator.next();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
ok(!event.target.result, "No results");
|
||||
testGenerator.next();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
ok(!event.target.result, "No results");
|
||||
testGenerator.next();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
ok(!event.target.result, "No results");
|
||||
testGenerator.next();
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
|
@ -119,7 +119,7 @@ function* testSteps()
|
|||
let range = IDBKeyRange.bound(2000, "q");
|
||||
request = objectStore.openCursor(range);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
|
@ -146,7 +146,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
|
@ -164,7 +164,7 @@ function* testSteps()
|
|||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex += keyIndex ? 1: 6;
|
||||
keyIndex += keyIndex ? 1 : 6;
|
||||
}
|
||||
else {
|
||||
testGenerator.next();
|
||||
|
@ -178,7 +178,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
|
@ -196,7 +196,7 @@ function* testSteps()
|
|||
is(cursor.primaryKey, sortedKeys[keyIndex], "Correct primary key");
|
||||
is(cursor.value, "foo", "Correct value");
|
||||
|
||||
keyIndex += keyIndex ? 1: 3;
|
||||
keyIndex += keyIndex ? 1 : 3;
|
||||
}
|
||||
else {
|
||||
testGenerator.next();
|
||||
|
@ -210,7 +210,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, sortedKeys[keyIndex], "Correct key");
|
||||
|
@ -244,7 +244,7 @@ function* testSteps()
|
|||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
let storedCursor = null;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
storedCursor = cursor;
|
||||
|
@ -291,12 +291,11 @@ function* testSteps()
|
|||
keyIndex = 0;
|
||||
|
||||
let gotRemoveEvent = false;
|
||||
let retval = false;
|
||||
|
||||
request = objectStore.openCursor(null, "next");
|
||||
request.onerror = errorHandler;
|
||||
storedCursor = null;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
storedCursor = cursor;
|
||||
|
@ -346,7 +345,7 @@ function* testSteps()
|
|||
request = objectStore.openCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
storedCursor = null;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
storedCursor = cursor;
|
||||
|
|
|
@ -71,7 +71,7 @@ function* testSteps()
|
|||
testInvalidStateError(db, txn);
|
||||
|
||||
info("#2: Verifying IDBDatabase.onclose && IDBTransaction.onerror " +
|
||||
"in *write* operation after cleared by the agent.");
|
||||
"in *write* operation after cleared by the agent.");
|
||||
openRequest = indexedDB.open(name, 1);
|
||||
openRequest.onerror = errorHandler;
|
||||
openRequest.onsuccess = unexpectedSuccessHandler;
|
||||
|
@ -100,7 +100,7 @@ function* testSteps()
|
|||
objectStore = txn.objectStore("store");
|
||||
|
||||
let objectId = 0;
|
||||
while(true) {
|
||||
while (true) {
|
||||
let addRequest = objectStore.add({foo: "foo"}, objectId);
|
||||
addRequest.onerror = function(event) {
|
||||
info("addRequest.onerror, objectId: " + objectId);
|
||||
|
@ -166,7 +166,7 @@ function* testSteps()
|
|||
// during testing.
|
||||
let numberOfObjects = 3000;
|
||||
objectId = 0;
|
||||
while(true) {
|
||||
while (true) {
|
||||
let addRequest = objectStore.add({foo: "foo"});
|
||||
addRequest.onsuccess = function() {
|
||||
objectId++;
|
||||
|
@ -215,7 +215,7 @@ function* testSteps()
|
|||
continueToNextStep();
|
||||
});
|
||||
|
||||
readRequestError = yield undefined;
|
||||
let readRequestError = yield undefined;
|
||||
if (readRequestError) {
|
||||
txn.onerror = grabEventAndContinueHandler;
|
||||
|
||||
|
|
|
@ -99,12 +99,10 @@ function* testSteps()
|
|||
request = indexedDB.openForPrincipal(principal, params.dbName,
|
||||
params.dbOptions);
|
||||
}
|
||||
} else if ("dbVersion" in params) {
|
||||
request = indexedDB.open(params.dbName, params.dbVersion);
|
||||
} else {
|
||||
if ("dbVersion" in params) {
|
||||
request = indexedDB.open(params.dbName, params.dbVersion);
|
||||
} else {
|
||||
request = indexedDB.open(params.dbName, params.dbOptions);
|
||||
}
|
||||
request = indexedDB.open(params.dbName, params.dbOptions);
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ function* testSteps()
|
|||
db2.close();
|
||||
db.onversionchange = unexpectedSuccessHandler;
|
||||
db2.onversionchange = unexpectedSuccessHandler;
|
||||
};
|
||||
}
|
||||
|
||||
// The IDB spec doesn't guarantee the order that onversionchange will fire
|
||||
// on the dbs.
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
/* import-globals-from ../file.js */
|
||||
|
||||
var disableWorkerTest = "FileHandle doesn't work in workers yet";
|
||||
|
||||
var testGenerator = testSteps();
|
||||
|
|
|
@ -17,6 +17,7 @@ function* testSteps()
|
|||
}
|
||||
|
||||
// Test for IDBKeyRange and indexedDB availability in JS modules.
|
||||
/* import-globals-from GlobalObjectsModule.jsm */
|
||||
Cu.import(getSpec("GlobalObjectsModule.jsm"));
|
||||
let test = new GlobalObjectsModule();
|
||||
test.ok = ok;
|
||||
|
|
|
@ -41,8 +41,6 @@ function* testSteps()
|
|||
req.onsuccess = grabEventAndContinueHandler;
|
||||
let event = yield undefined;
|
||||
|
||||
let dbA = event.target.result;
|
||||
|
||||
// Keep at least one factory operation alive by deleting a database that is
|
||||
// stil open.
|
||||
req = indexedDB.open("foo-b", 1);
|
||||
|
@ -50,8 +48,6 @@ function* testSteps()
|
|||
req.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
let dbB = event.target.result;
|
||||
|
||||
indexedDB.deleteDatabase("foo-b");
|
||||
|
||||
// Create a database which we will later try to open while maintenance is
|
||||
|
|
|
@ -45,12 +45,12 @@ function* testSteps()
|
|||
|
||||
let trans = db.transaction("data", "readwrite");
|
||||
objectStore = trans.objectStore("data");
|
||||
index = objectStore.index("set");
|
||||
let index = objectStore.index("set");
|
||||
|
||||
request = index.get("bar");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
|
||||
|
||||
event = yield undefined;
|
||||
|
||||
is(event.target.result, "bar", "Got correct result");
|
||||
|
@ -64,7 +64,7 @@ function* testSteps()
|
|||
request = index.get("foopy");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
|
||||
|
||||
event = yield undefined;
|
||||
|
||||
is(event.target.result, "foopy", "Got correct result");
|
||||
|
|
|
@ -25,23 +25,6 @@ function* testSteps()
|
|||
{ name: "weight", keyPath: "weight", options: { unique: false } }
|
||||
];
|
||||
|
||||
const objectStoreDataNameSort = [
|
||||
{ key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7737", value: { name: "Pat", height: 65 } },
|
||||
{ key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } },
|
||||
{ key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } }
|
||||
];
|
||||
|
||||
const objectStoreDataWeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
|
||||
{ key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } }
|
||||
];
|
||||
|
||||
const objectStoreDataHeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
|
||||
|
|
|
@ -25,23 +25,6 @@ function* testSteps()
|
|||
{ name: "weight", keyPath: "weight", options: { unique: false } }
|
||||
];
|
||||
|
||||
const objectStoreDataNameSort = [
|
||||
{ key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7737", value: { name: "Pat", height: 65 } },
|
||||
{ key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } },
|
||||
{ key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } }
|
||||
];
|
||||
|
||||
const objectStoreDataWeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "Bob", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
|
||||
{ key: "237-23-7736", value: { name: "Joe", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7734", value: { name: "Ron", height: 73, weight: 180 } }
|
||||
];
|
||||
|
||||
const objectStoreDataHeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "Ann", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7735", value: { name: "Sue", height: 58, weight: 130 } },
|
||||
|
|
|
@ -40,9 +40,9 @@ function* testSteps()
|
|||
objectStoreInfo.options);
|
||||
for (let indexIndex in indexData) {
|
||||
const indexInfo = indexData[indexIndex];
|
||||
let index = objectStore.createIndex(indexInfo.name,
|
||||
indexInfo.keyPath,
|
||||
indexInfo.options);
|
||||
objectStore.createIndex(indexInfo.name,
|
||||
indexInfo.keyPath,
|
||||
indexInfo.options);
|
||||
}
|
||||
}
|
||||
yield undefined;
|
||||
|
|
|
@ -21,14 +21,14 @@ function* testSteps()
|
|||
for (let autoIncrement of [false, true]) {
|
||||
let objectStore =
|
||||
db.createObjectStore(autoIncrement, { keyPath: "id",
|
||||
autoIncrement: autoIncrement });
|
||||
autoIncrement });
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
objectStore.add({ id: i, index: i });
|
||||
}
|
||||
|
||||
for (let unique of [false, true]) {
|
||||
objectStore.createIndex(unique, "index", { unique: unique });
|
||||
objectStore.createIndex(unique, "index", { unique });
|
||||
}
|
||||
|
||||
for (let i = 10; i < 20; i++) {
|
||||
|
|
|
@ -125,7 +125,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -158,7 +158,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("weight").openKeyCursor(null, "next");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
|
||||
|
@ -198,7 +198,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -230,7 +230,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -256,7 +256,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -282,7 +282,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -308,7 +308,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -334,7 +334,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -360,7 +360,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -386,7 +386,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -412,7 +412,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -438,7 +438,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -463,7 +463,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -514,7 +514,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -566,7 +566,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -618,7 +618,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -670,7 +670,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -722,7 +722,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -774,7 +774,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -827,7 +827,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openKeyCursor(keyRange, "next");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -854,7 +854,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openKeyCursor(keyRange,
|
||||
"nextunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -879,7 +879,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openKeyCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -905,7 +905,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openKeyCursor(null,
|
||||
"prevunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -934,7 +934,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openCursor(keyRange, "next");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -971,7 +971,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openCursor(keyRange,
|
||||
"nextunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -1006,7 +1006,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -1042,7 +1042,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openCursor(null,
|
||||
"prevunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -1080,7 +1080,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -1118,7 +1118,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -1151,7 +1151,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -1209,7 +1209,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
|
|
@ -87,7 +87,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("weight").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
|
||||
|
@ -110,7 +110,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
keyIndex++;
|
||||
|
|
|
@ -105,7 +105,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("type").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataTypeSort[keyIndex].value.type,
|
||||
|
@ -138,7 +138,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("length").openKeyCursor(null, "next");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataLengthSort[keyIndex].value.length,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
var testGenerator = testSteps();
|
||||
var testGenerator = testSteps();
|
||||
|
||||
function* testSteps()
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ function* testSteps()
|
|||
}
|
||||
|
||||
try {
|
||||
objectStore.add({id:5}, 5);
|
||||
objectStore.add({id: 5}, 5);
|
||||
ok(false, "add with inline key and passed key should throw!");
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -156,28 +156,28 @@ function* testSteps()
|
|||
|
||||
key1 = 10;
|
||||
|
||||
request = objectStore.add({id:key1});
|
||||
request = objectStore.add({id: key1});
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
is(event.target.result, key1, "add gave back the same key");
|
||||
|
||||
request = objectStore.put({id:10});
|
||||
request = objectStore.put({id: 10});
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
is(event.target.result, key1, "put gave back the same key");
|
||||
|
||||
request = objectStore.put({id:10});
|
||||
request = objectStore.put({id: 10});
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
||||
is(event.target.result, key1, "put gave back the same key");
|
||||
|
||||
request = objectStore.add({id:10});
|
||||
request = objectStore.add({id: 10});
|
||||
request.addEventListener("error", new ExpectError("ConstraintError", true));
|
||||
request.onsuccess = unexpectedSuccessHandler;
|
||||
event = yield undefined;
|
||||
|
@ -224,7 +224,7 @@ function* testSteps()
|
|||
|
||||
key1 = event.target.result;
|
||||
|
||||
request = objectStore.put({id:key1});
|
||||
request = objectStore.put({id: key1});
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
@ -233,7 +233,7 @@ function* testSteps()
|
|||
|
||||
key2 = 10;
|
||||
|
||||
request = objectStore.put({id:key2});
|
||||
request = objectStore.put({id: key2});
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
event = yield undefined;
|
||||
|
@ -265,7 +265,7 @@ function* testSteps()
|
|||
}
|
||||
|
||||
try {
|
||||
objectStore.add({id:5}, 5);
|
||||
objectStore.add({id: 5}, 5);
|
||||
ok(false, "add with inline key and passed key should throw!");
|
||||
}
|
||||
catch (e) {
|
||||
|
|
|
@ -8,9 +8,6 @@ var testGenerator = testSteps();
|
|||
function* testSteps()
|
||||
{
|
||||
const dbname = this.window ? window.location.pathname : "Splendid Test";
|
||||
const RW = "readwrite"
|
||||
let c1 = 1;
|
||||
let c2 = 1;
|
||||
|
||||
let openRequest = indexedDB.open(dbname, 1);
|
||||
openRequest.onerror = errorHandler;
|
||||
|
@ -18,14 +15,13 @@ function* testSteps()
|
|||
openRequest.onsuccess = unexpectedSuccessHandler;
|
||||
let event = yield undefined;
|
||||
let db = event.target.result;
|
||||
let trans = event.target.transaction;
|
||||
|
||||
// Create test stores
|
||||
let store = db.createObjectStore("store");
|
||||
|
||||
// Test simple inserts
|
||||
var keys = [
|
||||
-1/0,
|
||||
-1 / 0,
|
||||
-1.7e308,
|
||||
-10000,
|
||||
-2,
|
||||
|
@ -40,7 +36,7 @@ function* testSteps()
|
|||
2,
|
||||
10000,
|
||||
1.7e308,
|
||||
1/0,
|
||||
1 / 0,
|
||||
new Date("1750-01-02"),
|
||||
new Date("1800-12-31T12:34:56.001"),
|
||||
new Date(-1000),
|
||||
|
@ -113,7 +109,7 @@ function* testSteps()
|
|||
"\uFFFF\x00",
|
||||
"\uFFFFZZZ",
|
||||
[],
|
||||
[-1/0],
|
||||
[-1 / 0],
|
||||
[-1],
|
||||
[0],
|
||||
[1],
|
||||
|
@ -142,8 +138,8 @@ function* testSteps()
|
|||
["x", [[]]],
|
||||
["x", [[[]]]],
|
||||
[[]],
|
||||
[[],"foo"],
|
||||
[[],[]],
|
||||
[[], "foo"],
|
||||
[[], []],
|
||||
[[[]]],
|
||||
[[[]], []],
|
||||
[[[]], [[]]],
|
||||
|
@ -158,12 +154,12 @@ function* testSteps()
|
|||
is(indexedDB.cmp(keyI, keyI), 0, i + " compared to self");
|
||||
|
||||
function doCompare(keyI) {
|
||||
for (var j = i-1; j >= i-10 && j >= 0; --j) {
|
||||
for (var j = i - 1; j >= i - 10 && j >= 0; --j) {
|
||||
is(indexedDB.cmp(keyI, keys[j]), 1, i + " compared to " + j);
|
||||
is(indexedDB.cmp(keys[j], keyI), -1, j + " compared to " + i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
doCompare(keyI);
|
||||
store.add(i, keyI).onsuccess = function(e) {
|
||||
is(indexedDB.cmp(e.target.result, keyI), 0,
|
||||
|
@ -171,7 +167,7 @@ function* testSteps()
|
|||
ok(compareKeys(e.target.result, keyI),
|
||||
"Returned key should actually be equal");
|
||||
};
|
||||
|
||||
|
||||
// Test that -0 compares the same as 0
|
||||
if (keyI === 0) {
|
||||
doCompare(-0);
|
||||
|
@ -204,7 +200,7 @@ function* testSteps()
|
|||
event = yield undefined;
|
||||
is(event.target.result, null, "no more results expected");
|
||||
|
||||
var nan = 0/0;
|
||||
var nan = 0 / 0;
|
||||
var invalidKeys = [
|
||||
nan,
|
||||
undefined,
|
||||
|
@ -230,13 +226,13 @@ function* testSteps()
|
|||
[1, [/x/]],
|
||||
[1, [{}]],
|
||||
];
|
||||
|
||||
|
||||
for (i = 0; i < invalidKeys.length; ++i) {
|
||||
try {
|
||||
indexedDB.cmp(invalidKeys[i], 1);
|
||||
ok(false, "didn't throw");
|
||||
}
|
||||
catch(ex) {
|
||||
catch (ex) {
|
||||
ok(ex instanceof DOMException, "Threw DOMException");
|
||||
is(ex.name, "DataError", "Threw right DOMException");
|
||||
is(ex.code, 0, "Threw with right code");
|
||||
|
@ -245,7 +241,7 @@ function* testSteps()
|
|||
indexedDB.cmp(1, invalidKeys[i]);
|
||||
ok(false, "didn't throw2");
|
||||
}
|
||||
catch(ex) {
|
||||
catch (ex) {
|
||||
ok(ex instanceof DOMException, "Threw DOMException2");
|
||||
is(ex.name, "DataError", "Threw right DOMException2");
|
||||
is(ex.code, 0, "Threw with right code2");
|
||||
|
@ -254,7 +250,7 @@ function* testSteps()
|
|||
store.put(1, invalidKeys[i]);
|
||||
ok(false, "didn't throw3");
|
||||
}
|
||||
catch(ex) {
|
||||
catch (ex) {
|
||||
ok(ex instanceof DOMException, "Threw DOMException3");
|
||||
is(ex.name, "DataError", "Threw right DOMException3");
|
||||
is(ex.code, 0, "Threw with right code3");
|
||||
|
|
|
@ -25,23 +25,6 @@ function* testSteps()
|
|||
{ name: "weight", keyPath: "weight", options: { unique: false, locale: true } }
|
||||
];
|
||||
|
||||
const objectStoreDataNameSort = [
|
||||
{ key: "237-23-7733", value: { name: "ana", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "\u00E1na", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7736", value: { name: "bob", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7737", value: { name: "\u00E9ason", height: 65 } },
|
||||
{ key: "237-23-7734", value: { name: "fabio", height: 73, weight: 180 } },
|
||||
{ key: "237-23-7735", value: { name: "\u00F3scar", height: 58, weight: 130 } }
|
||||
];
|
||||
|
||||
const objectStoreDataWeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "ana", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "\u00E1na", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7735", value: { name: "\u00F3scar", height: 58, weight: 130 } },
|
||||
{ key: "237-23-7736", value: { name: "bob", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7734", value: { name: "fabio", height: 73, weight: 180 } }
|
||||
];
|
||||
|
||||
const objectStoreDataHeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "ana", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7735", value: { name: "\u00F3scar", height: 58, weight: 130 } },
|
||||
|
|
|
@ -25,23 +25,6 @@ function* testSteps()
|
|||
{ name: "weight", keyPath: "weight", options: { unique: false, locale: true } }
|
||||
];
|
||||
|
||||
const objectStoreDataNameSort = [
|
||||
{ key: "237-23-7733", value: { name: "ana", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "\u00E1na", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7736", value: { name: "bob", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7737", value: { name: "\u00E9ason", height: 65 } },
|
||||
{ key: "237-23-7734", value: { name: "fabio", height: 73, weight: 180 } },
|
||||
{ key: "237-23-7735", value: { name: "\u00F3scar", height: 58, weight: 130 } }
|
||||
];
|
||||
|
||||
const objectStoreDataWeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "ana", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7732", value: { name: "\u00E1na", height: 60, weight: 120 } },
|
||||
{ key: "237-23-7735", value: { name: "\u00F3scar", height: 58, weight: 130 } },
|
||||
{ key: "237-23-7736", value: { name: "bob", height: 65, weight: 150 } },
|
||||
{ key: "237-23-7734", value: { name: "fabio", height: 73, weight: 180 } }
|
||||
];
|
||||
|
||||
const objectStoreDataHeightSort = [
|
||||
{ key: "237-23-7733", value: { name: "ana", height: 52, weight: 110 } },
|
||||
{ key: "237-23-7735", value: { name: "\u00F3scar", height: 58, weight: 130 } },
|
||||
|
|
|
@ -132,7 +132,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -165,7 +165,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("weight").openKeyCursor(null, "next");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataWeightSort[keyIndex].value.weight,
|
||||
|
@ -205,7 +205,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -237,7 +237,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -263,7 +263,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -289,7 +289,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -315,7 +315,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -341,7 +341,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -367,7 +367,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -393,7 +393,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -419,7 +419,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -445,7 +445,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -470,7 +470,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -521,7 +521,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -573,7 +573,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -625,7 +625,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -677,7 +677,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -729,7 +729,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange);
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -781,7 +781,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor(keyRange, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -834,7 +834,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openKeyCursor(keyRange, "next");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -861,7 +861,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openKeyCursor(keyRange,
|
||||
"nextunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -886,7 +886,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openKeyCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -912,7 +912,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openKeyCursor(null,
|
||||
"prevunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -941,7 +941,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openCursor(keyRange, "next");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -978,7 +978,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openCursor(keyRange,
|
||||
"nextunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -1013,7 +1013,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("height").openCursor(null, "prev");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -1049,7 +1049,7 @@ function* testSteps()
|
|||
request = objectStore.index("height").openCursor(null,
|
||||
"prevunique");
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataHeightSort[keyIndex].value.height,
|
||||
|
@ -1087,7 +1087,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -1125,7 +1125,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openKeyCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -1158,7 +1158,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
@ -1216,7 +1216,7 @@ function* testSteps()
|
|||
|
||||
request = objectStore.index("name").openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
let cursor = event.target.result;
|
||||
if (cursor) {
|
||||
is(cursor.key, objectStoreDataNameSort[keyIndex].value.name,
|
||||
|
|
|
@ -179,7 +179,7 @@ function* testSteps()
|
|||
txn.onerror = expectedErrorHandler("AbortError");
|
||||
txn.onabort = grabEventAndContinueHandler;
|
||||
|
||||
let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions);
|
||||
db.createObjectStore(objectStoreName, objectStoreOptions);
|
||||
|
||||
request.onupgradeneeded = unexpectedSuccessHandler;
|
||||
event = yield undefined;
|
||||
|
@ -236,7 +236,7 @@ function* testSteps()
|
|||
txn.onabort = grabEventAndContinueHandler;
|
||||
|
||||
objectStore = event.target.transaction.objectStore(objectStoreName);
|
||||
let index = objectStore.createIndex(indexName, indexName, indexOptions);
|
||||
objectStore.createIndex(indexName, indexName, indexOptions);
|
||||
|
||||
request.onupgradeneeded = unexpectedSuccessHandler;
|
||||
event = yield undefined;
|
||||
|
@ -266,7 +266,7 @@ function* testSteps()
|
|||
db.onerror = errorHandler;
|
||||
|
||||
let objectStore = event.target.transaction.objectStore(objectStoreName);
|
||||
let index = objectStore.createIndex(indexName, indexName, indexOptions);
|
||||
objectStore.createIndex(indexName, indexName, indexOptions);
|
||||
|
||||
request.onupgradeneeded = unexpectedSuccessHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
|
@ -353,7 +353,7 @@ function* testSteps()
|
|||
db.onerror = errorHandler;
|
||||
|
||||
let objectStore = db.createObjectStore(objectStoreName, objectStoreOptions);
|
||||
let index = objectStore.createIndex(indexName, indexName, indexOptions);
|
||||
objectStore.createIndex(indexName, indexName, indexOptions);
|
||||
|
||||
for (let data of dbData) {
|
||||
objectStore.add(data);
|
||||
|
@ -721,17 +721,17 @@ function RequestCounter(expectedType) {
|
|||
this._counter = 0;
|
||||
}
|
||||
RequestCounter.prototype = {
|
||||
incr: function() {
|
||||
incr() {
|
||||
this._counter++;
|
||||
},
|
||||
|
||||
decr: function() {
|
||||
decr() {
|
||||
if (!--this._counter) {
|
||||
continueToNextStepSync();
|
||||
}
|
||||
},
|
||||
|
||||
handler: function(type, preventDefault) {
|
||||
handler(type, preventDefault) {
|
||||
this.incr();
|
||||
return event => {
|
||||
is(event.type, type || "success", "Correct type");
|
||||
|
@ -739,7 +739,7 @@ RequestCounter.prototype = {
|
|||
};
|
||||
},
|
||||
|
||||
errorHandler: function(eventType, errorName) {
|
||||
errorHandler(eventType, errorName) {
|
||||
this.incr();
|
||||
return event => {
|
||||
is(event.type, eventType || "error", "Correct type");
|
||||
|
|
|
@ -40,7 +40,6 @@ function* testSteps()
|
|||
let event = yield undefined;
|
||||
|
||||
let db = event.target.result;
|
||||
let txn = event.target.transaction;
|
||||
|
||||
is(db.objectStoreNames.length, 0, "Correct objectStoreNames list");
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ var testGenerator = testSteps();
|
|||
function* testSteps()
|
||||
{
|
||||
// Test object stores
|
||||
|
||||
|
||||
let name = this.window ? window.location.pathname : "Splendid Test";
|
||||
let openRequest = indexedDB.open(name, 1);
|
||||
openRequest.onerror = errorHandler;
|
||||
|
@ -19,18 +19,18 @@ function* testSteps()
|
|||
db.onerror = errorHandler;
|
||||
let tests =
|
||||
[{ add: { x: 1, id: 1 },
|
||||
indexes:[{ v: 1, k: 1 }] },
|
||||
indexes: [{ v: 1, k: 1 }] },
|
||||
{ add: { x: [2, 3], id: 2 },
|
||||
indexes:[{ v: 1, k: 1 },
|
||||
indexes: [{ v: 1, k: 1 },
|
||||
{ v: 2, k: 2 },
|
||||
{ v: 3, k: 2 }] },
|
||||
{ put: { x: [2, 4], id: 1 },
|
||||
indexes:[{ v: 2, k: 1 },
|
||||
indexes: [{ v: 2, k: 1 },
|
||||
{ v: 2, k: 2 },
|
||||
{ v: 3, k: 2 },
|
||||
{ v: 4, k: 1 }] },
|
||||
{ add: { x: [5, 6, 5, -2, 3], id: 3 },
|
||||
indexes:[{ v:-2, k: 3 },
|
||||
indexes: [{ v: -2, k: 3 },
|
||||
{ v: 2, k: 1 },
|
||||
{ v: 2, k: 2 },
|
||||
{ v: 3, k: 2 },
|
||||
|
@ -39,22 +39,22 @@ function* testSteps()
|
|||
{ v: 5, k: 3 },
|
||||
{ v: 6, k: 3 }] },
|
||||
{ delete: IDBKeyRange.bound(1, 3),
|
||||
indexes:[] },
|
||||
indexes: [] },
|
||||
{ put: { x: ["food", {}, false, undefined, /x/, [73, false]], id: 2 },
|
||||
indexes:[{ v: "food", k: 2 }] },
|
||||
indexes: [{ v: "food", k: 2 }] },
|
||||
{ add: { x: [{}, /x/, -12, "food", null, [false], undefined], id: 3 },
|
||||
indexes:[{ v: -12, k: 3 },
|
||||
indexes: [{ v: -12, k: 3 },
|
||||
{ v: "food", k: 2 },
|
||||
{ v: "food", k: 3 }] },
|
||||
{ put: { x: [], id: 2 },
|
||||
indexes:[{ v: -12, k: 3 },
|
||||
indexes: [{ v: -12, k: 3 },
|
||||
{ v: "food", k: 3 }] },
|
||||
{ put: { x: { y: 3 }, id: 3 },
|
||||
indexes:[] },
|
||||
indexes: [] },
|
||||
{ add: { x: false, id: 7 },
|
||||
indexes:[] },
|
||||
indexes: [] },
|
||||
{ delete: IDBKeyRange.lowerBound(0),
|
||||
indexes:[] },
|
||||
indexes: [] },
|
||||
];
|
||||
|
||||
let store = db.createObjectStore("mystore", { keyPath: "id" });
|
||||
|
@ -79,29 +79,29 @@ function* testSteps()
|
|||
ok(false, "borked test");
|
||||
}
|
||||
req.onsuccess = grabEventAndContinueHandler;
|
||||
let e = yield undefined;
|
||||
|
||||
yield undefined;
|
||||
|
||||
req = index.openKeyCursor();
|
||||
req.onsuccess = grabEventAndContinueHandler;
|
||||
for (let j = 0; j < test.indexes.length; ++j) {
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
is(req.result.key, test.indexes[j].v, "found expected index key at index " + j + testName);
|
||||
is(req.result.primaryKey, test.indexes[j].k, "found expected index primary key at index " + j + testName);
|
||||
req.result.continue();
|
||||
}
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
ok(req.result == null, "exhausted indexes");
|
||||
|
||||
let tempIndex = store.createIndex("temp index", "x", { multiEntry: true });
|
||||
req = tempIndex.openKeyCursor();
|
||||
req.onsuccess = grabEventAndContinueHandler;
|
||||
for (let j = 0; j < test.indexes.length; ++j) {
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
is(req.result.key, test.indexes[j].v, "found expected temp index key at index " + j + testName);
|
||||
is(req.result.primaryKey, test.indexes[j].k, "found expected temp index primary key at index " + j + testName);
|
||||
req.result.continue();
|
||||
}
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
ok(req.result == null, "exhausted temp index");
|
||||
store.deleteIndex("temp index");
|
||||
}
|
||||
|
@ -109,27 +109,27 @@ function* testSteps()
|
|||
// Unique indexes
|
||||
tests =
|
||||
[{ add: { x: 1, id: 1 },
|
||||
indexes:[{ v: 1, k: 1 }] },
|
||||
indexes: [{ v: 1, k: 1 }] },
|
||||
{ add: { x: [2, 3], id: 2 },
|
||||
indexes:[{ v: 1, k: 1 },
|
||||
indexes: [{ v: 1, k: 1 },
|
||||
{ v: 2, k: 2 },
|
||||
{ v: 3, k: 2 }] },
|
||||
{ put: { x: [2, 4], id: 3 },
|
||||
fail: true },
|
||||
{ put: { x: [1, 4], id: 1 },
|
||||
indexes:[{ v: 1, k: 1 },
|
||||
indexes: [{ v: 1, k: 1 },
|
||||
{ v: 2, k: 2 },
|
||||
{ v: 3, k: 2 },
|
||||
{ v: 4, k: 1 }] },
|
||||
{ add: { x: [5, 0, 5, 5, 5], id: 3 },
|
||||
indexes:[{ v: 0, k: 3 },
|
||||
indexes: [{ v: 0, k: 3 },
|
||||
{ v: 1, k: 1 },
|
||||
{ v: 2, k: 2 },
|
||||
{ v: 3, k: 2 },
|
||||
{ v: 4, k: 1 },
|
||||
{ v: 5, k: 3 }] },
|
||||
{ delete: IDBKeyRange.bound(1, 2),
|
||||
indexes:[{ v: 0, k: 3 },
|
||||
indexes: [{ v: 0, k: 3 },
|
||||
{ v: 5, k: 3 }] },
|
||||
{ add: { x: [0, 6], id: 8 },
|
||||
fail: true },
|
||||
|
@ -160,10 +160,10 @@ function* testSteps()
|
|||
else {
|
||||
ok(false, "borked test");
|
||||
}
|
||||
|
||||
|
||||
if (!test.fail) {
|
||||
req.onsuccess = grabEventAndContinueHandler;
|
||||
let e = yield undefined;
|
||||
yield undefined;
|
||||
indexes = test.indexes;
|
||||
}
|
||||
else {
|
||||
|
@ -176,28 +176,27 @@ function* testSteps()
|
|||
e.stopPropagation();
|
||||
}
|
||||
|
||||
let e;
|
||||
req = index.openKeyCursor();
|
||||
req.onsuccess = grabEventAndContinueHandler;
|
||||
for (let j = 0; j < indexes.length; ++j) {
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
is(req.result.key, indexes[j].v, "found expected index key at index " + j + testName);
|
||||
is(req.result.primaryKey, indexes[j].k, "found expected index primary key at index " + j + testName);
|
||||
req.result.continue();
|
||||
}
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
ok(req.result == null, "exhausted indexes");
|
||||
|
||||
let tempIndex = store.createIndex("temp index", "x", { multiEntry: true, unique: true });
|
||||
req = tempIndex.openKeyCursor();
|
||||
req.onsuccess = grabEventAndContinueHandler;
|
||||
for (let j = 0; j < indexes.length; ++j) {
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
is(req.result.key, indexes[j].v, "found expected temp index key at index " + j + testName);
|
||||
is(req.result.primaryKey, indexes[j].k, "found expected temp index primary key at index " + j + testName);
|
||||
req.result.continue();
|
||||
}
|
||||
e = yield undefined;
|
||||
yield undefined;
|
||||
ok(req.result == null, "exhausted temp index");
|
||||
store.deleteIndex("temp index");
|
||||
}
|
||||
|
|
|
@ -31,14 +31,12 @@ function* testSteps()
|
|||
db.createObjectStore(info.name);
|
||||
|
||||
// Test index creation, and that it ends up in indexNames.
|
||||
let objectStoreName = info.name;
|
||||
for (let j = 0; j < indexInfo.length; j++) {
|
||||
let info = indexInfo[j];
|
||||
let count = objectStore.indexNames.length;
|
||||
let index = info.hasOwnProperty("options") ?
|
||||
objectStore.createIndex(info.name, info.keyPath,
|
||||
info.options) :
|
||||
objectStore.createIndex(info.name, info.keyPath);
|
||||
info.hasOwnProperty("options") ?
|
||||
objectStore.createIndex(info.name, info.keyPath,
|
||||
info.options) :
|
||||
objectStore.createIndex(info.name, info.keyPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +65,7 @@ function* testSteps()
|
|||
let trans = db.transaction(objectStoreNames);
|
||||
for (let i = 0; i < objectStoreInfo.length; i++) {
|
||||
let info = objectStoreInfo[i];
|
||||
|
||||
|
||||
is(trans.objectStoreNames[info.location], info.name,
|
||||
"Got objectStore name in the right location");
|
||||
}
|
||||
|
@ -102,7 +100,7 @@ function* testSteps()
|
|||
trans = db.transaction(objectStoreNames);
|
||||
for (let i = 0; i < objectStoreInfo.length; i++) {
|
||||
let info = objectStoreInfo[i];
|
||||
|
||||
|
||||
is(trans.objectStoreNames[info.location], info.name,
|
||||
"Got objectStore name in the right location");
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ function* testSteps()
|
|||
|
||||
request = index.openCursor();
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = function (event) {
|
||||
request.onsuccess = function(event) {
|
||||
is(event.target.result.value.name, "Ben", "Good object");
|
||||
executeSoon(function() { testGenerator.next(); });
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ function* testSteps() {
|
|||
let exception = null;
|
||||
try {
|
||||
cursor.update(10);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "update() throws for key cursor");
|
||||
|
@ -70,7 +70,7 @@ function* testSteps() {
|
|||
exception = null;
|
||||
try {
|
||||
cursor.delete();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "delete() throws for key cursor");
|
||||
|
@ -112,7 +112,7 @@ function* testSteps() {
|
|||
let exception = null;
|
||||
try {
|
||||
cursor.update(10);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "update() throws for key cursor");
|
||||
|
@ -120,7 +120,7 @@ function* testSteps() {
|
|||
exception = null;
|
||||
try {
|
||||
cursor.delete();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "delete() throws for key cursor");
|
||||
|
@ -179,7 +179,7 @@ function* testSteps() {
|
|||
let exception = null;
|
||||
try {
|
||||
cursor.update(10);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "update() throws for key cursor");
|
||||
|
@ -187,7 +187,7 @@ function* testSteps() {
|
|||
exception = null;
|
||||
try {
|
||||
cursor.delete();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "delete() throws for key cursor");
|
||||
|
@ -231,7 +231,7 @@ function* testSteps() {
|
|||
let exception = null;
|
||||
try {
|
||||
cursor.update(10);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "update() throws for key cursor");
|
||||
|
@ -239,7 +239,7 @@ function* testSteps() {
|
|||
exception = null;
|
||||
try {
|
||||
cursor.delete();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "delete() throws for key cursor");
|
||||
|
@ -300,7 +300,7 @@ function* testSteps() {
|
|||
let exception = null;
|
||||
try {
|
||||
cursor.update(10);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "update() throws for key cursor");
|
||||
|
@ -308,7 +308,7 @@ function* testSteps() {
|
|||
exception = null;
|
||||
try {
|
||||
cursor.delete();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "delete() throws for key cursor");
|
||||
|
@ -355,7 +355,7 @@ function* testSteps() {
|
|||
let exception = null;
|
||||
try {
|
||||
cursor.update(10);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "update() throws for key cursor");
|
||||
|
@ -363,7 +363,7 @@ function* testSteps() {
|
|||
exception = null;
|
||||
try {
|
||||
cursor.delete();
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
ok(!!exception, "delete() throws for key cursor");
|
||||
|
|
|
@ -39,7 +39,7 @@ function* testSteps()
|
|||
for (let i = 0; i < data.length; i++) {
|
||||
let test = data[i];
|
||||
|
||||
let request = indexedDB.open(name, i+1);
|
||||
let request = indexedDB.open(name, i + 1);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
|
|
|
@ -22,7 +22,7 @@ function* testSteps()
|
|||
|
||||
let objectStore = db.createObjectStore("foo", { keyPath: "key",
|
||||
autoIncrement: true });
|
||||
let index = objectStore.createIndex("foo", "index");
|
||||
objectStore.createIndex("foo", "index");
|
||||
|
||||
event.target.onsuccess = continueToNextStep;
|
||||
yield undefined;
|
||||
|
|
|
@ -8,7 +8,7 @@ var testGenerator = testSteps();
|
|||
function* testSteps()
|
||||
{
|
||||
const names = [
|
||||
//"",
|
||||
// "",
|
||||
null,
|
||||
undefined,
|
||||
this.window ? window.location.pathname : "Splendid Test"
|
||||
|
|
|
@ -31,7 +31,7 @@ function* testSteps()
|
|||
|
||||
is(objectStore.name, objectStoreName, "Bad name");
|
||||
is(objectStore.keyPath, "foo", "Bad keyPath");
|
||||
if(objectStore.indexNames.length, 0, "Bad indexNames");
|
||||
if (objectStore.indexNames.length, 0, "Bad indexNames");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ function* testSteps()
|
|||
objectStore.get();
|
||||
ok(false, "Get with unspecified arg should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Get with unspecified arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ function* testSteps()
|
|||
objectStore.get(undefined);
|
||||
ok(false, "Get with undefined should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Get with undefined arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ function* testSteps()
|
|||
objectStore.get(null);
|
||||
ok(false, "Get with null should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
is(e instanceof DOMException, true,
|
||||
"Got right kind of exception");
|
||||
is(e.name, "DataError", "Correct error.");
|
||||
|
@ -163,7 +163,7 @@ function* testSteps()
|
|||
objectStore.delete();
|
||||
ok(false, "Delete with unspecified arg should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Delete with unspecified arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ function* testSteps()
|
|||
objectStore.delete(undefined);
|
||||
ok(false, "Delete with undefined should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Delete with undefined arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ function* testSteps()
|
|||
objectStore.delete(null);
|
||||
ok(false, "Delete with null should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
is(e instanceof DOMException, true,
|
||||
"Got right kind of exception");
|
||||
is(e.name, "DataError", "Correct error.");
|
||||
|
@ -1247,7 +1247,7 @@ function* testSteps()
|
|||
index.get();
|
||||
ok(false, "Get with unspecified arg should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Get with unspecified arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -1255,7 +1255,7 @@ function* testSteps()
|
|||
index.get(undefined);
|
||||
ok(false, "Get with undefined should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Get with undefined arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -1263,7 +1263,7 @@ function* testSteps()
|
|||
index.get(null);
|
||||
ok(false, "Get with null should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
is(e instanceof DOMException, true,
|
||||
"Got right kind of exception");
|
||||
is(e.name, "DataError", "Correct error.");
|
||||
|
@ -1359,7 +1359,7 @@ function* testSteps()
|
|||
index.getKey();
|
||||
ok(false, "Get with unspecified arg should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Get with unspecified arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ function* testSteps()
|
|||
index.getKey(undefined);
|
||||
ok(false, "Get with undefined should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
ok(true, "Get with undefined arg should have thrown");
|
||||
}
|
||||
|
||||
|
@ -1375,7 +1375,7 @@ function* testSteps()
|
|||
index.getKey(null);
|
||||
ok(false, "Get with null should have thrown");
|
||||
}
|
||||
catch(e) {
|
||||
catch (e) {
|
||||
is(e instanceof DOMException, true,
|
||||
"Got right kind of exception");
|
||||
is(e.name, "DataError", "Correct error.");
|
||||
|
|
|
@ -47,7 +47,7 @@ function* testSteps()
|
|||
request.onsuccess = function(event) {
|
||||
is(stepNumber, 2, "This callback came second");
|
||||
stepNumber++;
|
||||
event.target.transaction.oncomplete = grabEventAndContinueHandler;
|
||||
event.target.transaction.oncomplete = grabEventAndContinueHandler;
|
||||
}
|
||||
|
||||
request = db.transaction(["foo", "bar"], "readwrite")
|
||||
|
@ -57,7 +57,7 @@ function* testSteps()
|
|||
request.onsuccess = function(event) {
|
||||
is(stepNumber, 3, "This callback came third");
|
||||
stepNumber++;
|
||||
event.target.transaction.oncomplete = grabEventAndContinueHandler;
|
||||
event.target.transaction.oncomplete = grabEventAndContinueHandler;
|
||||
}
|
||||
|
||||
request = db.transaction(["foo", "bar"], "readwrite")
|
||||
|
|
|
@ -14,7 +14,7 @@ function* testSteps()
|
|||
const data = { key: 1, value: "bar" };
|
||||
|
||||
try {
|
||||
indexedDB.open(name, { version: version, storage: "unknown" });
|
||||
indexedDB.open(name, { version, storage: "unknown" });
|
||||
ok(false, "Should have thrown!");
|
||||
}
|
||||
catch (e) {
|
||||
|
@ -22,7 +22,7 @@ function* testSteps()
|
|||
is(e.name, "TypeError", "Good error name.");
|
||||
}
|
||||
|
||||
let request = indexedDB.open(name, { version: version,
|
||||
let request = indexedDB.open(name, { version,
|
||||
storage: "persistent" });
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
|
@ -59,7 +59,7 @@ function* testSteps()
|
|||
|
||||
is(event.target.result, data.key, "Got correct key");
|
||||
|
||||
request = indexedDB.open(name, { version: version,
|
||||
request = indexedDB.open(name, { version,
|
||||
storage: "temporary" });
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
|
|
|
@ -38,7 +38,7 @@ function* testSteps()
|
|||
|
||||
let request = indexedDB.openForPrincipal(getPrincipal(spec), name);
|
||||
request.onerror = errorHandler;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;;
|
||||
request.onupgradeneeded = grabEventAndContinueHandler;
|
||||
request.onsuccess = unexpectedSuccessHandler;
|
||||
|
||||
yield undefined;
|
||||
|
@ -129,7 +129,7 @@ function* testSteps()
|
|||
}
|
||||
}
|
||||
|
||||
trans.onabort = unexpectedSuccessHandler;;
|
||||
trans.onabort = unexpectedSuccessHandler;
|
||||
trans.oncomplete = grabEventAndContinueHandler;
|
||||
|
||||
yield undefined;
|
||||
|
|
|
@ -55,7 +55,7 @@ function* testSteps()
|
|||
let exception;
|
||||
|
||||
try {
|
||||
let transaction = db.transaction(name, "readwriteflush");
|
||||
db.transaction(name, "readwriteflush");
|
||||
} catch (e) {
|
||||
exception = e;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ function* testSteps()
|
|||
objectStore.index(indexName);
|
||||
ok(false, "should have thrown");
|
||||
}
|
||||
catch(ex) {
|
||||
catch (ex) {
|
||||
ok(ex instanceof DOMException, "Got a DOMException");
|
||||
is(ex.name, "NotFoundError", "expect a NotFoundError");
|
||||
is(ex.code, DOMException.NOT_FOUND_ERR, "expect a NOT_FOUND_ERR");
|
||||
|
|
|
@ -69,7 +69,7 @@ function* testSteps()
|
|||
trans.objectStore(objectStoreName);
|
||||
ok(false, "should have thrown");
|
||||
}
|
||||
catch(ex) {
|
||||
catch (ex) {
|
||||
ok(ex instanceof DOMException, "Got a DOMException");
|
||||
is(ex.name, "NotFoundError", "expect a NotFoundError");
|
||||
is(ex.code, DOMException.NOT_FOUND_ERR, "expect a NOT_FOUND_ERR");
|
||||
|
@ -113,7 +113,7 @@ function* testSteps()
|
|||
|
||||
objectStore = db.createObjectStore(objectStoreName, { keyPath: "foo" });
|
||||
|
||||
request = objectStore.add({foo:"bar"});
|
||||
request = objectStore.add({foo: "bar"});
|
||||
request.onerror = errorHandler;
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ function exerciseInterface() {
|
|||
}
|
||||
|
||||
DB.prototype = {
|
||||
_create: function() {
|
||||
_create() {
|
||||
var op = indexedDB.open(this.name);
|
||||
op.onupgradeneeded = e => {
|
||||
var db = e.target.result;
|
||||
|
@ -20,7 +20,7 @@ function exerciseInterface() {
|
|||
});
|
||||
},
|
||||
|
||||
_result: function(tx, op) {
|
||||
_result(tx, op) {
|
||||
return new Promise((resolve, reject) => {
|
||||
op.onsuccess = e => resolve(e.target.result);
|
||||
op.onerror = () => reject(op.error);
|
||||
|
@ -28,30 +28,30 @@ function exerciseInterface() {
|
|||
});
|
||||
},
|
||||
|
||||
get: function(k) {
|
||||
get(k) {
|
||||
return this._db.then(db => {
|
||||
var tx = db.transaction(this.store, 'readonly');
|
||||
var tx = db.transaction(this.store, "readonly");
|
||||
var store = tx.objectStore(this.store);
|
||||
return this._result(tx, store.get(k));
|
||||
});
|
||||
},
|
||||
|
||||
add: function(k, v) {
|
||||
add(k, v) {
|
||||
return this._db.then(db => {
|
||||
var tx = db.transaction(this.store, 'readwrite');
|
||||
var tx = db.transaction(this.store, "readwrite");
|
||||
var store = tx.objectStore(this.store);
|
||||
return this._result(tx, store.add(v, k));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
var db = new DB('data', 'base');
|
||||
return db.add('x', [ 10, {} ])
|
||||
.then(_ => db.get('x'))
|
||||
var db = new DB("data", "base");
|
||||
return db.add("x", [ 10, {} ])
|
||||
.then(_ => db.get("x"))
|
||||
.then(x => {
|
||||
equal(x.length, 2);
|
||||
equal(x[0], 10);
|
||||
equal(typeof x[1], 'object');
|
||||
equal(typeof x[1], "object");
|
||||
equal(Object.keys(x[1]).length, 0);
|
||||
});
|
||||
}
|
||||
|
@ -60,18 +60,18 @@ function run_test() {
|
|||
do_get_profile();
|
||||
|
||||
let Cu = Components.utils;
|
||||
let sb = new Cu.Sandbox('https://www.example.com',
|
||||
{ wantGlobalProperties: ['indexedDB'] });
|
||||
let sb = new Cu.Sandbox("https://www.example.com",
|
||||
{ wantGlobalProperties: ["indexedDB"] });
|
||||
|
||||
sb.equal = equal;
|
||||
var innerPromise = new Promise((resolve, reject) => {
|
||||
sb.test_done = resolve;
|
||||
sb.test_error = reject;
|
||||
});
|
||||
Cu.evalInSandbox('(' + exerciseInterface.toSource() + ')()' +
|
||||
'.then(test_done, test_error);', sb);
|
||||
Cu.evalInSandbox("(" + exerciseInterface.toSource() + ")()" +
|
||||
".then(test_done, test_error);", sb);
|
||||
|
||||
Cu.importGlobalProperties(['indexedDB']);
|
||||
Cu.importGlobalProperties(["indexedDB"]);
|
||||
do_test_pending();
|
||||
Promise.all([innerPromise, exerciseInterface()])
|
||||
.then(do_test_finished);
|
||||
|
|
|
@ -9,7 +9,7 @@ function* testSteps()
|
|||
{
|
||||
const testName = "schema18upgrade";
|
||||
const testKeys = [
|
||||
-1/0,
|
||||
-1 / 0,
|
||||
-1.7e308,
|
||||
-10000,
|
||||
-2,
|
||||
|
@ -24,7 +24,7 @@ function* testSteps()
|
|||
2,
|
||||
10000,
|
||||
1.7e308,
|
||||
1/0,
|
||||
1 / 0,
|
||||
new Date("1750-01-02"),
|
||||
new Date("1800-12-31T12:34:56.001Z"),
|
||||
new Date(-1000),
|
||||
|
@ -97,7 +97,7 @@ function* testSteps()
|
|||
"\uFFFF\x00",
|
||||
"\uFFFFZZZ",
|
||||
[],
|
||||
[-1/0],
|
||||
[-1 / 0],
|
||||
[-1],
|
||||
[0],
|
||||
[1],
|
||||
|
@ -112,7 +112,7 @@ function* testSteps()
|
|||
[12, [[["foo"]]]],
|
||||
[12, [[[[[3]]]]]],
|
||||
[12, [[[[[[3]]]]]]],
|
||||
[12, [[[[[[3],[[[[[4.2]]]]]]]]]]],
|
||||
[12, [[[[[[3], [[[[[4.2]]]]]]]]]]],
|
||||
[new Date(-1)],
|
||||
[new Date(1)],
|
||||
[""],
|
||||
|
@ -127,8 +127,8 @@ function* testSteps()
|
|||
["x", [[]]],
|
||||
["x", [[[]]]],
|
||||
[[]],
|
||||
[[],"foo"],
|
||||
[[],[]],
|
||||
[[], "foo"],
|
||||
[[], []],
|
||||
[[[]]],
|
||||
[[[]], []],
|
||||
[[[]], [[]]],
|
||||
|
|
|
@ -9,7 +9,7 @@ function* testSteps()
|
|||
{
|
||||
const testName = "schema21upgrade";
|
||||
const testKeys = [
|
||||
-1/0,
|
||||
-1 / 0,
|
||||
-1.7e308,
|
||||
-10000,
|
||||
-2,
|
||||
|
@ -24,7 +24,7 @@ function* testSteps()
|
|||
2,
|
||||
10000,
|
||||
1.7e308,
|
||||
1/0,
|
||||
1 / 0,
|
||||
new Date("1750-01-02"),
|
||||
new Date("1800-12-31T12:34:56.001Z"),
|
||||
new Date(-1000),
|
||||
|
@ -97,7 +97,7 @@ function* testSteps()
|
|||
"\uFFFF\x00",
|
||||
"\uFFFFZZZ",
|
||||
[],
|
||||
[-1/0],
|
||||
[-1 / 0],
|
||||
[-1],
|
||||
[0],
|
||||
[1],
|
||||
|
@ -112,7 +112,7 @@ function* testSteps()
|
|||
[12, [[["foo"]]]],
|
||||
[12, [[[[[3]]]]]],
|
||||
[12, [[[[[[3]]]]]]],
|
||||
[12, [[[[[[3],[[[[[4.2]]]]]]]]]]],
|
||||
[12, [[[[[[3], [[[[[4.2]]]]]]]]]]],
|
||||
[new Date(-1)],
|
||||
[new Date(1)],
|
||||
[""],
|
||||
|
@ -127,8 +127,8 @@ function* testSteps()
|
|||
["x", [[]]],
|
||||
["x", [[[]]]],
|
||||
[[]],
|
||||
[[],"foo"],
|
||||
[[],[]],
|
||||
[[], "foo"],
|
||||
[[], []],
|
||||
[[[]]],
|
||||
[[[]], []],
|
||||
[[[]], [[]]],
|
||||
|
|
|
@ -18,7 +18,7 @@ function* testSteps()
|
|||
let db = event.target.result;
|
||||
|
||||
let objectStore = db.createObjectStore("foo");
|
||||
let index = objectStore.createIndex("bar", "baz");
|
||||
objectStore.createIndex("bar", "baz");
|
||||
|
||||
is(db.version, 1, "Correct version");
|
||||
is(db.objectStoreNames.length, 1, "Correct objectStoreNames length");
|
||||
|
@ -77,7 +77,7 @@ function* testSteps()
|
|||
is(db2.objectStoreNames.length, 0, "Correct objectStoreNames length");
|
||||
|
||||
let objectStore2 = db2.createObjectStore("foo");
|
||||
let index2 = objectStore2.createIndex("bar", "baz");
|
||||
objectStore2.createIndex("bar", "baz");
|
||||
|
||||
request.onsuccess = grabEventAndContinueHandler;
|
||||
request.onupgradeneeded = unexpectedSuccessHandler;
|
||||
|
|
|
@ -39,6 +39,7 @@ function* testSteps()
|
|||
request.onupgradeneeded = function(event) {
|
||||
info("Got upgradeneeded event for db 2");
|
||||
expectUncaughtException(true);
|
||||
// eslint-disable-next-line no-undef
|
||||
trigger_js_exception_by_calling_a_nonexistent_function();
|
||||
};
|
||||
event = yield undefined;
|
||||
|
|
|
@ -7,10 +7,10 @@ function* testSteps()
|
|||
const objectStoreName = "storagesManager";
|
||||
const arraySize = 1e6;
|
||||
|
||||
ok('estimate' in navigator.storage, 'Has estimate function');
|
||||
is(typeof navigator.storage.estimate, 'function', 'estimate is function');
|
||||
ok("estimate" in navigator.storage, "Has estimate function");
|
||||
is(typeof navigator.storage.estimate, "function", "estimate is function");
|
||||
ok(navigator.storage.estimate() instanceof Promise,
|
||||
'estimate() method exists and returns a Promise');
|
||||
"estimate() method exists and returns a Promise");
|
||||
|
||||
navigator.storage.estimate().then(estimation => {
|
||||
testGenerator.next(estimation.usage);
|
||||
|
@ -34,11 +34,11 @@ function* testSteps()
|
|||
testGenerator.next(estimation.usage);
|
||||
});
|
||||
let usageAfterCreate = yield undefined;
|
||||
ok(usageAfterCreate > before, 'estimated usage must increase after createObjectStore');
|
||||
ok(usageAfterCreate > before, "estimated usage must increase after createObjectStore");
|
||||
|
||||
let txn = db.transaction(objectStoreName, "readwrite");
|
||||
objectStore = txn.objectStore(objectStoreName);
|
||||
objectStore.put(new Uint8Array(arraySize), 'k');
|
||||
objectStore.put(new Uint8Array(arraySize), "k");
|
||||
txn.oncomplete = continueToNextStep;
|
||||
txn.onabort = errorHandler;
|
||||
txn.onerror = errorHandler;
|
||||
|
@ -48,7 +48,7 @@ function* testSteps()
|
|||
testGenerator.next(estimation.usage);
|
||||
});
|
||||
let usageAfterPut = yield undefined;
|
||||
ok(usageAfterPut > usageAfterCreate, 'estimated usage must increase after putting large object');
|
||||
ok(usageAfterPut > usageAfterCreate, "estimated usage must increase after putting large object");
|
||||
db.close();
|
||||
|
||||
finishTest();
|
||||
|
@ -58,5 +58,5 @@ function setup()
|
|||
{
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.storageManager.enabled", true]]
|
||||
}, runTest);
|
||||
}, runTest);
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ function* testSteps()
|
|||
"Good error");
|
||||
abortEventCount++;
|
||||
event.preventDefault();
|
||||
};
|
||||
}
|
||||
objectStore = db.transaction("foo", "readwrite").objectStore("foo");
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
|
|
|
@ -76,7 +76,7 @@ function* testSteps()
|
|||
if (readonly) {
|
||||
transaction.objectStore(objStoreName).get(0);
|
||||
} else {
|
||||
try { transaction.objectStore(objStoreName).add({}); } catch(e) { }
|
||||
try { transaction.objectStore(objStoreName).add({}); } catch (e) { }
|
||||
}
|
||||
}
|
||||
ok(true, "Created all transactions");
|
||||
|
|
|
@ -89,6 +89,7 @@ function* testSteps() {
|
|||
info("Adding duplicate entry without preventDefault()");
|
||||
|
||||
if ("SimpleTest" in this) {
|
||||
/* global SimpleTest */
|
||||
SimpleTest.expectUncaughtException();
|
||||
} else if ("DedicatedWorkerGlobalScope" in self &&
|
||||
self instanceof DedicatedWorkerGlobalScope) {
|
||||
|
|
|
@ -20,7 +20,7 @@ function* testSteps()
|
|||
event.target.transaction.oncomplete = grabEventAndContinueHandler;
|
||||
|
||||
let os = db.createObjectStore("foo", { autoIncrement: true });
|
||||
let index = os.createIndex("bar", "foo.bar");
|
||||
os.createIndex("bar", "foo.bar");
|
||||
event = yield undefined;
|
||||
|
||||
is(request.transaction, event.target,
|
||||
|
|
|
@ -21,7 +21,7 @@ function* testSteps()
|
|||
db.createObjectStore("foo");
|
||||
yield undefined;
|
||||
|
||||
let transaction1 = db.transaction("foo");
|
||||
db.transaction("foo");
|
||||
|
||||
let transaction2;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ function* testSteps()
|
|||
for (let autoIncrement of [false, true]) {
|
||||
let objectStore =
|
||||
db.createObjectStore(autoIncrement, { keyPath: "id",
|
||||
autoIncrement: autoIncrement });
|
||||
autoIncrement });
|
||||
objectStore.createIndex("", "index", { unique: true });
|
||||
|
||||
for (let i = 0; i < 10; i++) {
|
||||
|
@ -31,7 +31,7 @@ function* testSteps()
|
|||
is(event.type, "success", "expect a success event");
|
||||
|
||||
for (let autoIncrement of [false, true]) {
|
||||
objectStore = db.transaction(autoIncrement, "readwrite")
|
||||
let objectStore = db.transaction(autoIncrement, "readwrite")
|
||||
.objectStore(autoIncrement);
|
||||
|
||||
request = objectStore.put({ id: 5, index: 6 });
|
||||
|
|
|
@ -19,7 +19,7 @@ function* testSteps()
|
|||
return;
|
||||
}
|
||||
|
||||
getWasmBinary('(module (func (nop)))');
|
||||
getWasmBinary("(module (func (nop)))");
|
||||
let binary = yield undefined;
|
||||
wasmData.value = getWasmModule(binary);
|
||||
|
||||
|
|
|
@ -23,35 +23,35 @@ function* testSteps()
|
|||
return;
|
||||
}
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 1)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 1)))");
|
||||
let binary = yield undefined;
|
||||
wasmData[1].value[0] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 2)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 2)))");
|
||||
binary = yield undefined;
|
||||
wasmData[1].value[1] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 3)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 3)))");
|
||||
binary = yield undefined;
|
||||
wasmData[1].value[2] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 4)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 4)))");
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[0] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 5)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 5)))");
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[1] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 6)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 6)))");
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[2] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 7)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 7)))");
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[3] = getWasmModule(binary);
|
||||
|
||||
getWasmBinary('(module (func (result i32) (i32.const 8)))');
|
||||
getWasmBinary("(module (func (result i32) (i32.const 8)))");
|
||||
binary = yield undefined;
|
||||
wasmData[2].value[4] = getWasmModule(binary);
|
||||
|
||||
|
|