зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to graphics
MozReview-Commit-ID: FOyS87VawTT
This commit is contained in:
Коммит
ca041b7c5a
|
@ -210,7 +210,6 @@ toolkit/content/widgets/wizard.xml
|
|||
toolkit/components/jsdownloads/src/DownloadIntegration.jsm
|
||||
toolkit/components/url-classifier/**
|
||||
toolkit/components/urlformatter/nsURLFormatter.js
|
||||
toolkit/identity/FirefoxAccounts.jsm
|
||||
toolkit/modules/AppConstants.jsm
|
||||
toolkit/mozapps/downloads/nsHelperAppDlg.js
|
||||
toolkit/mozapps/extensions/internal/AddonConstants.jsm
|
||||
|
|
|
@ -9,6 +9,7 @@ module.exports = {
|
|||
"mozilla/import-globals": "warn",
|
||||
"mozilla/no-import-into-var-and-global": "error",
|
||||
"mozilla/no-useless-parameters": "error",
|
||||
"mozilla/no-useless-removeEventListener": "error",
|
||||
|
||||
// No (!foo in bar) or (!object instanceof Class)
|
||||
"no-unsafe-negation": "error",
|
||||
|
|
|
@ -217,9 +217,10 @@ NotificationController::QueueMutationEvent(AccTreeMutationEvent* aEvent)
|
|||
mutEvent->IsHide()) {
|
||||
AccHideEvent* prevHide = downcast_accEvent(prevEvent);
|
||||
AccTextChangeEvent* prevTextChange = prevHide->mTextChangeEvent;
|
||||
if (prevTextChange) {
|
||||
if (prevTextChange && prevHide->Parent() == mutEvent->Parent()) {
|
||||
if (prevHide->mNextSibling == target) {
|
||||
target->AppendTextTo(prevTextChange->mModifiedText);
|
||||
prevHide->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
|
||||
} else if (prevHide->mPrevSibling == target) {
|
||||
nsString temp;
|
||||
target->AppendTextTo(temp);
|
||||
|
@ -228,28 +229,27 @@ NotificationController::QueueMutationEvent(AccTreeMutationEvent* aEvent)
|
|||
temp += prevTextChange->mModifiedText;;
|
||||
prevTextChange->mModifiedText = temp;
|
||||
prevTextChange->mStart -= extraLen;
|
||||
prevHide->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
|
||||
}
|
||||
|
||||
prevHide->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
|
||||
}
|
||||
} else if (prevEvent && mutEvent->IsShow() &&
|
||||
prevEvent->GetEventType() == nsIAccessibleEvent::EVENT_SHOW) {
|
||||
AccShowEvent* prevShow = downcast_accEvent(prevEvent);
|
||||
AccTextChangeEvent* prevTextChange = prevShow->mTextChangeEvent;
|
||||
if (prevTextChange) {
|
||||
if (prevTextChange && prevShow->Parent() == target->Parent()) {
|
||||
int32_t index = target->IndexInParent();
|
||||
int32_t prevIndex = prevShow->GetAccessible()->IndexInParent();
|
||||
if (prevIndex + 1 == index) {
|
||||
target->AppendTextTo(prevTextChange->mModifiedText);
|
||||
prevShow->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
|
||||
} else if (index + 1 == prevIndex) {
|
||||
nsString temp;
|
||||
target->AppendTextTo(temp);
|
||||
prevTextChange->mStart -= temp.Length();
|
||||
temp += prevTextChange->mModifiedText;
|
||||
prevTextChange->mModifiedText = temp;
|
||||
prevShow->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
|
||||
}
|
||||
|
||||
prevShow->mTextChangeEvent.swap(mutEvent->mTextChangeEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,13 @@
|
|||
#include "nsAccUtils.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#include "AccessibleWrap.h"
|
||||
#include "Compatibility.h"
|
||||
#include "nsWinUtils.h"
|
||||
#include "RootAccessible.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
|
@ -35,13 +42,13 @@ DocAccessibleParent::RecvShowEvent(const ShowEventData& aData,
|
|||
// required show events.
|
||||
if (!parent) {
|
||||
NS_ERROR("adding child to unknown accessible");
|
||||
return IPC_OK();
|
||||
return IPC_FAIL(this, "unknown parent accessible");
|
||||
}
|
||||
|
||||
uint32_t newChildIdx = aData.Idx();
|
||||
if (newChildIdx > parent->ChildrenCount()) {
|
||||
NS_ERROR("invalid index to add child at");
|
||||
return IPC_OK();
|
||||
return IPC_FAIL(this, "invalid index");
|
||||
}
|
||||
|
||||
uint32_t consumed = AddSubtree(parent, aData.NewTree(), 0, newChildIdx);
|
||||
|
@ -50,7 +57,7 @@ DocAccessibleParent::RecvShowEvent(const ShowEventData& aData,
|
|||
// XXX This shouldn't happen, but if we failed to add children then the below
|
||||
// is pointless and can crash.
|
||||
if (!consumed) {
|
||||
return IPC_OK();
|
||||
return IPC_FAIL(this, "failed to add children");
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -525,7 +532,43 @@ DocAccessibleParent::SetCOMProxy(const RefPtr<IAccessible>& aCOMProxy)
|
|||
|
||||
IAccessibleHolder::COMPtrType ptr(rawNative);
|
||||
IAccessibleHolder holder(Move(ptr));
|
||||
Unused << SendParentCOMProxy(holder);
|
||||
|
||||
if (nsWinUtils::IsWindowEmulationStarted()) {
|
||||
RootAccessible* rootDocument = outerDoc->RootAccessible();
|
||||
MOZ_ASSERT(rootDocument);
|
||||
|
||||
bool isActive = true;
|
||||
nsIntRect rect(CW_USEDEFAULT, CW_USEDEFAULT, 0, 0);
|
||||
if (Compatibility::IsDolphin()) {
|
||||
rect = Bounds();
|
||||
nsIntRect rootRect = rootDocument->Bounds();
|
||||
rect.x = rootRect.x - rect.x;
|
||||
rect.y -= rootRect.y;
|
||||
tab->GetDocShellIsActive(&isActive);
|
||||
}
|
||||
|
||||
HWND parentWnd = reinterpret_cast<HWND>(rootDocument->GetNativeWindow());
|
||||
HWND hWnd = nsWinUtils::CreateNativeWindow(kClassNameTabContent,
|
||||
parentWnd, rect.x, rect.y,
|
||||
rect.width, rect.height,
|
||||
isActive);
|
||||
if (hWnd) {
|
||||
// Attach accessible document to the emulated native window
|
||||
::SetPropW(hWnd, kPropNameDocAccParent, (HANDLE)this);
|
||||
SetEmulatedWindowHandle(hWnd);
|
||||
}
|
||||
}
|
||||
Unused << SendParentCOMProxy(holder, reinterpret_cast<uintptr_t>(
|
||||
mEmulatedWindowHandle));
|
||||
}
|
||||
|
||||
void
|
||||
DocAccessibleParent::SetEmulatedWindowHandle(HWND aWindowHandle)
|
||||
{
|
||||
if (!aWindowHandle && mEmulatedWindowHandle && IsTopLevel()) {
|
||||
::DestroyWindow(mEmulatedWindowHandle);
|
||||
}
|
||||
mEmulatedWindowHandle = aWindowHandle;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
|
|
@ -30,6 +30,9 @@ public:
|
|||
DocAccessibleParent() :
|
||||
ProxyAccessible(this), mParentDoc(nullptr),
|
||||
mTopLevel(false), mShutdown(false)
|
||||
#if defined(XP_WIN)
|
||||
, mEmulatedWindowHandle(nullptr)
|
||||
#endif // defined(XP_WIN)
|
||||
{ MOZ_COUNT_CTOR_INHERITED(DocAccessibleParent, ProxyAccessible); }
|
||||
~DocAccessibleParent()
|
||||
{
|
||||
|
@ -111,7 +114,11 @@ public:
|
|||
*/
|
||||
void RemoveChildDoc(DocAccessibleParent* aChildDoc)
|
||||
{
|
||||
aChildDoc->Parent()->ClearChildDoc(aChildDoc);
|
||||
ProxyAccessible* parent = aChildDoc->Parent();
|
||||
MOZ_ASSERT(parent);
|
||||
if (parent) {
|
||||
aChildDoc->Parent()->ClearChildDoc(aChildDoc);
|
||||
}
|
||||
mChildDocs.RemoveElement(aChildDoc);
|
||||
aChildDoc->mParentDoc = nullptr;
|
||||
MOZ_ASSERT(aChildDoc->mChildDocs.Length() == 0);
|
||||
|
@ -147,6 +154,13 @@ public:
|
|||
|
||||
virtual mozilla::ipc::IPCResult RecvGetWindowedPluginIAccessible(
|
||||
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) override;
|
||||
|
||||
/**
|
||||
* Set emulated native window handle for a document.
|
||||
* @param aWindowHandle emulated native window handle
|
||||
*/
|
||||
void SetEmulatedWindowHandle(HWND aWindowHandle);
|
||||
HWND GetEmulatedWindowHandle() const { return mEmulatedWindowHandle; }
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -183,6 +197,11 @@ private:
|
|||
nsTArray<DocAccessibleParent*> mChildDocs;
|
||||
DocAccessibleParent* mParentDoc;
|
||||
|
||||
#if defined(XP_WIN)
|
||||
// The handle associated with the emulated window that contains this document
|
||||
HWND mEmulatedWindowHandle;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Conceptually this is a map from IDs to proxies, but we store the ID in the
|
||||
* proxy object so we can't use a real map.
|
||||
|
|
|
@ -18,6 +18,7 @@ static StaticAutoPtr<PlatformChild> sPlatformChild;
|
|||
|
||||
DocAccessibleChild::DocAccessibleChild(DocAccessible* aDoc)
|
||||
: DocAccessibleChildBase(aDoc)
|
||||
, mEmulatedWindowHandle(nullptr)
|
||||
, mIsRemoteConstructed(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR_INHERITED(DocAccessibleChild, DocAccessibleChildBase);
|
||||
|
@ -45,11 +46,13 @@ DocAccessibleChild::Shutdown()
|
|||
}
|
||||
|
||||
ipc::IPCResult
|
||||
DocAccessibleChild::RecvParentCOMProxy(const IAccessibleHolder& aParentCOMProxy)
|
||||
DocAccessibleChild::RecvParentCOMProxy(const IAccessibleHolder& aParentCOMProxy,
|
||||
const WindowsHandle& aEmulatedWindowHandle)
|
||||
{
|
||||
MOZ_ASSERT(!mParentProxy && !aParentCOMProxy.IsNull());
|
||||
mParentProxy.reset(const_cast<IAccessibleHolder&>(aParentCOMProxy).Release());
|
||||
SetConstructedInParentProcess();
|
||||
mEmulatedWindowHandle = reinterpret_cast<HWND>(aEmulatedWindowHandle);
|
||||
|
||||
for (uint32_t i = 0, l = mDeferredEvents.Length(); i < l; ++i) {
|
||||
mDeferredEvents[i]->Dispatch();
|
||||
|
|
|
@ -28,7 +28,10 @@ public:
|
|||
virtual void Shutdown() override;
|
||||
|
||||
virtual ipc::IPCResult
|
||||
RecvParentCOMProxy(const IAccessibleHolder& aParentCOMProxy) override;
|
||||
RecvParentCOMProxy(const IAccessibleHolder& aParentCOMProxy,
|
||||
const WindowsHandle& aEmulatedWindowHandle) override;
|
||||
|
||||
HWND GetEmulatedWindowHandle() const { return mEmulatedWindowHandle; }
|
||||
|
||||
IAccessible* GetParentIAccessible() const { return mParentProxy.get(); }
|
||||
|
||||
|
@ -310,6 +313,7 @@ private:
|
|||
bool mIsRemoteConstructed;
|
||||
mscom::ProxyUniquePtr<IAccessible> mParentProxy;
|
||||
nsTArray<UniquePtr<DeferredEvent>> mDeferredEvents;
|
||||
HWND mEmulatedWindowHandle;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
|
|
|
@ -66,7 +66,8 @@ parent:
|
|||
returns (IAccessibleHolder aPluginCOMProxy);
|
||||
|
||||
child:
|
||||
async ParentCOMProxy(IAccessibleHolder aParentCOMProxy);
|
||||
async ParentCOMProxy(IAccessibleHolder aParentCOMProxy,
|
||||
WindowsHandle aEmulatedWindowHandle);
|
||||
|
||||
async __delete__();
|
||||
};
|
||||
|
|
|
@ -1763,13 +1763,14 @@ function nofocusChecker(aID)
|
|||
* Text inserted/removed events checker.
|
||||
* @param aFromUser [in, optional] kNotFromUserInput or kFromUserInput
|
||||
*/
|
||||
function textChangeChecker(aID, aStart, aEnd, aTextOrFunc, aIsInserted, aFromUser)
|
||||
function textChangeChecker(aID, aStart, aEnd, aTextOrFunc, aIsInserted, aFromUser, aAsync)
|
||||
{
|
||||
this.target = getNode(aID);
|
||||
this.type = aIsInserted ? EVENT_TEXT_INSERTED : EVENT_TEXT_REMOVED;
|
||||
this.startOffset = aStart;
|
||||
this.endOffset = aEnd;
|
||||
this.textOrFunc = aTextOrFunc;
|
||||
this.async = aAsync;
|
||||
|
||||
this.match = function stextChangeChecker_match(aEvent)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,8 @@ support-files =
|
|||
[test_aria_owns.html]
|
||||
[test_aria_statechange.html]
|
||||
[test_attrs.html]
|
||||
[test_bug1322593.html]
|
||||
[test_bug1322593-2.html]
|
||||
[test_caretmove.html]
|
||||
[test_caretmove.xul]
|
||||
[test_coalescence.html]
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Accessible mutation events testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function changeMultipleElements()
|
||||
{
|
||||
this.node1 = getNode("span1");
|
||||
this.node2 = getNode("span2");
|
||||
|
||||
this.eventSeq = [
|
||||
new textChangeChecker("container", 0, 5, "hello", false, undefined, true),
|
||||
new textChangeChecker("container", 6, 11, "world", false, undefined, true),
|
||||
new orderChecker(),
|
||||
new textChangeChecker("container", 0, 1, "a", true, undefined, true),
|
||||
new textChangeChecker("container", 7, 8, "b", true, undefined, true)
|
||||
];
|
||||
|
||||
this.invoke = function changeMultipleElements_invoke()
|
||||
{
|
||||
this.node1.textContent = "a";
|
||||
this.node2.textContent = "b";
|
||||
}
|
||||
|
||||
this.getID = function changeMultipleElements_invoke_getID()
|
||||
{
|
||||
return "Change the text content of multiple sibling divs";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
// gA11yEventDumpToConsole = true; // debugging
|
||||
|
||||
var gQueue = null;
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
|
||||
gQueue.push(new changeMultipleElements());
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTests);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1322593"
|
||||
title="missing text change events when multiple elements updated at once">
|
||||
Mozilla Bug 1322593
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="container">
|
||||
<span id="span1">hello</span>
|
||||
<span>your</span>
|
||||
<span id="span2">world</span>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,80 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>Accessible mutation events testing</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="../common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="../events.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function changeMultipleElements()
|
||||
{
|
||||
this.node1 = getNode("div1");
|
||||
this.node2 = getNode("div2");
|
||||
|
||||
this.eventSeq = [
|
||||
new textChangeChecker("div1", 0, 5, "hello", false, undefined, true),
|
||||
new textChangeChecker("div2", 0, 5, "world", false, undefined, true),
|
||||
new orderChecker(),
|
||||
new textChangeChecker("div1", 0, 1, "a", true, undefined, true),
|
||||
new textChangeChecker("div2", 0, 1, "b", true, undefined, true)
|
||||
];
|
||||
|
||||
this.invoke = function changeMultipleElements_invoke()
|
||||
{
|
||||
this.node1.textContent = "a";
|
||||
this.node2.textContent = "b";
|
||||
}
|
||||
|
||||
this.getID = function changeMultipleElements_invoke_getID()
|
||||
{
|
||||
return "Change the text content of multiple sibling divs";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
// gA11yEventDumpToConsole = true; // debugging
|
||||
|
||||
var gQueue = null;
|
||||
function doTests()
|
||||
{
|
||||
gQueue = new eventQueue();
|
||||
|
||||
gQueue.push(new changeMultipleElements());
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTests);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=1322593"
|
||||
title="missing text change events when multiple elements updated at once">
|
||||
Mozilla Bug 1322593
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="div1">hello</div>
|
||||
<div id="div2">world</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1399,8 +1399,11 @@ AccessibleWrap::GetIAccessibleFor(const VARIANT& aVarChild, bool* aIsDefunct)
|
|||
}
|
||||
|
||||
// If the MSAA ID is not a chrome id then we already know that we won't
|
||||
// find it here and should look remotely instead.
|
||||
if (XRE_IsParentProcess() && !sIDGen.IsChromeID(varChild.lVal)) {
|
||||
// find it here and should look remotely instead. This handles the case when
|
||||
// accessible is part of the chrome process and is part of the xul browser
|
||||
// window and the child id points in the content documents. Thus we need to
|
||||
// make sure that it is never called on proxies.
|
||||
if (XRE_IsParentProcess() && !IsProxy() && !sIDGen.IsChromeID(varChild.lVal)) {
|
||||
return GetRemoteIAccessibleFor(varChild);
|
||||
}
|
||||
MOZ_ASSERT(XRE_IsParentProcess() ||
|
||||
|
@ -1471,7 +1474,6 @@ AccessibleWrap::GetIAccessibleFor(const VARIANT& aVarChild, bool* aIsDefunct)
|
|||
already_AddRefed<IAccessible>
|
||||
AccessibleWrap::GetRemoteIAccessibleFor(const VARIANT& aVarChild)
|
||||
{
|
||||
DocAccessibleParent* proxyDoc = nullptr;
|
||||
DocAccessible* doc = Document();
|
||||
const nsTArray<DocAccessibleParent*>* remoteDocs =
|
||||
DocManager::TopLevelRemoteDocs();
|
||||
|
|
|
@ -120,6 +120,11 @@ DocAccessibleWrap::GetNativeWindow() const
|
|||
{
|
||||
if (XRE_IsContentProcess()) {
|
||||
DocAccessibleChild* ipcDoc = IPCDoc();
|
||||
HWND hWnd = ipcDoc->GetEmulatedWindowHandle();
|
||||
if (hWnd) {
|
||||
return hWnd;
|
||||
}
|
||||
|
||||
auto tab = static_cast<dom::TabChild*>(ipcDoc->Manager());
|
||||
MOZ_ASSERT(tab);
|
||||
return reinterpret_cast<HWND>(tab->GetNativeWindowHandle());
|
||||
|
|
|
@ -85,6 +85,10 @@ a11y::ProxyDestroyed(ProxyAccessible* aProxy)
|
|||
if (!wrapper)
|
||||
return;
|
||||
|
||||
if (aProxy->IsDoc() && nsWinUtils::IsWindowEmulationStarted()) {
|
||||
aProxy->AsDoc()->SetEmulatedWindowHandle(nullptr);
|
||||
}
|
||||
|
||||
wrapper->Shutdown();
|
||||
aProxy->SetWrapper(0);
|
||||
wrapper->Release();
|
||||
|
|
|
@ -14,6 +14,7 @@ EXPORTS.mozilla.a11y += [
|
|||
'HyperTextAccessibleWrap.h',
|
||||
'IDSet.h',
|
||||
'MsaaIdGenerator.h',
|
||||
'nsWinUtils.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "nsAccessibilityService.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
#include "mozilla/a11y/DocAccessibleParent.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsArrayUtils.h"
|
||||
#include "nsIArray.h"
|
||||
|
@ -20,6 +21,7 @@
|
|||
#include "nsIDocShellTreeItem.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "ProxyWrappers.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
@ -153,18 +155,25 @@ WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|||
// for details).
|
||||
int32_t objId = static_cast<DWORD>(lParam);
|
||||
if (objId == OBJID_CLIENT) {
|
||||
IAccessible* msaaAccessible = nullptr;
|
||||
DocAccessible* document =
|
||||
reinterpret_cast<DocAccessible*>(::GetPropW(hWnd, kPropNameDocAcc));
|
||||
if (document) {
|
||||
IAccessible* msaaAccessible = nullptr;
|
||||
document->GetNativeInterface((void**)&msaaAccessible); // does an addref
|
||||
if (msaaAccessible) {
|
||||
LRESULT result = ::LresultFromObject(IID_IAccessible, wParam,
|
||||
msaaAccessible); // does an addref
|
||||
msaaAccessible->Release(); // release extra addref
|
||||
return result;
|
||||
} else {
|
||||
DocAccessibleParent* docParent = static_cast<DocAccessibleParent*>(
|
||||
::GetPropW(hWnd, kPropNameDocAccParent));
|
||||
if (docParent) {
|
||||
auto wrapper = WrapperFor(docParent);
|
||||
wrapper->GetNativeInterface((void**)&msaaAccessible); // does an addref
|
||||
}
|
||||
}
|
||||
if (msaaAccessible) {
|
||||
LRESULT result = ::LresultFromObject(IID_IAccessible, wParam,
|
||||
msaaAccessible); // does an addref
|
||||
msaaAccessible->Release(); // release extra addref
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ class DocAccessible;
|
|||
const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass";
|
||||
const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass";
|
||||
const LPCWSTR kPropNameDocAcc = L"MozDocAccessible";
|
||||
const LPCWSTR kPropNameDocAccParent = L"MozDocAccessibleParent";
|
||||
|
||||
class nsWinUtils
|
||||
{
|
||||
|
|
|
@ -214,7 +214,10 @@ XULMenuitemAccessible::KeyboardShortcut() const
|
|||
nsAutoString keyCodeStr;
|
||||
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr);
|
||||
nsresult errorCode;
|
||||
key = keyStr.ToInteger(&errorCode, kAutoDetect);
|
||||
key = keyStr.ToInteger(&errorCode, kRadix10);
|
||||
if (NS_FAILED(errorCode)) {
|
||||
key = keyStr.ToInteger(&errorCode, kRadix16);
|
||||
}
|
||||
} else {
|
||||
key = keyStr[0];
|
||||
}
|
||||
|
|
|
@ -51,10 +51,9 @@ window.location = "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window/>"
|
|||
// Create a promise that is delivered once add-on window is interactive,
|
||||
// used by add-on runner to defer add-on loading until window is ready.
|
||||
var { promise, resolve } = defer();
|
||||
eventTarget.addEventListener("DOMContentLoaded", function handler(event) {
|
||||
eventTarget.removeEventListener("DOMContentLoaded", handler);
|
||||
eventTarget.addEventListener("DOMContentLoaded", function(event) {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
exports.ready = promise;
|
||||
exports.window = window;
|
||||
|
|
|
@ -317,10 +317,9 @@ TestRunner.prototype = {
|
|||
resolve()
|
||||
}
|
||||
else {
|
||||
win.addEventListener("DOMContentLoaded", function onLoad() {
|
||||
win.removeEventListener("DOMContentLoaded", onLoad);
|
||||
win.addEventListener("DOMContentLoaded", function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,8 +19,7 @@ const open = ({ id }) => new Promise((resolve, reject) => {
|
|||
let browser = getBrowserForTab(tab);
|
||||
|
||||
// waiting for the about:addons page to load
|
||||
browser.addEventListener("load", function onPageLoad() {
|
||||
browser.removeEventListener("load", onPageLoad, true);
|
||||
browser.addEventListener("load", function() {
|
||||
let window = browser.contentWindow;
|
||||
|
||||
// wait for the add-on's "addon-options-displayed"
|
||||
|
@ -37,6 +36,6 @@ const open = ({ id }) => new Promise((resolve, reject) => {
|
|||
|
||||
// display the add-on inline preferences page
|
||||
window.gViewController.commands.cmd_showItemDetails.doCommand({ id: id }, true);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
});
|
||||
exports.open = open;
|
||||
|
|
|
@ -74,9 +74,7 @@ const registerFrame = ({id, url}) => {
|
|||
outerFrame.setAttribute("scrolling", "no");
|
||||
outerFrame.setAttribute("disablehistory", true);
|
||||
outerFrame.setAttribute("seamless", "seamless");
|
||||
outerFrame.addEventListener("load", function onload() {
|
||||
outerFrame.removeEventListener("load", onload, true);
|
||||
|
||||
outerFrame.addEventListener("load", function() {
|
||||
let doc = outerFrame.contentDocument;
|
||||
|
||||
let innerFrame = doc.createElementNS(HTML_NS, "iframe");
|
||||
|
@ -91,7 +89,7 @@ const registerFrame = ({id, url}) => {
|
|||
"left: 0", "overflow: hidden"].join(";"));
|
||||
|
||||
doc.body.appendChild(innerFrame);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
view.appendChild(outerFrame);
|
||||
|
||||
|
|
|
@ -213,10 +213,9 @@ function onFocus(window) {
|
|||
resolve(window);
|
||||
}
|
||||
else {
|
||||
window.addEventListener("focus", function focusListener() {
|
||||
window.removeEventListener("focus", focusListener, true);
|
||||
window.addEventListener("focus", function() {
|
||||
resolve(window);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
||||
return promise;
|
||||
|
|
|
@ -21,10 +21,9 @@ exports.testCrossDomainIframe = function(assert, done) {
|
|||
contentScript: "new " + function ContentScriptScope() {
|
||||
self.on("message", function (url) {
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.addEventListener("load", function onload() {
|
||||
iframe.removeEventListener("load", onload);
|
||||
iframe.addEventListener("load", function() {
|
||||
self.postMessage(iframe.contentWindow.document.body.innerHTML);
|
||||
});
|
||||
}, {once: true});
|
||||
iframe.setAttribute("src", url);
|
||||
document.documentElement.appendChild(iframe);
|
||||
});
|
||||
|
|
|
@ -173,8 +173,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
|
|||
let ifWindow = helper.xrayWindow.document.getElementById("iframe").contentWindow;
|
||||
// Listen without proxies, to check that it will work in regular case
|
||||
// simulate listening from a web document.
|
||||
ifWindow.addEventListener("message", function listener(event) {
|
||||
ifWindow.removeEventListener("message", listener);
|
||||
ifWindow.addEventListener("message", function(event) {
|
||||
// As we are in system principal, event is an XrayWrapper
|
||||
// xrays use current compartments when calling postMessage method.
|
||||
// Whereas js proxies was using postMessage method compartment,
|
||||
|
@ -187,7 +186,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
|
|||
"message data is correct");
|
||||
|
||||
helper.done();
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
helper.createWorker(
|
||||
'new ' + function ContentScriptScope() {
|
||||
|
@ -658,9 +657,7 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
|
|||
|
||||
let addEventListenerCalled = false;
|
||||
let expandoCalled = false;
|
||||
input.addEventListener("click", function onclick(event) {
|
||||
input.removeEventListener("click", onclick, true);
|
||||
|
||||
input.addEventListener("click", function (event) {
|
||||
assert(!addEventListenerCalled, "closure given to addEventListener is called once");
|
||||
if (addEventListenerCalled)
|
||||
return;
|
||||
|
@ -689,7 +686,7 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
|
|||
input.click();
|
||||
}, 0);
|
||||
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
input.click();
|
||||
}
|
||||
|
@ -747,21 +744,18 @@ exports["test Cross Domain Iframe"] = createProxyTest("", function (helper) {
|
|||
self.on("message", function (url) {
|
||||
// Creates an iframe with this page
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.addEventListener("load", function onload() {
|
||||
iframe.removeEventListener("load", onload, true);
|
||||
iframe.addEventListener("load", function() {
|
||||
try {
|
||||
// Try to communicate with iframe's content
|
||||
window.addEventListener("message", function onmessage(event) {
|
||||
window.removeEventListener("message", onmessage, true);
|
||||
|
||||
window.addEventListener("message", function(event) {
|
||||
assert(event.data == "hello world", "COW works properly");
|
||||
self.port.emit("end");
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
iframe.contentWindow.postMessage("hello", "*");
|
||||
} catch(e) {
|
||||
assert(false, "COW fails : "+e.message);
|
||||
}
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
iframe.setAttribute("src", url);
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
|
|
|
@ -75,8 +75,7 @@ function loadAndWait(browser, url, callback) {
|
|||
function WorkerTest(url, callback) {
|
||||
return function testFunction(assert, done) {
|
||||
let chromeWindow = makeWindow();
|
||||
chromeWindow.addEventListener("load", function onload() {
|
||||
chromeWindow.removeEventListener("load", onload, true);
|
||||
chromeWindow.addEventListener("load", function() {
|
||||
let browser = chromeWindow.document.createElement("browser");
|
||||
browser.setAttribute("type", "content");
|
||||
chromeWindow.document.documentElement.appendChild(browser);
|
||||
|
@ -90,7 +89,7 @@ function WorkerTest(url, callback) {
|
|||
});
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -767,8 +766,7 @@ exports["test:check worker API with page history"] = WorkerTest(
|
|||
}, 0);
|
||||
|
||||
// Wait for the document to be hidden
|
||||
browser.addEventListener("pagehide", function onpagehide() {
|
||||
browser.removeEventListener("pagehide", onpagehide);
|
||||
browser.addEventListener("pagehide", function() {
|
||||
// Now any event sent to this worker should be cached
|
||||
|
||||
worker.postMessage("message");
|
||||
|
@ -808,7 +806,7 @@ exports["test:check worker API with page history"] = WorkerTest(
|
|||
browser.goForward();
|
||||
}, 500);
|
||||
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -13,14 +13,13 @@ exports["test sdk/event/dom does not leak when attached to closed window"] = fun
|
|||
let loader = Loader(module);
|
||||
let { open } = loader.require('sdk/event/dom');
|
||||
let w = openWindow();
|
||||
w.addEventListener("DOMWindowClose", function windowClosed(evt) {
|
||||
w.removeEventListener("DOMWindowClose", windowClosed);
|
||||
w.addEventListener("DOMWindowClose", function(evt) {
|
||||
// The sdk/event/dom module tries to clean itself up when DOMWindowClose
|
||||
// is fired. Verify that it doesn't leak if its attached to an
|
||||
// already closed window either. (See bug 1268898.)
|
||||
open(w.document, "TestEvent1");
|
||||
resolve(loader);
|
||||
});
|
||||
}, {once: true});
|
||||
w.close();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -13,14 +13,12 @@ exports["test sdk/tab/events does not leak new window"] = function*(assert) {
|
|||
let loader = Loader(module);
|
||||
let { events } = loader.require('sdk/tab/events');
|
||||
let w = openWindow();
|
||||
w.addEventListener("load", function windowLoaded(evt) {
|
||||
w.removeEventListener("load", windowLoaded);
|
||||
w.addEventListener("DOMWindowClose", function windowClosed(evt) {
|
||||
w.removeEventListener("DOMWindowClose", windowClosed);
|
||||
w.addEventListener("load", function(evt) {
|
||||
w.addEventListener("DOMWindowClose", function(evt) {
|
||||
resolve(loader);
|
||||
});
|
||||
}, {once: true});
|
||||
w.close();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -30,15 +28,13 @@ exports["test sdk/tab/events does not leak when attached to existing window"] =
|
|||
return new Promise(resolve => {
|
||||
let loader = Loader(module);
|
||||
let w = openWindow();
|
||||
w.addEventListener("load", function windowLoaded(evt) {
|
||||
w.removeEventListener("load", windowLoaded);
|
||||
w.addEventListener("load", function(evt) {
|
||||
let { events } = loader.require('sdk/tab/events');
|
||||
w.addEventListener("DOMWindowClose", function windowClosed(evt) {
|
||||
w.removeEventListener("DOMWindowClose", windowClosed);
|
||||
w.addEventListener("DOMWindowClose", function(evt) {
|
||||
resolve(loader);
|
||||
});
|
||||
}, {once: true});
|
||||
w.close();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -49,15 +49,13 @@ exports["test window/events for leaks with existing window"] = function*(assert)
|
|||
return new Promise((resolve, reject) => {
|
||||
let loader = Loader(module);
|
||||
let w = open();
|
||||
w.addEventListener("load", function windowLoaded(evt) {
|
||||
w.removeEventListener("load", windowLoaded);
|
||||
w.addEventListener("load", function(evt) {
|
||||
let { events } = loader.require("sdk/window/events");
|
||||
w.addEventListener("DOMWindowClose", function windowClosed(evt) {
|
||||
w.removeEventListener("DOMWindowClose", windowClosed);
|
||||
w.addEventListener("DOMWindowClose", function(evt) {
|
||||
resolve(loader);
|
||||
});
|
||||
}, {once: true});
|
||||
w.close();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -13,10 +13,9 @@ function openTab(rawWindow, url) {
|
|||
return resolve();
|
||||
}
|
||||
|
||||
window.addEventListener("load", function onLoad() {
|
||||
window.removeEventListener("load", onLoad, true);
|
||||
window.addEventListener("load", function() {
|
||||
resolve();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
return null;
|
||||
})
|
||||
|
|
|
@ -173,8 +173,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
|
|||
let ifWindow = helper.xrayWindow.document.getElementById("iframe").contentWindow;
|
||||
// Listen without proxies, to check that it will work in regular case
|
||||
// simulate listening from a web document.
|
||||
ifWindow.addEventListener("message", function listener(event) {
|
||||
ifWindow.removeEventListener("message", listener);
|
||||
ifWindow.addEventListener("message", function(event) {
|
||||
// As we are in system principal, event is an XrayWrapper
|
||||
// xrays use current compartments when calling postMessage method.
|
||||
// Whereas js proxies was using postMessage method compartment,
|
||||
|
@ -187,7 +186,7 @@ exports["test postMessage"] = createProxyTest(html, function (helper, assert) {
|
|||
"message data is correct");
|
||||
|
||||
helper.done();
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
helper.createWorker(
|
||||
'new ' + function ContentScriptScope() {
|
||||
|
@ -659,8 +658,6 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
|
|||
let addEventListenerCalled = false;
|
||||
let expandoCalled = false;
|
||||
input.addEventListener("click", function onclick(event) {
|
||||
input.removeEventListener("click", onclick, true);
|
||||
|
||||
assert(!addEventListenerCalled, "closure given to addEventListener is called once");
|
||||
if (addEventListenerCalled)
|
||||
return;
|
||||
|
@ -689,7 +686,7 @@ exports["test Listeners"] = createProxyTest(html, function (helper) {
|
|||
input.click();
|
||||
}, 0);
|
||||
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
input.click();
|
||||
}
|
||||
|
@ -747,21 +744,18 @@ exports["test Cross Domain Iframe"] = createProxyTest("", function (helper) {
|
|||
self.on("message", function (url) {
|
||||
// Creates an iframe with this page
|
||||
let iframe = document.createElement("iframe");
|
||||
iframe.addEventListener("load", function onload() {
|
||||
iframe.removeEventListener("load", onload, true);
|
||||
iframe.addEventListener("load", function() {
|
||||
try {
|
||||
// Try to communicate with iframe's content
|
||||
window.addEventListener("message", function onmessage(event) {
|
||||
window.removeEventListener("message", onmessage, true);
|
||||
|
||||
window.addEventListener("message", function(event) {
|
||||
assert(event.data == "hello world", "COW works properly");
|
||||
self.port.emit("end");
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
iframe.contentWindow.postMessage("hello", "*");
|
||||
} catch(e) {
|
||||
assert(false, "COW fails : "+e.message);
|
||||
}
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
iframe.setAttribute("src", url);
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
|
|
|
@ -74,8 +74,7 @@ function loadAndWait(browser, url, callback) {
|
|||
function WorkerTest(url, callback) {
|
||||
return function testFunction(assert, done) {
|
||||
let chromeWindow = makeWindow();
|
||||
chromeWindow.addEventListener("load", function onload() {
|
||||
chromeWindow.removeEventListener("load", onload, true);
|
||||
chromeWindow.addEventListener("load", function() {
|
||||
let browser = chromeWindow.document.createElement("browser");
|
||||
browser.setAttribute("type", "content");
|
||||
chromeWindow.document.documentElement.appendChild(browser);
|
||||
|
@ -89,7 +88,7 @@ function WorkerTest(url, callback) {
|
|||
});
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -751,8 +750,7 @@ exports["test:check worker API with page history"] = WorkerTest(
|
|||
}, 0);
|
||||
|
||||
// Wait for the document to be hidden
|
||||
browser.addEventListener("pagehide", function onpagehide() {
|
||||
browser.removeEventListener("pagehide", onpagehide);
|
||||
browser.addEventListener("pagehide", function() {
|
||||
// Now any event sent to this worker should throw
|
||||
|
||||
assert.throws(
|
||||
|
@ -781,7 +779,7 @@ exports["test:check worker API with page history"] = WorkerTest(
|
|||
browser.goForward();
|
||||
}, 500);
|
||||
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -75,8 +75,7 @@ function loadAndWait(browser, url, callback) {
|
|||
function WorkerTest(url, callback) {
|
||||
return function testFunction(assert, done) {
|
||||
let chromeWindow = makeWindow();
|
||||
chromeWindow.addEventListener("load", function onload() {
|
||||
chromeWindow.removeEventListener("load", onload, true);
|
||||
chromeWindow.addEventListener("load", function() {
|
||||
let browser = chromeWindow.document.createElement("browser");
|
||||
browser.setAttribute("type", "content");
|
||||
chromeWindow.document.documentElement.appendChild(browser);
|
||||
|
@ -90,7 +89,7 @@ function WorkerTest(url, callback) {
|
|||
});
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -768,8 +767,7 @@ exports["test:check worker API with page history"] = WorkerTest(
|
|||
}, 0);
|
||||
|
||||
// Wait for the document to be hidden
|
||||
browser.addEventListener("pagehide", function onpagehide() {
|
||||
browser.removeEventListener("pagehide", onpagehide);
|
||||
browser.addEventListener("pagehide", function() {
|
||||
// Now any event sent to this worker should be cached
|
||||
|
||||
worker.postMessage("message");
|
||||
|
@ -809,7 +807,7 @@ exports["test:check worker API with page history"] = WorkerTest(
|
|||
browser.goForward();
|
||||
}, 500);
|
||||
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -29,13 +29,12 @@ exports['test fram has js disabled by default'] = function(assert, done) {
|
|||
uri: 'data:text/html;charset=utf-8,<script>document.documentElement.innerHTML' +
|
||||
'= "J" + "S"</script>',
|
||||
});
|
||||
frame.contentWindow.addEventListener('DOMContentLoaded', function ready() {
|
||||
frame.contentWindow.removeEventListener('DOMContentLoaded', ready);
|
||||
frame.contentWindow.addEventListener('DOMContentLoaded', function() {
|
||||
assert.ok(!~frame.contentDocument.documentElement.innerHTML.indexOf('JS'),
|
||||
'JS was executed');
|
||||
|
||||
close(window).then(done);
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -46,13 +45,12 @@ exports['test frame with js enabled'] = function(assert, done) {
|
|||
'= "J" + "S"</script>',
|
||||
allowJavascript: true
|
||||
});
|
||||
frame.contentWindow.addEventListener('DOMContentLoaded', function ready() {
|
||||
frame.contentWindow.removeEventListener('DOMContentLoaded', ready);
|
||||
frame.contentWindow.addEventListener('DOMContentLoaded', function() {
|
||||
assert.ok(~frame.contentDocument.documentElement.innerHTML.indexOf('JS'),
|
||||
'JS was executed');
|
||||
|
||||
close(window).then(done);
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1027,8 +1027,7 @@ exports.testAttachToTabsOnly = function(assert, done) {
|
|||
let hiddenFrame = hiddenFrames.add(hiddenFrames.HiddenFrame({
|
||||
onReady: function () {
|
||||
let element = this.element;
|
||||
element.addEventListener('DOMContentLoaded', function onload() {
|
||||
element.removeEventListener('DOMContentLoaded', onload);
|
||||
element.addEventListener('DOMContentLoaded', function() {
|
||||
hiddenFrames.remove(hiddenFrame);
|
||||
|
||||
if (!xulApp.is("Fennec")) {
|
||||
|
@ -1037,7 +1036,7 @@ exports.testAttachToTabsOnly = function(assert, done) {
|
|||
else {
|
||||
openBrowserIframe();
|
||||
}
|
||||
});
|
||||
}, {once: true});
|
||||
element.setAttribute('src', 'data:text/html;charset=utf-8,foo');
|
||||
}
|
||||
}));
|
||||
|
@ -1046,11 +1045,10 @@ exports.testAttachToTabsOnly = function(assert, done) {
|
|||
function openToplevelWindow() {
|
||||
assert.pass('Open toplevel window');
|
||||
let win = open('data:text/html;charset=utf-8,bar');
|
||||
win.addEventListener('DOMContentLoaded', function onload() {
|
||||
win.removeEventListener('DOMContentLoaded', onload);
|
||||
win.addEventListener('DOMContentLoaded', function() {
|
||||
win.close();
|
||||
openBrowserIframe();
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
function openBrowserIframe() {
|
||||
|
@ -1060,11 +1058,10 @@ exports.testAttachToTabsOnly = function(assert, done) {
|
|||
let iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('type', 'content');
|
||||
iframe.setAttribute('src', 'data:text/html;charset=utf-8,foobar');
|
||||
iframe.addEventListener('DOMContentLoaded', function onload() {
|
||||
iframe.removeEventListener('DOMContentLoaded', onload);
|
||||
iframe.addEventListener('DOMContentLoaded', function() {
|
||||
iframe.parentNode.removeChild(iframe);
|
||||
openTabWithIframes();
|
||||
});
|
||||
}, {once: true});
|
||||
document.documentElement.appendChild(iframe);
|
||||
}
|
||||
|
||||
|
|
|
@ -1095,10 +1095,9 @@ exports.testSidebarLeakCheckDestroyAfterAttach = function*(assert) {
|
|||
|
||||
yield new Promise(resolve => {
|
||||
let panelBrowser = window.document.getElementById('sidebar').contentDocument.getElementById('web-panels-browser');
|
||||
panelBrowser.contentWindow.addEventListener('unload', function onUnload() {
|
||||
panelBrowser.contentWindow.removeEventListener('unload', onUnload);
|
||||
panelBrowser.contentWindow.addEventListener('unload', function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
sidebar.destroy();
|
||||
});
|
||||
|
||||
|
@ -1137,10 +1136,9 @@ exports.testSidebarLeakCheckUnloadAfterAttach = function*(assert) {
|
|||
|
||||
let panelBrowser = window.document.getElementById('sidebar').contentDocument.getElementById('web-panels-browser');
|
||||
yield new Promise(resolve => {
|
||||
panelBrowser.contentWindow.addEventListener('unload', function onUnload() {
|
||||
panelBrowser.contentWindow.removeEventListener('unload', onUnload);
|
||||
panelBrowser.contentWindow.addEventListener('unload', function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
loader.unload();
|
||||
});
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@ exports.testWindowTracker = function(assert, done) {
|
|||
var myWindow = makeEmptyWindow();
|
||||
assert.pass('window was created');
|
||||
|
||||
myWindow.addEventListener("load", function onload() {
|
||||
myWindow.removeEventListener("load", onload);
|
||||
myWindow.addEventListener("load", function() {
|
||||
assert.pass("test window has opened");
|
||||
|
||||
// test bug 638007 (new is optional), using new
|
||||
|
@ -61,7 +60,7 @@ exports.testWindowTracker = function(assert, done) {
|
|||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}, {once: true});
|
||||
};
|
||||
|
||||
exports['test window watcher untracker'] = function(assert, done) {
|
||||
|
|
|
@ -51,12 +51,11 @@ exports.testLocalXhr = function(assert, done) {
|
|||
assert.equal(req.responseText, '{}\n', 'XMLHttpRequest should get local files');
|
||||
}
|
||||
};
|
||||
req.addEventListener('load', function onload() {
|
||||
req.removeEventListener('load', onload);
|
||||
req.addEventListener('load', function() {
|
||||
assert.pass('addEventListener for load event worked');
|
||||
assert.ok(ready, 'onreadystatechange listener worked');
|
||||
done();
|
||||
});
|
||||
}, {once: true});
|
||||
req.send(null);
|
||||
};
|
||||
|
||||
|
|
|
@ -60,10 +60,9 @@ var OrientationChangeHandler = {
|
|||
return;
|
||||
}
|
||||
|
||||
window.addEventListener("resize", function waitForResize(e) {
|
||||
window.removeEventListener("resize", waitForResize);
|
||||
window.addEventListener("resize", function(e) {
|
||||
trigger();
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -113,8 +113,7 @@ var steps = [
|
|||
SystemAppProxy.registerFrame(frame);
|
||||
assert.ok(true, "Frame created and registered");
|
||||
|
||||
frame.contentWindow.addEventListener("load", function onload() {
|
||||
frame.contentWindow.removeEventListener("load", onload);
|
||||
frame.contentWindow.addEventListener("load", function() {
|
||||
assert.ok(true, "Frame document loaded");
|
||||
|
||||
// Declare that the iframe is now loaded.
|
||||
|
@ -128,7 +127,7 @@ var steps = [
|
|||
|
||||
// Once pending events are received,
|
||||
// we will run checkEventDispatching from `listener` function
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
frame.setAttribute("src", "data:text/html,system app");
|
||||
},
|
||||
|
|
|
@ -50,10 +50,9 @@ function loadBrowser() {
|
|||
iframe.src = 'about:blank';
|
||||
document.body.appendChild(iframe);
|
||||
|
||||
iframe.addEventListener("load", function onLoad() {
|
||||
iframe.removeEventListener("load", onLoad);
|
||||
iframe.addEventListener("load", function() {
|
||||
runNext();
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
gScript.addMessageListener("permission-request", function (detail) {
|
||||
|
|
|
@ -228,7 +228,7 @@
|
|||
@RESPATH@/components/layout_xul.xpt
|
||||
@RESPATH@/components/locale.xpt
|
||||
@RESPATH@/components/lwbrk.xpt
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
@RESPATH@/components/memory_profiler.xpt
|
||||
#endif
|
||||
@RESPATH@/components/migration.xpt
|
||||
|
@ -260,7 +260,7 @@
|
|||
@RESPATH@/components/plugin.xpt
|
||||
@RESPATH@/components/pref.xpt
|
||||
@RESPATH@/components/prefetch.xpt
|
||||
#ifdef MOZ_ENABLE_PROFILER_SPS
|
||||
#ifdef MOZ_GECKO_PROFILER
|
||||
@RESPATH@/components/profiler.xpt
|
||||
#endif
|
||||
@RESPATH@/components/proxyObject.xpt
|
||||
|
|
|
@ -939,12 +939,6 @@ pref("browser.tabs.remote.autostart", false);
|
|||
pref("browser.tabs.remote.desktopbehavior", true);
|
||||
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
// When this pref is true the Windows process sandbox will set up dummy
|
||||
// interceptions and log to the browser console when calls fail in the sandboxed
|
||||
// process and also if they are subsequently allowed by the broker process.
|
||||
// This will require a restart.
|
||||
pref("security.sandbox.windows.log", false);
|
||||
|
||||
// Controls whether and how the Windows NPAPI plugin process is sandboxed.
|
||||
// To get a different setting for a particular plugin replace "default", with
|
||||
// the plugin's nice file name, see: nsPluginTag::GetNiceFileName.
|
||||
|
@ -1033,15 +1027,10 @@ pref("security.sandbox.content.tempDirSuffix", "");
|
|||
#endif
|
||||
|
||||
#if defined(MOZ_SANDBOX)
|
||||
#if defined(XP_MACOSX)
|
||||
// This pref determines if messages relevant to sandbox violations are
|
||||
// logged.
|
||||
// At present, this setting refers only to mac sandbox messages sent to
|
||||
// the system console but the setting will be used on other platforms
|
||||
// in the future.
|
||||
pref("security.sandbox.logging.enabled", true);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// This pref governs whether we attempt to work around problems caused by
|
||||
// plugins using OS calls to manipulate the cursor while running out-of-
|
||||
|
|
|
@ -497,8 +497,7 @@ function getDefaultProfilePath() {
|
|||
return defaultProfile.rootDir.path;
|
||||
}
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function onload() {
|
||||
document.removeEventListener("DOMContentLoaded", onload, true);
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
init();
|
||||
var buttonGetStarted = document.getElementById("buttonGetStarted");
|
||||
buttonGetStarted.addEventListener("click", getStarted);
|
||||
|
@ -511,7 +510,7 @@ document.addEventListener("DOMContentLoaded", function onload() {
|
|||
|
||||
var buttonOpenPrefs = document.getElementById("buttonOpenPrefs")
|
||||
buttonOpenPrefs.addEventListener("click", openPrefs);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
function initObservers() {
|
||||
function observe(subject, topic, data) {
|
||||
|
|
|
@ -226,10 +226,9 @@ function setupSearch() {
|
|||
// immediately when the element is first drawn, so the
|
||||
// attribute is also used for styling when the page first loads.
|
||||
searchText = document.getElementById("searchText");
|
||||
searchText.addEventListener("blur", function searchText_onBlur() {
|
||||
searchText.removeEventListener("blur", searchText_onBlur);
|
||||
searchText.addEventListener("blur", function() {
|
||||
searchText.removeAttribute("autofocus");
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
if (!gContentSearchController) {
|
||||
gContentSearchController =
|
||||
|
|
|
@ -106,7 +106,6 @@ var CaptivePortalWatcher = {
|
|||
if (win != Services.ww.activeWindow) {
|
||||
this._delayedCaptivePortalDetectedInProgress = true;
|
||||
Services.obs.addObserver(this, "xul-window-visible", false);
|
||||
return;
|
||||
}
|
||||
|
||||
this._showNotification();
|
||||
|
@ -150,7 +149,6 @@ var CaptivePortalWatcher = {
|
|||
return;
|
||||
}
|
||||
|
||||
self._showNotification();
|
||||
if (time <= self.PORTAL_RECHECK_DELAY_MS) {
|
||||
// The amount of time elapsed since we requested a recheck (i.e. since
|
||||
// the browser window was focused) was small enough that we can add and
|
||||
|
|
|
@ -1268,8 +1268,6 @@ var gBrowserInit = {
|
|||
PanelUI.init();
|
||||
LightweightThemeListener.init();
|
||||
|
||||
Services.telemetry.getHistogramById("E10S_WINDOW").add(gMultiProcessBrowser);
|
||||
|
||||
SidebarUI.startDelayedLoad();
|
||||
|
||||
UpdateUrlbarSearchSplitterState();
|
||||
|
@ -1945,10 +1943,9 @@ function focusAndSelectUrlBar() {
|
|||
// We can't focus it when it's disabled, so we need to re-run ourselves when
|
||||
// we've finished leaving customize mode.
|
||||
if (CustomizationHandler.isExitingCustomizeMode) {
|
||||
gNavToolbox.addEventListener("aftercustomization", function afterCustomize() {
|
||||
gNavToolbox.removeEventListener("aftercustomization", afterCustomize);
|
||||
gNavToolbox.addEventListener("aftercustomization", function() {
|
||||
focusAndSelectUrlBar();
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -853,10 +853,9 @@ ContentSearchUIController.prototype = {
|
|||
"chrome://browser/skin/search-engine-placeholder.png");
|
||||
}
|
||||
img.setAttribute("src", uri);
|
||||
img.addEventListener("load", function imgLoad() {
|
||||
img.removeEventListener("load", imgLoad);
|
||||
img.addEventListener("load", function() {
|
||||
URL.revokeObjectURL(uri);
|
||||
});
|
||||
}, {once: true});
|
||||
button.appendChild(img);
|
||||
button.style.width = buttonWidth + "px";
|
||||
button.setAttribute("title", engine.name);
|
||||
|
|
|
@ -32,10 +32,9 @@ var gCustomize = {
|
|||
},
|
||||
|
||||
hidePanel: function() {
|
||||
this._nodes.overlay.addEventListener("transitionend", function onTransitionEnd() {
|
||||
gCustomize._nodes.overlay.removeEventListener("transitionend", onTransitionEnd);
|
||||
this._nodes.overlay.addEventListener("transitionend", function() {
|
||||
gCustomize._nodes.overlay.style.display = "none";
|
||||
});
|
||||
}, {once: true});
|
||||
this._nodes.overlay.style.opacity = 0;
|
||||
this._nodes.button.removeAttribute("active");
|
||||
this._nodes.panel.removeAttribute("open");
|
||||
|
|
|
@ -111,8 +111,6 @@ var gSyncUtils = {
|
|||
iframe.collapsed = true;
|
||||
document.documentElement.appendChild(iframe);
|
||||
iframe.contentWindow.addEventListener("load", function() {
|
||||
iframe.contentWindow.removeEventListener("load", arguments.callee);
|
||||
|
||||
// Insert the Sync Key into the page.
|
||||
let el = iframe.contentDocument.getElementById("synckey");
|
||||
el.firstChild.nodeValue = pp;
|
||||
|
@ -129,7 +127,7 @@ var gSyncUtils = {
|
|||
el.firstChild.nodeValue = privacyURL;
|
||||
|
||||
callback(iframe);
|
||||
});
|
||||
}, {once: true});
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1114,10 +1114,9 @@
|
|||
var forwardButtonContainer = document.getElementById("urlbar-wrapper");
|
||||
if (forwardButtonContainer) {
|
||||
forwardButtonContainer.setAttribute("switchingtabs", "true");
|
||||
window.addEventListener("MozAfterPaint", function removeSwitchingtabsAttr() {
|
||||
window.removeEventListener("MozAfterPaint", removeSwitchingtabsAttr);
|
||||
window.addEventListener("MozAfterPaint", function() {
|
||||
forwardButtonContainer.removeAttribute("switchingtabs");
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
this._appendStatusPanel();
|
||||
|
@ -4669,8 +4668,15 @@
|
|||
label = this.mStringBundle.getString(stringID);
|
||||
}
|
||||
} else {
|
||||
label = tab.getAttribute("label") +
|
||||
(this.AppConstants.E10S_TESTING_ONLY && tab.linkedBrowser && tab.linkedBrowser.isRemoteBrowser ? " - e10s" : "");
|
||||
label = tab.getAttribute("label");
|
||||
if (this.AppConstants.E10S_TESTING_ONLY &&
|
||||
tab.linkedBrowser &&
|
||||
tab.linkedBrowser.isRemoteBrowser) {
|
||||
label += " - e10s";
|
||||
if (Services.prefs.getIntPref("dom.ipc.processCount") > 1) {
|
||||
label += " (" + tab.linkedBrowser.frameLoader.tabParent.osPid + ")";
|
||||
}
|
||||
}
|
||||
if (tab.userContextId) {
|
||||
label = this.mStringBundle.getFormattedString("tabs.containers.tooltip", [label, ContextualIdentityService.getUserContextLabel(tab.userContextId)]);
|
||||
}
|
||||
|
|
|
@ -3,15 +3,14 @@ function promiseAlertWindow() {
|
|||
let listener = {
|
||||
onOpenWindow(window) {
|
||||
let alertWindow = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
|
||||
alertWindow.addEventListener("load", function onLoad() {
|
||||
alertWindow.removeEventListener("load", onLoad);
|
||||
alertWindow.addEventListener("load", function() {
|
||||
let windowType = alertWindow.document.documentElement.getAttribute("windowtype");
|
||||
if (windowType != "alert:alert") {
|
||||
return;
|
||||
}
|
||||
Services.wm.removeListener(listener);
|
||||
resolve(alertWindow);
|
||||
});
|
||||
}, {once: true});
|
||||
},
|
||||
};
|
||||
Services.wm.addListener(listener);
|
||||
|
|
|
@ -51,7 +51,9 @@ function* freePortal(aSuccess) {
|
|||
}, "Waiting for Captive Portal Service to update state after portal freed.");
|
||||
}
|
||||
|
||||
function* openWindowAndWaitForPortalUI(aLongRecheck) {
|
||||
// If a window is provided, it will be focused. Otherwise, a new window
|
||||
// will be opened and focused.
|
||||
function* focusWindowAndWaitForPortalUI(aLongRecheck, win) {
|
||||
// CaptivePortalWatcher triggers a recheck when a window gains focus. If
|
||||
// the time taken for the check to complete is under PORTAL_RECHECK_DELAY_MS,
|
||||
// a tab with the login page is opened and selected. If it took longer,
|
||||
|
@ -61,7 +63,10 @@ function* openWindowAndWaitForPortalUI(aLongRecheck) {
|
|||
// simulate a short recheck.
|
||||
Preferences.set("captivedetect.portalRecheckDelayMS", aLongRecheck ? -1 : 1000000);
|
||||
|
||||
let win = yield openWindowAndWaitForFocus();
|
||||
if (!win) {
|
||||
win = yield BrowserTestUtils.openNewBrowserWindow();
|
||||
}
|
||||
yield SimpleTest.promiseFocus(win);
|
||||
|
||||
// After a new window is opened, CaptivePortalWatcher asks for a recheck, and
|
||||
// waits for it to complete. We need to manually tell it a recheck completed.
|
||||
|
@ -175,13 +180,49 @@ let testCasesForBothSuccessAndAbort = [
|
|||
*/
|
||||
function* test_detectedWithNoBrowserWindow_Open(aSuccess) {
|
||||
yield portalDetected();
|
||||
let win = yield openWindowAndWaitForPortalUI();
|
||||
let win = yield focusWindowAndWaitForPortalUI();
|
||||
yield freePortal(aSuccess);
|
||||
ensureNoPortalTab(win);
|
||||
ensureNoPortalNotification(win);
|
||||
yield closeWindowAndWaitForXulWindowVisible(win);
|
||||
},
|
||||
|
||||
/**
|
||||
* A portal is detected when multiple browser windows are open but none
|
||||
* have focus. A brower window is focused, then the portal is freed.
|
||||
* The portal tab should be added and focused when the window is
|
||||
* focused, and closed automatically when the success event is fired.
|
||||
* The captive portal notification should be shown in all windows upon
|
||||
* detection, and closed automatically when the success event is fired.
|
||||
*/
|
||||
function* test_detectedWithNoBrowserWindow_Focused(aSuccess) {
|
||||
let win1 = yield openWindowAndWaitForFocus();
|
||||
let win2 = yield openWindowAndWaitForFocus();
|
||||
// Defocus both windows.
|
||||
yield SimpleTest.promiseFocus(window);
|
||||
|
||||
yield portalDetected();
|
||||
|
||||
// Notification should be shown in both windows.
|
||||
ensurePortalNotification(win1);
|
||||
ensureNoPortalTab(win1);
|
||||
ensurePortalNotification(win2);
|
||||
ensureNoPortalTab(win2);
|
||||
|
||||
yield focusWindowAndWaitForPortalUI(false, win2);
|
||||
|
||||
yield freePortal(aSuccess);
|
||||
|
||||
ensureNoPortalNotification(win1);
|
||||
ensureNoPortalTab(win2);
|
||||
ensureNoPortalNotification(win2);
|
||||
|
||||
yield closeWindowAndWaitForXulWindowVisible(win2);
|
||||
// No need to wait for xul-window-visible: after win2 is closed, focus
|
||||
// is restored to the default window and win1 remains in the background.
|
||||
yield BrowserTestUtils.closeWindow(win1);
|
||||
},
|
||||
|
||||
/**
|
||||
* A portal is detected when there's no browser window, then a browser
|
||||
* window is opened, then the portal is freed.
|
||||
|
@ -192,7 +233,7 @@ let testCasesForBothSuccessAndAbort = [
|
|||
*/
|
||||
function* test_detectedWithNoBrowserWindow_LongRecheck(aSuccess) {
|
||||
yield portalDetected();
|
||||
let win = yield openWindowAndWaitForPortalUI(true);
|
||||
let win = yield focusWindowAndWaitForPortalUI(true);
|
||||
yield freePortal(aSuccess);
|
||||
ensureNoPortalTab(win);
|
||||
ensureNoPortalNotification(win);
|
||||
|
@ -247,7 +288,7 @@ let singleRunTestCases = [
|
|||
*/
|
||||
function* test_detectedWithNoBrowserWindow_Redirect() {
|
||||
yield portalDetected();
|
||||
let win = yield openWindowAndWaitForPortalUI();
|
||||
let win = yield focusWindowAndWaitForPortalUI();
|
||||
let browser = win.gBrowser.selectedTab.linkedBrowser;
|
||||
let loadPromise =
|
||||
BrowserTestUtils.browserLoaded(browser, false, CANONICAL_URL_REDIRECTED);
|
||||
|
|
|
@ -565,9 +565,7 @@ function* withSnippetsMap(setupFn, testFn, testArgs = null, parentFn = null) {
|
|||
let document = content.document;
|
||||
// We're not using Promise-based listeners, because they resolve asynchronously.
|
||||
// The snippets test setup code relies on synchronous behaviour here.
|
||||
document.addEventListener("AboutHomeLoadSnippets", function loadSnippets() {
|
||||
document.removeEventListener("AboutHomeLoadSnippets", loadSnippets);
|
||||
|
||||
document.addEventListener("AboutHomeLoadSnippets", function() {
|
||||
let updateSnippets;
|
||||
if (args.setupFnSource) {
|
||||
updateSnippets = eval(`(() => (${args.setupFnSource}))()`);
|
||||
|
@ -594,7 +592,7 @@ function* withSnippetsMap(setupFn, testFn, testArgs = null, parentFn = null) {
|
|||
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
@ -12,10 +12,9 @@ add_task(function* () {
|
|||
|
||||
// While in the child process, add a listener for the popstate event here. This
|
||||
// event will fire when the mouse click happens.
|
||||
content.addEventListener("popstate", function onPopState() {
|
||||
content.removeEventListener("popstate", onPopState);
|
||||
content.addEventListener("popstate", function() {
|
||||
sendAsyncMessage("Test:PopStateOccurred", { location: content.document.location.href });
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
|
||||
window.maximize();
|
||||
|
|
|
@ -68,13 +68,12 @@ function test_paste(aCurrentTest) {
|
|||
// Focus the element and wait for focus event.
|
||||
info("About to focus " + element.id);
|
||||
element.addEventListener("focus", function() {
|
||||
element.removeEventListener("focus", arguments.callee);
|
||||
executeSoon(function() {
|
||||
// Pasting is async because the Accel+V codepath ends up going through
|
||||
// nsDocumentViewer::FireClipboardEvent.
|
||||
info("Pasting into " + element.id);
|
||||
EventUtils.synthesizeKey("v", { accelKey: true });
|
||||
});
|
||||
});
|
||||
}, {once: true});
|
||||
element.focus();
|
||||
}
|
||||
|
|
|
@ -25,10 +25,9 @@ function addTab(aURI, aIndex) {
|
|||
gBrowser.removeTab(gBrowser.tabs[0], {skipPermitUnload: true});
|
||||
|
||||
tab.linkedBrowser.addEventListener("load", function(event) {
|
||||
event.currentTarget.removeEventListener("load", arguments.callee, true);
|
||||
if (++count == URIS.length)
|
||||
executeSoon(doTabsTest);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
||||
function doTabsTest() {
|
||||
|
@ -36,14 +35,13 @@ function doTabsTest() {
|
|||
|
||||
// sample of "close related tabs" feature
|
||||
gBrowser.tabContainer.addEventListener("TabClose", function(event) {
|
||||
event.currentTarget.removeEventListener("TabClose", arguments.callee, true);
|
||||
var closedTab = event.originalTarget;
|
||||
var scheme = closedTab.linkedBrowser.currentURI.scheme;
|
||||
Array.slice(gBrowser.tabs).forEach(function(aTab) {
|
||||
if (aTab != closedTab && aTab.linkedBrowser.currentURI.scheme == scheme)
|
||||
gBrowser.removeTab(aTab, {skipPermitUnload: true});
|
||||
});
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
gBrowser.removeTab(gBrowser.tabs[0], {skipPermitUnload: true});
|
||||
is(gBrowser.tabs.length, 1, "Related tabs are not closed unexpectedly");
|
||||
|
|
|
@ -44,10 +44,9 @@ function test() {
|
|||
waitForExplicitFinish();
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
waitForStarChange(false, initTest);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
content.location = testURL;
|
||||
}
|
||||
|
|
|
@ -6,13 +6,10 @@ function test() {
|
|||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,
|
||||
"mediaTab");
|
||||
|
||||
pageInfo.addEventListener("load", function() {
|
||||
pageInfo.removeEventListener("load", arguments.callee, true);
|
||||
pageInfo.onFinished.push(function() {
|
||||
executeSoon(function() {
|
||||
var imageTree = pageInfo.document.getElementById("imagetree");
|
||||
|
@ -28,8 +25,8 @@ function test() {
|
|||
finish();
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}, {capture: true, once: true});
|
||||
|
||||
content.location =
|
||||
"data:text/html," +
|
||||
|
|
|
@ -4,8 +4,6 @@ function test() {
|
|||
"http://mochi.test:8888/browser/browser/base/content/test/general/browser_bug479408_sample.html");
|
||||
|
||||
gBrowser.addEventListener("DOMLinkAdded", function(aEvent) {
|
||||
gBrowser.removeEventListener("DOMLinkAdded", arguments.callee, true);
|
||||
|
||||
executeSoon(function() {
|
||||
ok(!tab.linkedBrowser.engines,
|
||||
"the subframe's search engine wasn't detected");
|
||||
|
@ -13,5 +11,5 @@ function test() {
|
|||
gBrowser.removeTab(tab);
|
||||
finish();
|
||||
});
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -12,13 +12,11 @@ function test() {
|
|||
// test normal close
|
||||
tabA = gBrowser.addTab(testPage);
|
||||
gBrowser.tabContainer.addEventListener("TabClose", function(firstTabCloseEvent) {
|
||||
gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
|
||||
ok(!firstTabCloseEvent.detail.adoptedBy, "This was a normal tab close");
|
||||
|
||||
// test tab close by moving
|
||||
tabB = gBrowser.addTab(testPage);
|
||||
gBrowser.tabContainer.addEventListener("TabClose", function(secondTabCloseEvent) {
|
||||
gBrowser.tabContainer.removeEventListener("TabClose", arguments.callee, true);
|
||||
executeSoon(function() {
|
||||
ok(secondTabCloseEvent.detail.adoptedBy, "This was a tab closed by moving");
|
||||
|
||||
|
@ -26,9 +24,9 @@ function test() {
|
|||
newWin.close();
|
||||
executeSoon(finish);
|
||||
});
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
newWin = gBrowser.replaceTabWithWindow(tabB);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
gBrowser.removeTab(tabA);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,15 +6,12 @@ function test() {
|
|||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
var doc = gBrowser.contentDocument;
|
||||
var testImg = doc.getElementById("test-image");
|
||||
var pageInfo = BrowserPageInfo(gBrowser.selectedBrowser.currentURI.spec,
|
||||
"mediaTab", testImg);
|
||||
|
||||
pageInfo.addEventListener("load", function() {
|
||||
pageInfo.removeEventListener("load", arguments.callee, true);
|
||||
pageInfo.onFinished.push(function() {
|
||||
executeSoon(function() {
|
||||
var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
|
||||
|
@ -28,8 +25,8 @@ function test() {
|
|||
finish();
|
||||
});
|
||||
});
|
||||
}, true);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}, {capture: true, once: true});
|
||||
|
||||
content.location =
|
||||
"data:text/html," +
|
||||
|
|
|
@ -61,10 +61,9 @@ function waitForProgressNotification(aPanelOpen = false, aExpectedCount = 1) {
|
|||
panelEventPromise = Promise.resolve();
|
||||
} else {
|
||||
panelEventPromise = new Promise(resolve => {
|
||||
PopupNotifications.panel.addEventListener("popupshowing", function eventListener() {
|
||||
PopupNotifications.panel.removeEventListener("popupshowing", eventListener);
|
||||
PopupNotifications.panel.addEventListener("popupshowing", function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -134,10 +133,9 @@ function waitForNotification(aId, aExpectedCount = 1) {
|
|||
function waitForNotificationClose() {
|
||||
return new Promise(resolve => {
|
||||
info("Waiting for notification to close");
|
||||
PopupNotifications.panel.addEventListener("popuphidden", function listener() {
|
||||
PopupNotifications.panel.removeEventListener("popuphidden", listener);
|
||||
PopupNotifications.panel.addEventListener("popuphidden", function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -12,10 +12,9 @@ function test() {
|
|||
// Verify that about:addons loads
|
||||
waitForExplicitFinish();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
let browser = blanktab.linkedBrowser;
|
||||
is(browser.currentURI.spec, "about:addons", "about:addons should load into blank tab.");
|
||||
gBrowser.removeTab(blanktab);
|
||||
finish();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@ function test() {
|
|||
|
||||
let tab = gBrowser.selectedTab = gBrowser.addTab();
|
||||
tab.linkedBrowser.addEventListener("load", (function(event) {
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
let uri = makeURI(testURL);
|
||||
let bmTxn =
|
||||
new PlacesCreateBookmarkTransaction(uri,
|
||||
|
@ -28,7 +26,7 @@ function test() {
|
|||
|
||||
ok(PlacesUtils.bookmarks.isBookmarked(uri), "the test url is bookmarked");
|
||||
waitForStarChange(true, onStarred);
|
||||
}), true);
|
||||
}), {capture: true, once: true});
|
||||
|
||||
content.location = testURL;
|
||||
}
|
||||
|
|
|
@ -10,9 +10,8 @@ var LightweightThemeManager = tempScope.LightweightThemeManager;
|
|||
|
||||
function wait_for_notification(aCallback) {
|
||||
PopupNotifications.panel.addEventListener("popupshown", function() {
|
||||
PopupNotifications.panel.removeEventListener("popupshown", arguments.callee);
|
||||
aCallback(PopupNotifications.panel);
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
var TESTS = [
|
||||
|
|
|
@ -30,18 +30,16 @@ function duplicate(delta, msg, cb) {
|
|||
duplicateTabIn(gBrowser.selectedTab, "tab", delta);
|
||||
let tab = gBrowser.selectedTab;
|
||||
|
||||
tab.addEventListener("SSTabRestored", function tabRestoredListener() {
|
||||
tab.removeEventListener("SSTabRestored", tabRestoredListener);
|
||||
tab.addEventListener("SSTabRestored", function() {
|
||||
is(gBrowser.sessionHistory.index, start + delta, msg);
|
||||
executeSoon(cb);
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
function loadAndWait(url, cb) {
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
executeSoon(cb);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
gBrowser.loadURI(url);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,6 @@ function test() {
|
|||
var tab = gBrowser.addTab();
|
||||
|
||||
tab.addEventListener("TabClose", function() {
|
||||
tab.removeEventListener("TabClose", arguments.callee);
|
||||
|
||||
ok(tab.linkedBrowser, "linkedBrowser should still exist during the TabClose event");
|
||||
|
||||
executeSoon(function() {
|
||||
|
@ -13,7 +11,7 @@ function test() {
|
|||
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
}
|
||||
|
|
|
@ -35,10 +35,9 @@ function test() {
|
|||
}
|
||||
|
||||
function load(aTab, aUrl, aCallback) {
|
||||
aTab.linkedBrowser.addEventListener("load", function onload(aEvent) {
|
||||
aEvent.currentTarget.removeEventListener("load", onload, true);
|
||||
aTab.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||
waitForFocus(aCallback, content);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
aTab.linkedBrowser.loadURI(aUrl);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,10 +65,9 @@ add_task(function* () {
|
|||
|
||||
// Wait for the iframe to load.
|
||||
return new Promise(resolve => {
|
||||
iframe.addEventListener("load", function onload() {
|
||||
iframe.removeEventListener("load", onload, true);
|
||||
iframe.addEventListener("load", function() {
|
||||
resolve("context-showonlythisframe");
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -28,9 +28,8 @@ function test() {
|
|||
}
|
||||
|
||||
function load(aTab, aUrl, aCallback) {
|
||||
aTab.linkedBrowser.addEventListener("load", function onload(aEvent) {
|
||||
aEvent.currentTarget.removeEventListener("load", onload, true);
|
||||
aTab.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||
waitForFocus(aCallback, content);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
aTab.linkedBrowser.loadURI(aUrl);
|
||||
}
|
||||
|
|
|
@ -83,8 +83,7 @@ function openNewTab(aWindow, aCallback) {
|
|||
return;
|
||||
}
|
||||
|
||||
browser.addEventListener("load", function onLoad() {
|
||||
browser.removeEventListener("load", onLoad, true);
|
||||
browser.addEventListener("load", function() {
|
||||
executeSoon(aCallback);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -48,8 +48,7 @@ function preparePendingTab(aCallback) {
|
|||
}
|
||||
|
||||
function whenLoaded(aElement, aCallback) {
|
||||
aElement.addEventListener("load", function onLoad() {
|
||||
aElement.removeEventListener("load", onLoad, true);
|
||||
aElement.addEventListener("load", function() {
|
||||
executeSoon(aCallback);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ function test() {
|
|||
ok(true, "Starting up");
|
||||
|
||||
gBrowser.selectedBrowser.focus();
|
||||
gURLBar.addEventListener("focus", function onFocus() {
|
||||
gURLBar.removeEventListener("focus", onFocus);
|
||||
gURLBar.addEventListener("focus", function() {
|
||||
ok(true, "Invoked onfocus handler");
|
||||
EventUtils.synthesizeKey("VK_RETURN", { shiftKey: true });
|
||||
|
||||
|
@ -17,7 +16,7 @@ function test() {
|
|||
ok(true, "Evaluated without crashing");
|
||||
finish();
|
||||
});
|
||||
});
|
||||
}, {once: true});
|
||||
gURLBar.inputField.value = "javascript: var foo = '11111111'; ";
|
||||
gURLBar.focus();
|
||||
}
|
||||
|
|
|
@ -10,14 +10,13 @@ add_task(function*() {
|
|||
textbox.select();
|
||||
|
||||
yield new Promise((resolve, reject) => {
|
||||
textbox.addEventListener("copy", function copyEvent(event) {
|
||||
textbox.removeEventListener("copy", copyEvent, true);
|
||||
textbox.addEventListener("copy", function(event) {
|
||||
event.clipboardData.setData("text/plain", "Alternate");
|
||||
// For this test, it doesn't matter that the file isn't actually a file.
|
||||
event.clipboardData.setData("application/x-moz-file", "Sample");
|
||||
event.preventDefault();
|
||||
resolve();
|
||||
}, true)
|
||||
}, {capture: true, once: true})
|
||||
|
||||
EventUtils.synthesizeKey("c", { accelKey: true });
|
||||
});
|
||||
|
@ -40,9 +39,7 @@ add_task(function*() {
|
|||
textbox.focus();
|
||||
|
||||
yield new Promise((resolve, reject) => {
|
||||
textbox.addEventListener("paste", function copyEvent(event) {
|
||||
textbox.removeEventListener("paste", copyEvent, true);
|
||||
|
||||
textbox.addEventListener("paste", function(event) {
|
||||
let dt = event.clipboardData;
|
||||
is(dt.types.length, 3, "number of types");
|
||||
ok(dt.types.includes("text/plain"), "text/plain exists in types");
|
||||
|
@ -51,7 +48,7 @@ add_task(function*() {
|
|||
is(dt.mozGetDataAt("text/plain", 0), "Alternate", "text/plain returned in mozGetDataAt");
|
||||
|
||||
resolve();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
EventUtils.synthesizeKey("v", { accelKey: true });
|
||||
});
|
||||
|
|
|
@ -7,11 +7,10 @@ add_task(function* () {
|
|||
// Wait for a process change and then fulfil the promise.
|
||||
function awaitProcessChange(browser) {
|
||||
return new Promise(resolve => {
|
||||
browser.addEventListener("BrowserChangedProcess", function bcp(e) {
|
||||
browser.removeEventListener("BrowserChangedProcess", bcp);
|
||||
browser.addEventListener("BrowserChangedProcess", function(e) {
|
||||
ok(true, "The browser changed process!");
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,9 @@ function promiseNextTick() {
|
|||
*/
|
||||
function promiseWaitForAlertActive(aNotificationBox) {
|
||||
let deferred = PromiseUtils.defer();
|
||||
aNotificationBox.addEventListener("AlertActive", function onActive() {
|
||||
aNotificationBox.removeEventListener("AlertActive", onActive, true);
|
||||
aNotificationBox.addEventListener("AlertActive", function() {
|
||||
deferred.resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,9 +6,8 @@ function doc() {
|
|||
|
||||
function setHandlerFunc(aResultFunc) {
|
||||
gBrowser.addEventListener("DOMLinkAdded", function(event) {
|
||||
gBrowser.removeEventListener("DOMLinkAdded", arguments.callee);
|
||||
executeSoon(aResultFunc);
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
function test() {
|
||||
|
@ -17,9 +16,8 @@ function test() {
|
|||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
browser = gBrowser.selectedBrowser;
|
||||
browser.addEventListener("load", function(event) {
|
||||
event.currentTarget.removeEventListener("load", arguments.callee, true);
|
||||
iconDiscovery();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
var rootDir = getRootDirectory(gTestPath);
|
||||
content.location = rootDir + "discovery.html";
|
||||
}
|
||||
|
|
|
@ -48,9 +48,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
|
|||
return;
|
||||
}
|
||||
|
||||
contentExpectedElement.addEventListener("focus", function focusReceived() {
|
||||
contentExpectedElement.removeEventListener("focus", focusReceived, true);
|
||||
|
||||
contentExpectedElement.addEventListener("focus", function() {
|
||||
const contentFM = Components.classes["@mozilla.org/focus-manager;1"].
|
||||
getService(Components.interfaces.nsIFocusManager);
|
||||
let details = contentFM.focusedWindow.document.documentElement.id;
|
||||
|
@ -59,7 +57,7 @@ function* expectFocusOnF6(backward, expectedDocument, expectedElement, onContent
|
|||
}
|
||||
|
||||
sendSyncMessage("BrowserTest:FocusChanged", { details });
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -5,17 +5,15 @@ add_task(function *() {
|
|||
|
||||
gURLBar.focus();
|
||||
|
||||
window.addEventListener("keyup", function countKeyUps(event) {
|
||||
window.removeEventListener("keyup", countKeyUps, true);
|
||||
window.addEventListener("keyup", function(event) {
|
||||
if (event.originalTarget == gURLBar.inputField) {
|
||||
keyUps++;
|
||||
}
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
gURLBar.addEventListener("keydown", function redirectFocus(event) {
|
||||
gURLBar.removeEventListener("keydown", redirectFocus, true);
|
||||
gURLBar.addEventListener("keydown", function(event) {
|
||||
gBrowser.selectedBrowser.focus();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
EventUtils.synthesizeKey("v", { });
|
||||
|
||||
|
|
|
@ -14,13 +14,11 @@ function test() {
|
|||
|
||||
let numVisBeforeHide, numVisAfterHide;
|
||||
gBrowser.tabContainer.addEventListener("TabSelect", function() {
|
||||
gBrowser.tabContainer.removeEventListener("TabSelect", arguments.callee);
|
||||
|
||||
// While the next tab is being selected, hide the removing tab
|
||||
numVisBeforeHide = gBrowser.visibleTabs.length;
|
||||
gBrowser.hideTab(testTab);
|
||||
numVisAfterHide = gBrowser.visibleTabs.length;
|
||||
});
|
||||
}, {once: true});
|
||||
gBrowser.removeTab(testTab, {animate: true});
|
||||
|
||||
// Make sure the tab gets removed at the end of the animation by polling
|
||||
|
|
|
@ -121,7 +121,10 @@ function nextTest() {
|
|||
}
|
||||
}
|
||||
|
||||
function checkResult() {
|
||||
function checkResult(event) {
|
||||
if (event.target.URL == "about:blank")
|
||||
return;
|
||||
|
||||
// Sanity check other values, and the value of gIdentityHandler.getEffectiveHost()
|
||||
is(gIdentityHandler._uri.spec, gCurrentTest.location, "location matches for test " + gTestDesc);
|
||||
// getEffectiveHost can't be called for all modes
|
||||
|
|
|
@ -46,9 +46,8 @@ add_task(function* test_keyword_bookmarklet() {
|
|||
|
||||
function* promisePageShow() {
|
||||
return new Promise(resolve => {
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", function listen() {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", listen);
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -25,9 +25,8 @@ function test() {
|
|||
ok(false, "Alert window opened");
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
win.addEventListener("load", function() {
|
||||
win.removeEventListener("load", arguments.callee);
|
||||
win.close();
|
||||
});
|
||||
}, {once: true});
|
||||
executeSoon(finish);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,9 @@ function promiseNewWindow() {
|
|||
if (topic == "domwindowopened") {
|
||||
Services.ww.unregisterNotification(observer);
|
||||
let win = subject.QueryInterface(Ci.nsIDOMWindow);
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad);
|
||||
win.addEventListener("load", function() {
|
||||
resolve(win);
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -68,12 +68,11 @@ function test() {
|
|||
// tab to open - which we track via an "Initialized" event.
|
||||
PopupNotifications.panel.firstElementChild.button.click();
|
||||
let newTabBrowser = gBrowser.getBrowserForTab(gBrowser.selectedTab);
|
||||
newTabBrowser.addEventListener("Initialized", function PrefInit() {
|
||||
newTabBrowser.removeEventListener("Initialized", PrefInit, true);
|
||||
newTabBrowser.addEventListener("Initialized", function() {
|
||||
executeSoon(function() {
|
||||
checkInContentPreferences(newTabBrowser.contentWindow);
|
||||
})
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
});
|
||||
onCachedAttached.then(function() {
|
||||
Services.prefs.setIntPref("offline-apps.quota.warn", 1);
|
||||
|
@ -87,9 +86,8 @@ function test() {
|
|||
|
||||
function promiseNotification() {
|
||||
return new Promise(resolve => {
|
||||
PopupNotifications.panel.addEventListener("popupshown", function onShown() {
|
||||
PopupNotifications.panel.removeEventListener("popupshown", onShown);
|
||||
PopupNotifications.panel.addEventListener("popupshown", function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@ function test() {
|
|||
var pageInfo;
|
||||
|
||||
gBrowser.selectedTab = gBrowser.addTab();
|
||||
gBrowser.selectedBrowser.addEventListener("load", function loadListener() {
|
||||
gBrowser.selectedBrowser.removeEventListener("load", loadListener, true);
|
||||
|
||||
gBrowser.selectedBrowser.addEventListener("load", function() {
|
||||
Services.obs.addObserver(observer, "page-info-dialog-loaded", false);
|
||||
pageInfo = BrowserPageInfo();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
content.location =
|
||||
"https://example.com/browser/browser/base/content/test/general/feed_tab.html";
|
||||
|
||||
|
|
|
@ -786,15 +786,13 @@ WindowHelper.prototype = {
|
|||
let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
|
||||
win.addEventListener("load", function onload(event) {
|
||||
win.removeEventListener("load", onload);
|
||||
|
||||
if (win.name !== "SanitizeDialog")
|
||||
return;
|
||||
|
||||
wh.win = win;
|
||||
loaded = true;
|
||||
executeSoon(() => wh.onload());
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
win.addEventListener("unload", function onunload(event) {
|
||||
if (win.name !== "SanitizeDialog") {
|
||||
|
|
|
@ -104,9 +104,7 @@ var windowObserver = {
|
|||
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
|
||||
win.addEventListener("load", function onLoad(event) {
|
||||
win.removeEventListener("load", onLoad);
|
||||
|
||||
win.addEventListener("load", function(event) {
|
||||
if (win.location == UCT_URI) {
|
||||
SimpleTest.executeSoon(function() {
|
||||
if (windowObserver._callback) {
|
||||
|
@ -117,7 +115,7 @@ var windowObserver = {
|
|||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -329,10 +329,9 @@ add_task(function*() {
|
|||
elem = content.document.getElementById(contentStep[0]);
|
||||
}
|
||||
|
||||
changedWin.addEventListener("MozAfterPaint", function onPaint() {
|
||||
changedWin.removeEventListener("MozAfterPaint", onPaint);
|
||||
changedWin.addEventListener("MozAfterPaint", function() {
|
||||
resolve();
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
elem.style = contentStep[1];
|
||||
elem.getBoundingClientRect();
|
||||
|
@ -675,11 +674,10 @@ add_task(function* test_mousemove_correcttarget() {
|
|||
yield popupShownPromise;
|
||||
|
||||
yield new Promise(resolve => {
|
||||
window.addEventListener("mousemove", function checkForMouseMove(event) {
|
||||
window.removeEventListener("mousemove", checkForMouseMove, true);
|
||||
window.addEventListener("mousemove", function(event) {
|
||||
is(event.target.localName.indexOf("menu"), 0, "mouse over menu");
|
||||
resolve();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
EventUtils.synthesizeMouseAtCenter(selectPopup.firstChild, { type: "mousemove" });
|
||||
});
|
||||
|
|
|
@ -8,13 +8,11 @@ function test() {
|
|||
let tab = gBrowser.addTab(testPath + "file_bug970276_popup1.html");
|
||||
|
||||
tab.linkedBrowser.addEventListener("load", function() {
|
||||
tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
|
||||
let expectedIcon = testPath + "file_bug970276_favicon1.ico";
|
||||
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon.");
|
||||
|
||||
gBrowser.removeTab(tab);
|
||||
|
||||
finish();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
|
|
@ -224,10 +224,9 @@ add_task(function*() {
|
|||
let switchWaiter;
|
||||
if (gMultiProcessBrowser) {
|
||||
switchWaiter = new Promise((resolve, reject) => {
|
||||
gBrowser.addEventListener("TabSwitchDone", function listener() {
|
||||
gBrowser.removeEventListener("TabSwitchDone", listener);
|
||||
gBrowser.addEventListener("TabSwitchDone", function() {
|
||||
executeSoon(resolve);
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -326,10 +325,9 @@ add_task(function*() {
|
|||
gURLBar.focus();
|
||||
|
||||
yield new Promise((resolve, reject) => {
|
||||
window.addEventListener("pageshow", function navigationOccured(event) {
|
||||
window.removeEventListener("pageshow", navigationOccured, true);
|
||||
window.addEventListener("pageshow", function(event) {
|
||||
resolve();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
document.getElementById("Browser:Back").doCommand();
|
||||
});
|
||||
|
||||
|
|
|
@ -7,10 +7,9 @@ const kTestPage = "http://example.org/browser/browser/base/content/test/general/
|
|||
|
||||
function promiseNewTabSwitched() {
|
||||
return new Promise(resolve => {
|
||||
gBrowser.addEventListener("TabSwitchDone", function onSwitch() {
|
||||
gBrowser.removeEventListener("TabSwitchDone", onSwitch);
|
||||
gBrowser.addEventListener("TabSwitchDone", function() {
|
||||
executeSoon(resolve);
|
||||
});
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ function test() {
|
|||
is(gBrowser.visibleTabs.length, 3, "3 tabs should be open");
|
||||
// Wait for tab load, the code checks for currentURI.
|
||||
testTab2.linkedBrowser.addEventListener("load", function() {
|
||||
testTab2.linkedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
is(Disabled(), false, "Bookmark All Tabs should be enabled since there are two tabs with different addresses");
|
||||
|
||||
// Hide the original tab
|
||||
|
@ -52,7 +51,7 @@ function test() {
|
|||
is(gBrowser.selectedTab, origTab, "got the orig tab");
|
||||
is(origTab.hidden, false, "and it's not hidden -- visible!");
|
||||
finish();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
}
|
||||
|
||||
function Disabled() {
|
||||
|
|
|
@ -94,10 +94,9 @@ var messageHandlers = {
|
|||
type: "mousemove",
|
||||
clickcount: 0,
|
||||
}
|
||||
row.addEventListener("mousemove", function handler() {
|
||||
row.removeEventListener("mousemove", handler);
|
||||
row.addEventListener("mousemove", function() {
|
||||
ack("mousemove");
|
||||
});
|
||||
}, {once: true});
|
||||
content.synthesizeMouseAtCenter(row, event);
|
||||
},
|
||||
|
||||
|
|
|
@ -5,11 +5,9 @@
|
|||
</head>
|
||||
<body>
|
||||
<script>
|
||||
window.addEventListener("load", function onLoad() {
|
||||
window.removeEventListener("load", onLoad, true);
|
||||
|
||||
window.addEventListener("load", function() {
|
||||
document.getElementById("test").addEventListener("click", onClick, true);
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
function onClick(aEvent) {
|
||||
aEvent.preventDefault();
|
||||
|
|
|
@ -86,19 +86,17 @@ function openToolbarCustomizationUI(aCallback, aBrowserWin) {
|
|||
|
||||
aBrowserWin.gCustomizeMode.enter();
|
||||
|
||||
aBrowserWin.gNavToolbox.addEventListener("customizationready", function UI_loaded() {
|
||||
aBrowserWin.gNavToolbox.removeEventListener("customizationready", UI_loaded);
|
||||
aBrowserWin.gNavToolbox.addEventListener("customizationready", function() {
|
||||
executeSoon(function() {
|
||||
aCallback(aBrowserWin)
|
||||
});
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
function closeToolbarCustomizationUI(aCallback, aBrowserWin) {
|
||||
aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function unloaded() {
|
||||
aBrowserWin.gNavToolbox.removeEventListener("aftercustomization", unloaded);
|
||||
aBrowserWin.gNavToolbox.addEventListener("aftercustomization", function() {
|
||||
executeSoon(aCallback);
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
aBrowserWin.gCustomizeMode.exit();
|
||||
}
|
||||
|
@ -235,10 +233,9 @@ function resetBlocklist() {
|
|||
|
||||
function whenNewWindowLoaded(aOptions, aCallback) {
|
||||
let win = OpenBrowserWindow(aOptions);
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad);
|
||||
win.addEventListener("load", function() {
|
||||
aCallback(win);
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
|
||||
function promiseWindowWillBeClosed(win) {
|
||||
|
@ -271,10 +268,9 @@ function promiseOpenAndLoadWindow(aOptions, aWaitForDelayedStartup = false) {
|
|||
}, "browser-delayed-startup-finished", false);
|
||||
|
||||
} else {
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad);
|
||||
win.addEventListener("load", function() {
|
||||
deferred.resolve(win);
|
||||
});
|
||||
}, {once: true});
|
||||
}
|
||||
return deferred.promise;
|
||||
}
|
||||
|
@ -574,12 +570,11 @@ var FullZoomHelper = {
|
|||
let didPs = false;
|
||||
let didZoom = false;
|
||||
|
||||
gBrowser.addEventListener("pageshow", function listener(event) {
|
||||
gBrowser.removeEventListener("pageshow", listener, true);
|
||||
gBrowser.addEventListener("pageshow", function(event) {
|
||||
didPs = true;
|
||||
if (didZoom)
|
||||
resolve();
|
||||
}, true);
|
||||
}, {capture: true, once: true});
|
||||
|
||||
if (direction == this.BACK)
|
||||
gBrowser.goBack();
|
||||
|
|
|
@ -27,7 +27,8 @@ skip-if = (os == "mac" && debug) # temporary skip-if due to increase in intermit
|
|||
[browser_newtab_disable.js]
|
||||
[browser_newtab_drag_drop.js]
|
||||
[browser_newtab_drag_drop_ext.js]
|
||||
subsuite = clipboard # temporary until determine why more intermittent on VM
|
||||
# temporary until determine why more intermittent on VM
|
||||
subsuite = clipboard
|
||||
[browser_newtab_drop_preview.js]
|
||||
[browser_newtab_enhanced.js]
|
||||
[browser_newtab_focus.js]
|
||||
|
|
|
@ -428,10 +428,9 @@ function* simulateExternalDrop(aDestIndex) {
|
|||
resolve();
|
||||
}
|
||||
|
||||
iframe.addEventListener("load", function onLoad() {
|
||||
iframe.removeEventListener("load", onLoad);
|
||||
iframe.addEventListener("load", function() {
|
||||
content.setTimeout(iframeLoaded, 0);
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
iframe.setAttribute("src", url);
|
||||
iframe.style.width = "50px";
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче