Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2012-06-26 19:08:17 +01:00
Родитель fae03b44ec 329df2bdf1
Коммит 72b1a343cd
21 изменённых файлов: 325 добавлений и 90 удалений

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

@ -187,6 +187,7 @@
command="Tools:Scratchpad"/>
<menuitem id="appmenu_styleeditor"
hidden="true"
type="checkbox"
label="&styleeditor.label;"
key="key_styleeditor"
command="Tools:StyleEditor"/>

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

@ -563,6 +563,7 @@
key="key_scratchpad"
command="Tools:Scratchpad"/>
<menuitem id="menu_styleeditor"
type="checkbox"
hidden="true"
label="&styleeditor.label;"
accesskey="&styleeditor.accesskey;"

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

@ -95,7 +95,7 @@
<command id="Tools:RemoteDebugger" oncommand="DebuggerUI.toggleRemoteDebugger();" disabled="true"/>
<command id="Tools:ChromeDebugger" oncommand="DebuggerUI.toggleChromeDebugger();" disabled="true"/>
<command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true"/>
<command id="Tools:StyleEditor" oncommand="StyleEditor.openChrome();" disabled="true"/>
<command id="Tools:StyleEditor" oncommand="StyleEditor.toggle();" disabled="true"/>
<command id="Tools:ResponsiveUI" oncommand="ResponsiveUI.toggle();" disabled="true"/>
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Sanitize"

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

@ -1477,6 +1477,7 @@ var gBrowserInit = {
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_styleeditor").hidden = false;
#endif
document.getElementById("developer-toolbar-styleeditor").hidden = false;
}
#ifdef MENUBAR_CAN_AUTOHIDE
@ -1496,7 +1497,6 @@ var gBrowserInit = {
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_responsiveUI").hidden = false;
#endif
document.getElementById("developer-toolbar-responsiveui").hidden = false;
}
let appMenuButton = document.getElementById("appmenu-button");
@ -7370,40 +7370,29 @@ var StyleEditor = {
*/
openChrome: function SE_openChrome(aSelectedStyleSheet, aLine, aCol)
{
const CHROME_URL = "chrome://browser/content/styleeditor.xul";
const CHROME_WINDOW_TYPE = "Tools:StyleEditor";
const CHROME_WINDOW_FLAGS = "chrome,centerscreen,resizable,dialog=no";
// focus currently open Style Editor window for this document, if any
let contentWindow = gBrowser.selectedBrowser.contentWindow;
let contentWindowID = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
let enumerator = Services.wm.getEnumerator(CHROME_WINDOW_TYPE);
while (enumerator.hasMoreElements()) {
var win = enumerator.getNext();
if (win.styleEditorChrome.contentWindowID == contentWindowID) {
if (aSelectedStyleSheet) {
win.styleEditorChrome.selectStyleSheet(aSelectedStyleSheet, aLine, aCol);
}
win.focus();
return win;
}
let win = this.StyleEditorManager.getEditorForWindow(contentWindow);
if (win) {
this.StyleEditorManager.selectEditor(win);
return win;
} else {
return this.StyleEditorManager.newEditor(contentWindow,
aSelectedStyleSheet, aLine, aCol);
}
},
let args = {
contentWindow: contentWindow,
selectedStyleSheet: aSelectedStyleSheet,
line: aLine,
col: aCol
};
args.wrappedJSObject = args;
let chromeWindow = Services.ww.openWindow(null, CHROME_URL, "_blank",
CHROME_WINDOW_FLAGS, args);
chromeWindow.focus();
return chromeWindow;
toggle: function SE_toggle()
{
this.StyleEditorManager.toggleEditor(gBrowser.contentWindow);
}
};
XPCOMUtils.defineLazyGetter(StyleEditor, "StyleEditorManager", function() {
let tmp = {};
Cu.import("resource:///modules/devtools/StyleEditor.jsm", tmp);
return new tmp.StyleEditorManager(window);
});
XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () {
#ifdef XP_WIN

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

@ -1045,13 +1045,13 @@
class="devtools-toolbarbutton"
hidden="true"
command="Tools:Inspect"/>
<toolbarbutton id="developer-toolbar-responsiveui"
label="&responsiveDesignTool.label;"
<toolbarbutton id="developer-toolbar-styleeditor"
label="&styleeditor.label;"
class="devtools-toolbarbutton"
hidden="true"
command="Tools:ResponsiveUI"/>
command="Tools:StyleEditor"/>
<toolbarbutton id="developer-toolbar-debugger"
label="&scriptsButton.label;"
label="&debuggerMenu.label2;"
class="devtools-toolbarbutton"
hidden="true"
command="Tools:Debugger"/>

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

@ -2,10 +2,6 @@
* 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/. */
:root {
-moz-user-focus: normal;
}
input[type=button] {
cursor: pointer;
}
@ -15,6 +11,7 @@ input[type=button] {
display: -moz-box;
position: relative;
-moz-box-flex: 1;
-moz-user-focus: normal;
}
#newtab-scrollbox:not([page-disabled]) {

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

@ -80,18 +80,24 @@ let gPage = {
* @param aValue Whether the New Tab Page is enabled or not.
*/
_updateAttributes: function Page_updateAttributes(aValue) {
let selector = "#newtab-scrollbox, #newtab-toggle, #newtab-grid";
let nodes = document.querySelectorAll(selector);
// Set the nodes' states.
for (let i = 0; i < nodes.length; i++) {
let node = nodes[i];
let nodeSelector = "#newtab-scrollbox, #newtab-toggle, #newtab-grid";
for (let node of document.querySelectorAll(nodeSelector)) {
if (aValue)
node.removeAttribute("page-disabled");
else
node.setAttribute("page-disabled", "true");
}
// Enables/disables the control and link elements.
let inputSelector = ".newtab-control, .newtab-link";
for (let input of document.querySelectorAll(inputSelector)) {
if (aValue)
input.removeAttribute("tabindex");
else
input.setAttribute("tabindex", "-1");
}
// Update the toggle button's title.
let toggle = document.getElementById("newtab-toggle");
toggle.setAttribute("title", newTabString(aValue ? "hide" : "show"));

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

@ -35,6 +35,7 @@ function checkOpen() {
let close = document.getElementById("developer-toolbar-closebutton");
let webconsole = document.getElementById("developer-toolbar-webconsole");
let inspector = document.getElementById("developer-toolbar-inspector");
let styleeditor = document.getElementById("developer-toolbar-styleeditor");
let debuggr = document.getElementById("developer-toolbar-debugger");
ok(close, "Close button exists");
@ -42,18 +43,21 @@ function checkOpen() {
ok(!isChecked(webconsole), "web console button state 1");
ok(!isChecked(inspector), "inspector button state 1");
ok(!isChecked(debuggr), "debugger button state 1");
ok(!isChecked(styleeditor), "styleeditor button state 1");
document.getElementById("Tools:WebConsole").doCommand();
ok(isChecked(webconsole), "web console button state 2");
ok(!isChecked(inspector), "inspector button state 2");
ok(!isChecked(debuggr), "debugger button state 2");
ok(!isChecked(styleeditor), "styleeditor button state 2");
document.getElementById("Tools:Inspect").doCommand();
ok(isChecked(webconsole), "web console button state 3");
ok(isChecked(inspector), "inspector button state 3");
ok(!isChecked(debuggr), "debugger button state 3");
ok(!isChecked(styleeditor), "styleeditor button state 3");
// Christmas tree!
@ -66,12 +70,14 @@ function checkOpen() {
ok(!isChecked(webconsole), "web console button state 6");
ok(isChecked(inspector), "inspector button state 6");
ok(!isChecked(debuggr), "debugger button state 6");
ok(!isChecked(styleeditor), "styleeditor button state 6");
document.getElementById("Tools:Inspect").doCommand();
ok(!isChecked(webconsole), "web console button state 7");
ok(!isChecked(inspector), "inspector button state 7");
ok(!isChecked(debuggr), "debugger button state 7");
ok(!isChecked(styleeditor), "styleeditor button state 7");
// All closed
@ -81,9 +87,38 @@ function checkOpen() {
ok(!isChecked(webconsole), "web console button state 8");
ok(isChecked(inspector), "inspector button state 8");
ok(!isChecked(debuggr), "debugger button state 8");
ok(!isChecked(styleeditor), "styleeditor button state 8");
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkClosed));
document.getElementById("Tools:DevToolbar").doCommand();
// Test Style Editor
document.getElementById("Tools:StyleEditor").doCommand();
ok(!isChecked(webconsole), "web console button state 9");
ok(isChecked(inspector), "inspector button state 9");
ok(!isChecked(debuggr), "debugger button state 9");
ok(isChecked(styleeditor), "styleeditor button state 9");
// Test Debugger
document.getElementById("Tools:Debugger").doCommand();
ok(!isChecked(webconsole), "web console button state 9");
ok(isChecked(inspector), "inspector button state 9");
ok(isChecked(debuggr), "debugger button state 9");
ok(isChecked(styleeditor), "styleeditor button state 9");
addTab("about:blank", function(browser, tab) {
info("Opening a new tab");
ok(!isChecked(webconsole), "web console button state 10");
ok(!isChecked(inspector), "inspector button state 10");
ok(!isChecked(debuggr), "debugger button state 10");
ok(!isChecked(styleeditor), "styleeditor button state 10");
gBrowser.removeCurrentTab();
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkClosed));
document.getElementById("Tools:DevToolbar").doCommand();
});
}
function checkClosed() {
@ -102,10 +137,15 @@ function checkReOpen() {
let webconsole = document.getElementById("developer-toolbar-webconsole");
let inspector = document.getElementById("developer-toolbar-inspector");
let debuggr = document.getElementById("developer-toolbar-debugger");
let styleeditor = document.getElementById("developer-toolbar-styleeditor");
ok(isChecked(webconsole), "web console button state 9");
ok(isChecked(inspector), "inspector button state 9");
ok(!isChecked(debuggr), "debugger button state 9");
ok(isChecked(webconsole), "web console button state 99");
ok(isChecked(inspector), "inspector button state 99");
ok(isChecked(debuggr), "debugger button state 99");
ok(isChecked(styleeditor), "styleeditor button state 99");
// We close the style editor (not automatically closed)
document.getElementById("Tools:StyleEditor").doCommand();
oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE, catchFail(checkReClosed));
document.getElementById("developer-toolbar-closebutton").doCommand();

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

@ -5,7 +5,7 @@
"use strict";
const EXPORTED_SYMBOLS = ["StyleEditor", "StyleEditorFlags"];
const EXPORTED_SYMBOLS = ["StyleEditor", "StyleEditorFlags", "StyleEditorManager"];
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -1160,3 +1160,133 @@ function setupBracketCompletion(aSourceEditor)
aSourceEditor.setCaretOffset(aSourceEditor.getCaretOffset() - 1);
}, false);
}
/**
* Manage the different editors instances.
*/
function StyleEditorManager(aWindow) {
this.chromeWindow = aWindow;
this.listenToTabs();
this.editors = new WeakMap();
}
StyleEditorManager.prototype = {
/**
* Get the editor for a specific content window.
*/
getEditorForWindow: function SEM_getEditorForWindow(aContentWindow) {
return this.editors.get(aContentWindow);
},
/**
* Focus the editor and select a stylesheet.
*
* @param {CSSStyleSheet} [aSelectedStyleSheet] default Stylesheet.
* @param {Number} [aLine] Line to which the caret should be moved (one-indexed).
* @param {Number} [aCol] Column to which the caret should be moved (one-indexed).
*/
selectEditor: function SEM_selectEditor(aWindow, aSelectedStyleSheet, aLine, aCol) {
if (aSelectedStyleSheet) {
aWindow.styleEditorChrome.selectStyleSheet(aSelectedStyleSheet, aLine, aCol);
}
aWindow.focus();
},
/**
* Open a new editor.
*
* @param {Window} content window.
* @param {CSSStyleSheet} [aSelectedStyleSheet] default Stylesheet.
* @param {Number} [aLine] Line to which the caret should be moved (one-indexed).
* @param {Number} [aCol] Column to which the caret should be moved (one-indexed).
*/
newEditor: function SEM_newEditor(aContentWindow, aSelectedStyleSheet, aLine, aCol) {
const CHROME_URL = "chrome://browser/content/styleeditor.xul";
const CHROME_WINDOW_FLAGS = "chrome,centerscreen,resizable,dialog=no";
let args = {
contentWindow: aContentWindow,
selectedStyleSheet: aSelectedStyleSheet,
line: aLine,
col: aCol
};
args.wrappedJSObject = args;
let chromeWindow = Services.ww.openWindow(null, CHROME_URL, "_blank",
CHROME_WINDOW_FLAGS, args);
chromeWindow.onunload = function() {
if (chromeWindow.location == CHROME_URL) {
// not about:blank being unloaded
this.unregisterEditor(aContentWindow);
}
}.bind(this);
chromeWindow.focus();
this.editors.set(aContentWindow, chromeWindow);
this.refreshCommand();
return chromeWindow;
},
/**
* Toggle an editor.
*
* @param {Window} associated content window.
*/
toggleEditor: function SEM_toggleEditor(aContentWindow) {
let editor = this.getEditorForWindow(aContentWindow);
if (editor) {
editor.close();
} else {
this.newEditor(aContentWindow);
}
},
/**
* Close an editor.
*
* @param {Window} associated content window.
*/
unregisterEditor: function SEM_unregisterEditor(aContentWindow) {
let chromeWindow = this.editors.get(aContentWindow);
if (chromeWindow) {
chromeWindow.close();
}
this.editors.delete(aContentWindow);
this.refreshCommand();
},
/**
* Update the status of tool's menuitems and buttons.
*/
refreshCommand: function SEM_refreshCommand() {
let contentWindow = this.chromeWindow.gBrowser.contentWindow;
let command = this.chromeWindow.document.getElementById("Tools:StyleEditor");
let win = this.getEditorForWindow(contentWindow);
if (win) {
command.setAttribute("checked", "true");
} else {
command.setAttribute("checked", "false");
}
},
/**
* Trigger refreshCommand when needed.
*/
listenToTabs: function SEM_listenToTabs() {
let win = this.chromeWindow;
let tabs = win.gBrowser.tabContainer;
let bound_refreshCommand = this.refreshCommand.bind(this);
tabs.addEventListener("TabSelect", bound_refreshCommand, true);
win.addEventListener("unload", function onClose(aEvent) {
tabs.removeEventListener("TabSelect", bound_refreshCommand, true);
win.removeEventListener("unload", onClose, false);
}, false);
},
}

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

@ -497,7 +497,7 @@ let Manager = {
NetworkResponseListener = ConsoleProgressListener = null;
XPCOMUtils = gConsoleStorage = WebConsoleUtils = l10n = JSPropertyProvider =
NetworkHelper = NetUtil = activityDistributor = null;
null;
},
};

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

@ -242,7 +242,6 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY webConsoleButton.label "Web Console">
<!ENTITY inspectorButton.label "Inspector">
<!ENTITY scriptsButton.label "Scripts">
<!ENTITY inspectorHTMLCopyInner.label "Copy Inner HTML">
<!ENTITY inspectorHTMLCopyInner.accesskey "I">

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

@ -1714,7 +1714,7 @@ IDBObjectStore::IndexInternal(const nsAString& aName,
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (!mTransaction->IsOpen()) {
if (mTransaction->IsFinished()) {
return NS_ERROR_DOM_INDEXEDDB_TRANSACTION_INACTIVE_ERR;
}

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

@ -499,10 +499,7 @@ IDBTransaction::AbortWithCode(nsresult aAbortCode)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
// We can't use IsOpen here since we need it to be possible to call Abort()
// even from outside of transaction callbacks.
if (mReadyState != IDBTransaction::INITIAL &&
mReadyState != IDBTransaction::LOADING) {
if (IsFinished()) {
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
}
@ -683,7 +680,7 @@ IDBTransaction::ObjectStoreInternal(const nsAString& aName,
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
if (!IsOpen()) {
if (IsFinished()) {
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
}
@ -819,6 +816,10 @@ CommitHelper::Run()
}
NS_ENSURE_TRUE(event, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
if (mListener) {
mListener->NotifyTransactionPreComplete(mTransaction);
}
bool dummy;
if (NS_FAILED(mTransaction->DispatchEvent(event, &dummy))) {
NS_WARNING("Dispatch failed!");
@ -828,9 +829,8 @@ CommitHelper::Run()
mTransaction->mFiredCompleteOrAbort = true;
#endif
// Tell the listener (if we have one) that we're done
if (mListener) {
mListener->NotifyTransactionComplete(mTransaction);
mListener->NotifyTransactionPostComplete(mTransaction);
}
mTransaction = nsnull;

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

@ -45,7 +45,10 @@ public:
NS_IMETHOD_(nsrefcnt) AddRef() = 0;
NS_IMETHOD_(nsrefcnt) Release() = 0;
virtual nsresult NotifyTransactionComplete(IDBTransaction* aTransaction) = 0;
// Called just before dispatching the final events on the transaction.
virtual nsresult NotifyTransactionPreComplete(IDBTransaction* aTransaction) = 0;
// Called just after dispatching the final events on the transaction.
virtual nsresult NotifyTransactionPostComplete(IDBTransaction* aTransaction) = 0;
};
class IDBTransaction : public IDBWrapperCache,
@ -122,6 +125,11 @@ public:
bool IsOpen() const;
bool IsFinished() const
{
return mReadyState > LOADING;
}
bool IsWriteAllowed() const
{
return mMode == READ_WRITE || mMode == VERSION_CHANGE;

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

@ -1352,8 +1352,10 @@ protected:
// Need an upgradeneeded event here.
virtual already_AddRefed<nsDOMEvent> CreateSuccessEvent() MOZ_OVERRIDE;
virtual nsresult NotifyTransactionComplete(IDBTransaction* aTransaction)
MOZ_OVERRIDE;
virtual nsresult NotifyTransactionPreComplete(IDBTransaction* aTransaction)
MOZ_OVERRIDE;
virtual nsresult NotifyTransactionPostComplete(IDBTransaction* aTransaction)
MOZ_OVERRIDE;
virtual ChildProcessSendResult
MaybeSendResponseToChildProcess(nsresult aResultCode) MOZ_OVERRIDE
@ -1956,12 +1958,6 @@ OpenDatabaseHelper::Run()
switch (mState) {
case eSetVersionCompleted: {
// Allow transaction creation/other version change transactions to proceed
// before we fire events. Other version changes will be postd to the end
// of the event loop, and will be behind whatever the page does in
// its error/success event handlers.
mDatabase->ExitSetVersionTransaction();
mState = eFiringEvents;
break;
}
@ -2134,6 +2130,9 @@ OpenDatabaseHelper::NotifySetVersionFinished()
NS_ASSERTION(NS_IsMainThread(), "Wrong thread");
NS_ASSERTION(mState = eSetVersionPending, "How did we get here?");
// Allow transaction creation to proceed.
mDatabase->ExitSetVersionTransaction();
mState = eSetVersionCompleted;
// Dispatch ourself back to the main thread
@ -2292,7 +2291,17 @@ SetVersionHelper::CreateSuccessEvent()
}
nsresult
SetVersionHelper::NotifyTransactionComplete(IDBTransaction* aTransaction)
SetVersionHelper::NotifyTransactionPreComplete(IDBTransaction* aTransaction)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(aTransaction, "This is unexpected.");
NS_ASSERTION(mOpenRequest, "Why don't we have a request?");
return mOpenHelper->NotifySetVersionFinished();
}
nsresult
SetVersionHelper::NotifyTransactionPostComplete(IDBTransaction* aTransaction)
{
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
NS_ASSERTION(aTransaction, "This is unexpected.");
@ -2312,7 +2321,6 @@ SetVersionHelper::NotifyTransactionComplete(IDBTransaction* aTransaction)
mOpenRequest->SetTransaction(nsnull);
mOpenRequest = nsnull;
rv = mOpenHelper->NotifySetVersionFinished();
mOpenHelper = nsnull;
return rv;

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

@ -337,7 +337,6 @@ IndexedDBDatabaseChild::RecvSuccess(
if (openHelper) {
request->Reset();
database->ExitSetVersionTransaction();
}
else {
openHelper = new IPCOpenDatabaseHelper(mDatabase, request);
@ -370,7 +369,6 @@ IndexedDBDatabaseChild::RecvError(const nsresult& aRv)
if (openHelper) {
request->Reset();
database->ExitSetVersionTransaction();
}
else {
openHelper = new IPCOpenDatabaseHelper(NULL, request);
@ -540,12 +538,9 @@ IndexedDBTransactionChild::FireCompleteEvent(nsresult aRv)
nsRefPtr<IDBTransaction> transaction;
mStrongTransaction.swap(transaction);
// This is where we should allow the database to start issuing new
// transactions once we fix the main thread. E.g.:
//
// if (transaction->GetMode() == IDBTransaction::VERSION_CHANGE) {
// transaction->Database()->ExitSetVersionTransaction();
// }
if (transaction->GetMode() == IDBTransaction::VERSION_CHANGE) {
transaction->Database()->ExitSetVersionTransaction();
}
nsRefPtr<CommitHelper> helper = new CommitHelper(transaction, aRv);

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

@ -71,6 +71,7 @@
is(db.objectStoreNames.length, 1, "Correct objectStoreNames length");
ok(db.objectStoreNames.contains("foo"), "Has correct objectStore");
let originalRequest = request;
request = objectStore.add({}, 1);
request.onsuccess = grabEventAndContinueHandler;
request.onerror = errorHandler;
@ -88,10 +89,13 @@
is(db.objectStoreNames.length, 1, "Correct objectStoreNames length");
is(trans.error.name, "ConstraintError", "Right error");
ok(trans.error === request.error, "Object identity holds");
is(originalRequest.transaction, trans, "request.transaction should still be set");
event = yield;
is(event.type, "error", "Got request error event");
is(event.target, originalRequest, "error event has right target");
is(event.target.error.name, "ConstraintError", "Right error");
is(originalRequest.transaction, null, "request.transaction should now be null");
let request = mozIndexedDB.open(window.location.pathname, 1);
request.onerror = errorHandler;

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

@ -7,7 +7,17 @@ var testGenerator = testSteps();
function executeSoon(aFun)
{
SimpleTest.executeSoon(aFun);
let comp = SpecialPowers.wrap(Components);
let thread = comp.classes["@mozilla.org/thread-manager;1"]
.getService(comp.interfaces.nsIThreadManager)
.mainThread;
thread.dispatch({
run: function() {
aFun();
}
}, Components.interfaces.nsIThread.DISPATCH_NORMAL);
}
function clearAllDatabases(callback) {

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

@ -48,14 +48,11 @@ function testSteps()
event = yield;
is(event.type, "complete", "Got complete event");
// The database is still not fully open here.
try {
db.transaction("foo");
ok(false, "Transactions should be disallowed now!");
ok(true, "Transactions should be allowed now!");
} catch (e) {
ok(e instanceof DOMException, "Expect a DOMException");
is(e.name, "InvalidStateError", "Expect an InvalidStateError");
is(e.code, DOMException.INVALID_STATE_ERR, "Expect an INVALID_STATE_ERR");
ok(false, "Transactions should be allowed now!");
}
request.onsuccess = grabEventAndContinueHandler;

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

@ -10,17 +10,69 @@ function testSteps()
let request = mozIndexedDB.open(this.window ? window.location.pathname : "Splendid Test", 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
let event = yield;
let db = event.target.result;
db.onerror = errorHandler;
event.target.onsuccess = continueToNextStep;
event.target.transaction.onerror = errorHandler;
event.target.transaction.oncomplete = grabEventAndContinueHandler;
db.createObjectStore("foo", { autoIncrement: true });
let os = db.createObjectStore("foo", { autoIncrement: true });
let index = os.createIndex("bar", "foo.bar");
event = yield;
is(request.transaction, event.target,
"request.transaction should still be set");
request.onsuccess = grabEventAndContinueHandler;
event = yield;
is(request.transaction, null, "request.transaction should be cleared");
let transaction = db.transaction("foo", "readwrite");
os = transaction.objectStore("foo");
// Place a request to keep the transaction alive long enough for our
// executeSoon.
let requestComplete = false;
let wasAbleToGrabObjectStoreOutsideOfCallback = false;
let wasAbleToGrabIndexOutsideOfCallback = false;
executeSoon(function() {
ok(!requestComplete, "Ordering is correct.");
wasAbleToGrabObjectStoreOutsideOfCallback = !!transaction.objectStore("foo");
wasAbleToGrabIndexOutsideOfCallback =
!!transaction.objectStore("foo").index("bar");
});
request = os.add({});
request.onerror = errorHandler;
request.onsuccess = grabEventAndContinueHandler;
event = yield;
requestComplete = true;
ok(wasAbleToGrabObjectStoreOutsideOfCallback,
"Should be able to get objectStore");
ok(wasAbleToGrabIndexOutsideOfCallback,
"Should be able to get index");
transaction.oncomplete = grabEventAndContinueHandler;
yield;
let transaction = db.transaction("foo");
try {
transaction.objectStore("foo");
ok(false, "Should have thrown!");
}
catch (e) {
ok(e instanceof DOMException, "Got database exception.");
is(e.name, "InvalidStateError", "Good error.");
is(e.code, DOMException.INVALID_STATE_ERR, "Good error code.");
}
continueToNextStep();
yield;

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

@ -1206,9 +1206,7 @@ TouchButtonAccumulator::TouchButtonAccumulator() :
}
void TouchButtonAccumulator::configure(InputDevice* device) {
// Some input devices return erroneous information to us,
// which lead to have only hovering pointer ids.
//mHaveBtnTouch = device->hasKey(BTN_TOUCH);
mHaveBtnTouch = device->hasKey(BTN_TOUCH);
}
void TouchButtonAccumulator::reset(InputDevice* device) {