Merge the last PGO-green inbound changeset to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-02-06 16:55:25 -05:00
commit f513ec0999
160 changed files with 3142 additions and 415 deletions

View File

@ -3080,7 +3080,7 @@ Accessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
nsCOMPtr<nsIDOMTreeWalker> walker;
domDoc->CreateTreeWalker(rootNode,
nsIDOMNodeFilter::SHOW_ELEMENT | nsIDOMNodeFilter::SHOW_TEXT,
nullptr, false, getter_AddRefs(walker));
nullptr, 1, getter_AddRefs(walker));
NS_ENSURE_TRUE(walker, nullptr);
walker->SetCurrentNode(currentNode);

View File

@ -271,7 +271,7 @@ function testNameForElmRule(aElm, aRule)
var treeWalker = document.createTreeWalker(document.body,
NodeFilter.SHOW_ELEMENT,
filter, false);
filter);
labelElm = treeWalker.nextNode();
} else {

View File

@ -69,6 +69,12 @@ XPCOMUtils.defineLazyGetter(this, "libcutils", function () {
});
#endif
#ifdef MOZ_SERVICES_CAPTIVEDETECT
XPCOMUtils.defineLazyServiceGetter(Services, 'captivePortalDetector',
'@mozilla.org/services/captive-detector;1',
'nsICaptivePortalDetector');
#endif
function getContentWindow() {
return shell.contentBrowser.contentWindow;
}
@ -284,6 +290,7 @@ var shell = {
AccessFu.attach(window);
UserAgentOverrides.init();
IndexedDBPromptHelper.init();
CaptivePortalLoginHelper.init();
// XXX could factor out into a settings->pref map. Not worth it yet.
SettingsListener.observe("debug.fps.enabled", false, function(value) {
@ -645,6 +652,9 @@ var CustomEventManager = {
case 'remote-debugger-prompt':
RemoteDebugger.handleEvent(detail);
break;
case 'captive-portal-login-cancel':
CaptivePortalLoginHelper.handleEvent(detail);
break;
}
}
}
@ -995,6 +1005,19 @@ window.addEventListener('ContentStart', function ss_onContentStart() {
"ipc:content-shutdown", false);
})();
var CaptivePortalLoginHelper = {
init: function init() {
Services.obs.addObserver(this, 'captive-portal-login', false);
Services.obs.addObserver(this, 'captive-portal-login-abort', false);
},
handleEvent: function handleEvent(detail) {
Services.captivePortalDetector.cancelLogin(detail.id);
},
observe: function observe(subject, topic, data) {
shell.sendChromeEvent(JSON.parse(data));
}
}
// Listen for crashes submitted through the crash reporter UI.
window.addEventListener('ContentStart', function cr_onContentStart() {
let content = shell.contentBrowser.contentWindow;

View File

@ -20,6 +20,7 @@ MOZ_OFFICIAL_BRANDING_DIRECTORY=b2g/branding/official
MOZ_SAFE_BROWSING=
MOZ_SERVICES_COMMON=1
MOZ_SERVICES_METRICS=1
MOZ_SERVICES_CAPTIVEDETECT=1
MOZ_WEBSMS_BACKEND=1
MOZ_DISABLE_DOMCRYPTO=1

View File

@ -287,6 +287,9 @@
@BINPATH@/components/services-crypto.xpt
#endif
@BINPATH@/components/services-crypto-component.xpt
#ifdef MOZ_SERVICES_CAPTIVEDETECT
@BINPATH@/components/services-captivedetect.xpt
#endif
@BINPATH@/components/shellservice.xpt
@BINPATH@/components/shistory.xpt
@BINPATH@/components/spellchecker.xpt
@ -493,6 +496,10 @@
@BINPATH@/components/HealthReportComponents.manifest
@BINPATH@/components/HealthReportService.js
#endif
#ifdef MOZ_SERVICES_CAPTIVEDETECT
@BINPATH@/components/CaptivePortalDetectComponents.manifest
@BINPATH@/components/captivedetect.js
#endif
@BINPATH@/components/TelemetryPing.js
@BINPATH@/components/TelemetryPing.manifest
@BINPATH@/components/Webapps.js
@ -590,6 +597,9 @@
#ifdef MOZ_SERVICES_SYNC
@BINPATH@/defaults/pref/services-sync.js
#endif
#ifdef MOZ_SERVICES_CAPTIVEDETECT
@BINPATH@/defaults/pref/services-captivedetect.js
#endif
; [Layout Engine Resources]
; Style Sheets, Graphics and other Resources used by the layout engine.

View File

@ -575,7 +575,7 @@ function processFrames()
if (gFrameList.length) {
var doc = gFrameList[0];
onProcessFrame.forEach(function(func) { func(doc); });
var iterator = doc.createTreeWalker(doc, NodeFilter.SHOW_ELEMENT, grabAll, true);
var iterator = doc.createTreeWalker(doc, NodeFilter.SHOW_ELEMENT, grabAll);
gFrameList.shift();
setTimeout(doGrab, 10, iterator);
onFinished.push(selectImage);

View File

@ -15,9 +15,6 @@ MOCHITEST_BROWSER_FILES = \
browser_privatebrowsing_certexceptionsui.js \
browser_privatebrowsing_concurrent.js \
browser_privatebrowsing_concurrent_page.html \
browser_privatebrowsing_cookieacceptdialog.js \
browser_privatebrowsing_cookieacceptdialog.html \
browser_privatebrowsing_crh.js \
browser_privatebrowsing_downloadLastDir.js \
browser_privatebrowsing_downloadLastDir_c.js \
browser_privatebrowsing_downloadLastDir_toggle.js \
@ -52,4 +49,13 @@ MOCHITEST_BROWSER_FILES = \
title.sjs \
$(NULL)
# Temporarily disabled on OS X for bug 822284
ifneq ($(MOZ_WIDGET_TOOLKIT),cocoa)
MOCHITEST_BROWSER_FILES += \
browser_privatebrowsing_cookieacceptdialog.js \
browser_privatebrowsing_cookieacceptdialog.html \
browser_privatebrowsing_crh.js \
$(NULL)
endif
include $(topsrcdir)/config/rules.mk

View File

@ -121,8 +121,7 @@ MarkupView.prototype = {
return Ci.nsIDOMNodeFilter.FILTER_ACCEPT;
}
return Ci.nsIDOMNodeFilter.FILTER_SKIP;
},
false
}
);
walker.currentNode = this._selectedContainer.elt;
return walker;
@ -1316,7 +1315,7 @@ RootContainer.prototype = {
};
function documentWalker(node) {
return new DocumentWalker(node, Ci.nsIDOMNodeFilter.SHOW_ALL, whitespaceTextFilter, false);
return new DocumentWalker(node, Ci.nsIDOMNodeFilter.SHOW_ALL, whitespaceTextFilter);
}
function nodeDocument(node) {
@ -1329,11 +1328,10 @@ function nodeDocument(node) {
*
* See TreeWalker documentation for explanations of the methods.
*/
function DocumentWalker(aNode, aShow, aFilter, aExpandEntityReferences)
function DocumentWalker(aNode, aShow, aFilter)
{
let doc = nodeDocument(aNode);
this.walker = doc.createTreeWalker(nodeDocument(aNode),
aShow, aFilter, aExpandEntityReferences);
this.walker = doc.createTreeWalker(nodeDocument(aNode), aShow, aFilter);
this.walker.currentNode = aNode;
this.filter = aFilter;
}

View File

@ -31,7 +31,7 @@ function test() {
{
node.normalize();
let iter = node.ownerDocument.createNodeIterator(node, NodeFilter.SHOW_TEXT + NodeFilter.SHOW_COMMENT,
null, false);
null);
while ((node = iter.nextNode())) {
node.nodeValue = node.nodeValue.replace(/\s+/g, '');

View File

@ -96,7 +96,7 @@ DOMHelpers.prototype = {
{
let SHOW_ALL = Components.interfaces.nsIDOMNodeFilter.SHOW_ALL;
this.treeWalker = node.ownerDocument.createTreeWalker(node,
SHOW_ALL, null, false);
SHOW_ALL, null);
return this.treeWalker.firstChild();
},

View File

@ -284,6 +284,9 @@
@BINPATH@/components/saxparser.xpt
@BINPATH@/components/sessionstore.xpt
@BINPATH@/components/services-crypto-component.xpt
#ifdef MOZ_SERVICES_CAPTIVEDETECT
@BINPATH@/components/services-captivedetect.xpt
#endif
@BINPATH@/components/shellservice.xpt
@BINPATH@/components/shistory.xpt
@BINPATH@/components/spellchecker.xpt
@ -473,6 +476,10 @@
@BINPATH@/components/SyncComponents.manifest
@BINPATH@/components/Weave.js
#endif
#ifdef MOZ_SERVICES_CAPTIVEDETECT
@BINPATH@/components/CaptivePortalDetectComponents.manifest
@BINPATH@/components/captivedetect.js
#endif
@BINPATH@/components/servicesComponents.manifest
@BINPATH@/components/cryptoComponents.manifest
@BINPATH@/components/TelemetryPing.js

View File

@ -976,6 +976,7 @@ xpicleanup@BIN_SUFFIX@
defaults/pref/firefox.js
defaults/pref/firefox-l10n.js
defaults/pref/services-sync.js
defaults/pref/services-captivedetect.js
defaults/profile/bookmarks.html
defaults/profile/chrome/userChrome-example.css
defaults/profile/chrome/userContent-example.css

View File

@ -8374,6 +8374,12 @@ if test -n "$MOZ_SERVICES_SYNC"; then
AC_DEFINE(MOZ_SERVICES_SYNC)
fi
dnl Build Captive Portal Detector if required
AC_SUBST(MOZ_SERVICES_CAPTIVEDETECT)
if test -n "$MOZ_SERVICES_CAPTIVEDETECT"; then
AC_DEFINE(MOZ_SERVICES_CAPTIVEDETECT)
fi
dnl ========================================================
if test "$MOZ_DEBUG" -o "$NS_TRACE_MALLOC" -o "$MOZ_DMD"; then
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=

View File

@ -1,7 +1,7 @@
<html>
<head>
<script type="text/javascript">
document.createTreeWalker(null, NodeFilter.SHOW_ALL, null, false);
document.createTreeWalker(null, NodeFilter.SHOW_ALL, null);
</script>
</head>
<body>

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
var outer = document.createElement("span");
var inner = document.createElement("span");
outer.dir = "auto";
outer.appendChild(inner);
inner.appendChild(document.createTextNode("x"));
inner.dir = "auto";
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -128,3 +128,4 @@ load 824719.html
load 827190.html
load 828054.html
load 829428.html
load 836890.html

View File

@ -709,6 +709,8 @@ void SetAncestorDirectionIfAuto(nsINode* aTextNode, Directionality aDir,
break;
}
aTextNode->SetAncestorHasDirAuto();
if (parent->HasDirAuto()) {
bool resetDirection = false;

View File

@ -22,7 +22,7 @@ SimpleTest.waitForExplicitFinish();
const SHOW_ALL = Components.interfaces.nsIDOMNodeFilter.SHOW_ALL;
addLoadEvent(function() {
var walker = document.createTreeWalker(document, SHOW_ALL, null, true);
var walker = document.createTreeWalker(document, SHOW_ALL, null);
try {
walker.currentNode = {};
walker.nextNode();

View File

@ -457,7 +457,7 @@
}
function check( type, root, expect, fragment ){
var walker = document.createTreeWalker( root, NodeFilter.SHOW_ELEMENT, { acceptNode: function(){ return 1; } }, false );
var walker = document.createTreeWalker( root, NodeFilter.SHOW_ELEMENT, { acceptNode: function(){ return 1; } } );
while ( walker.nextNode() ) {
var div = walker.currentNode;

View File

@ -54,7 +54,7 @@
var iterator = document.createNodeIterator(document,
NodeFilter.SHOW_ALL,
null, false);
null);
var node;
// forwards
@ -96,7 +96,7 @@
found.length = 0;
iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL,
filter, false);
filter);
// forwards
while (node = iterator.nextNode())
@ -116,7 +116,7 @@
if (n < 0)
iterator.detach();
return NodeFilter.FILTER_ACCEPT;
}, false);
});
while (--n >= 0)
iterator.nextNode();
try {
@ -141,8 +141,7 @@
return document.createNodeIterator(grandparent,
NodeFilter.SHOW_ALL,
filter,
false);
filter);
})(function filter(n) {
if (n.nodeName != "img")
return NodeFilter.FILTER_ACCEPT;

View File

@ -59,7 +59,7 @@
var E = $('E');
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
null, false);
null);
check(iterator.nextNode(), root, '1.0');
// 1. Remove a node unrelated to the reference node
@ -87,7 +87,7 @@
var G = $('G');
var H = $('H');
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
null, false);
null);
check(iterator.nextNode(), root, '2.0');
check(iterator.nextNode(), F, '2.1');
@ -109,7 +109,7 @@
var KK = $('KK');
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
null, false);
null);
check(iterator.nextNode(), root, '3.0');
check(iterator.nextNode(), I, '3.1');
check(iterator.nextNode(), II, '3.2');
@ -135,7 +135,7 @@
var N = $('N');
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
null, false);
null);
check(iterator.nextNode(), root, '4.1');
check(iterator.nextNode(), L, '4.2');
check(iterator.nextNode(), M, '4.3');
@ -153,7 +153,7 @@
var Q = $('Q');
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
null, false);
null);
check(iterator.nextNode(), root, '5.1');
check(iterator.nextNode(), O, '5.2');
check(iterator.nextNode(), P, '5.3');
@ -172,7 +172,7 @@
var T = $('T');
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
null, false);
null);
check(iterator.nextNode(), root, '6.1');
check(iterator.nextNode(), R, '6.2');
check(iterator.nextNode(), S, '6.3');
@ -191,7 +191,7 @@
var W = $('W');
var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
null, false);
null);
check(iterator.nextNode(), root, '7.1');
check(iterator.nextNode(), U, '7.2');
check(iterator.nextNode(), V, '7.3');

View File

@ -39,7 +39,7 @@
function checkseq(it, root, expect) {
var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
var printedPointer = (it.referenceNode == undefined);
var string = '';
var node;
@ -62,7 +62,7 @@
(function(){
var root = resetContent();
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
checkseq(it, root, 'A B C D E F G H I');
it.nextNode();
@ -77,7 +77,7 @@
(function(){
var root = resetContent();
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
for (var i = 0; i < 4; i++)
it.nextNode();
@ -102,7 +102,7 @@
(function(){
var root = resetContent();
var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
})();
*/

View File

@ -21,7 +21,7 @@
function resetContent() {
content.innerHTML = initInner;
var checkIt = document.createNodeIterator(content, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
var node;
while ((node = checkIt.nextNode()) != null) {
if (node.id) {
@ -44,7 +44,7 @@
function checkseq(it, root, expect) {
var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
var printedPointer = (it.referenceNode == undefined);
var string = '';
var node;
@ -65,7 +65,7 @@
resetContent();
var it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
checkseq(it, root, "root B C D * [E] E1 E11");
removeNode(C);
@ -94,7 +94,7 @@
resetContent();
it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
checkseq(it, root, "root B C D * [E] E1 E11");
it.nextNode();
@ -119,7 +119,7 @@
resetContent();
it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
checkseq(it, root, "root B C D * [E] E1 E11");
removeNode(root);

View File

@ -21,7 +21,7 @@ function getName(aNode, f)
function walkDOM()
{
var walker = document.createTreeWalker($('content'), NodeFilter.SHOW_ELEMENT, null, true);
var walker = document.createTreeWalker($('content'), NodeFilter.SHOW_ELEMENT, null);
var output = "";
while (walker.nextNode())
{

View File

@ -28,7 +28,7 @@ function do_test()
var body = doc.getElementsByTagName("body")[0];
var filter = NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT;
var walker = doc.createTreeWalker(body, filter, null, false);
var walker = doc.createTreeWalker(body, filter, null);
walker.currentNode = body.firstChild;
walker.nextNode();

View File

@ -55,8 +55,7 @@ function filter(node) {
it = document.createNodeIterator(
document.getElementById("nodes"),
NodeFilter.SHOW_ELEMENT,
filter,
false
filter
);
while (it.nextNode());
})();
@ -65,16 +64,14 @@ function filter(node) {
it = document.createTreeWalker(
document.getElementById("nodes"),
NodeFilter.SHOW_ELEMENT,
filter,
false
filter
);
while(it.nextNode());
it = document.createTreeWalker(
document.getElementById("nodes"),
NodeFilter.SHOW_ELEMENT,
filter,
false
filter
);
it.firstChild();
while(it.nextSibling());
@ -82,8 +79,7 @@ function filter(node) {
it = document.createTreeWalker(
document.getElementById("nodes"),
NodeFilter.SHOW_ELEMENT,
filter,
false
filter
);
it.lastChild();
while(it.previousSibling());

View File

@ -27,7 +27,7 @@ function testNodeFilter(n) {
tw = document.createTreeWalker(document.getElementById("root"),
NodeFilter.SHOW_ELEMENT,
testNodeFilter, false);
testNodeFilter);
node = tw.firstChild();
is(node.id, 'B', "First accepted child of root not B");

View File

@ -87,7 +87,7 @@ function regularWalk()
[ false, "\n" ],
];
var walker = document.createTreeWalker(document.getElementById('content'),
NodeFilter.SHOW_ALL, null, true);
NodeFilter.SHOW_ALL, null);
walkTree(walker);
@ -125,7 +125,7 @@ function noWhiteSpaceWalk()
return NodeFilter.FILTER_REJECT;
return NodeFilter.FILTER_ACCEPT;
}
}, true);
});
walkTree(walker);
@ -148,7 +148,7 @@ function onlyElementsWalk()
[ true, "DIV" ],
];
var walker = document.createTreeWalker(document.getElementById('content'),
NodeFilter.SHOW_ELEMENT, null, true);
NodeFilter.SHOW_ELEMENT, null);
walkTree(walker);
@ -187,7 +187,7 @@ function onlyDivSubTreeWalk()
}
return NodeFilter.FILTER_SKIP;
}
}, true);
});
walkTree(walker);
@ -220,7 +220,7 @@ function onlyDivDataWalk()
return NodeFilter.FILTER_ACCEPT;
return NodeFilter.FILTER_SKIP;
}
}, true);
});
walkTree(walker);

View File

@ -80,7 +80,7 @@ testContent();
tw = document.createTreeWalker(document.documentElement,
NodeFilter.SHOW_ELEMENT,
null, false);
null);
e = document.documentElement;
elemsTested = 0;

View File

@ -23,8 +23,7 @@ window.addEventListener("load", function() {
var walker = document.createTreeWalker(
document,
nsIDOMNodeFilter.SHOW_TEXT | nsIDOMNodeFilter.SHOW_DOCUMENT,
null,
true
null
);
setPass(walker.firstChild());
while (walker.nextSibling()) {
@ -43,7 +42,7 @@ appear as direct children of the root node, no matter how deeply nested the
structure of the original document.
*/
walker2 = document.createTreeWalker(document, nsIDOMNodeFilter.SHOW_TEXT, null, true);
walker2 = document.createTreeWalker(document, nsIDOMNodeFilter.SHOW_TEXT, null);
while (walker2.nextNode()) {
var cNode = walker2.currentNode;
ok(cNode.getUserData("pass"), "Every text node should appear: " + walker2.currentNode.nodeValue);

View File

@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=650493
<script class="testbody" type="text/javascript">
function getNodes() {
var walker = document.createTreeWalker($('content'), NodeFilter.SHOW_ALL, null, false);
var walker = document.createTreeWalker($('content'), NodeFilter.SHOW_ALL, null);
var nodes = [];
do {
nodes.push(walker.currentNode);
@ -46,7 +46,7 @@ root = $('content');
root.addEventListener("DOMNodeInserted", function(e) {
mutateCount++;
is(e.isTrusted, true, "untrusted mutation event");
var w = document.createTreeWalker(e.target, NodeFilter.SHOW_ALL, null, false);
var w = document.createTreeWalker(e.target, NodeFilter.SHOW_ALL, null);
do {
is(nodes.indexOf(w.currentNode), -1, "already have inserted node (" + w.currentNode + ") when " + testName);
nodes.push(w.currentNode);
@ -55,7 +55,7 @@ root.addEventListener("DOMNodeInserted", function(e) {
root.addEventListener("DOMNodeRemoved", function(e) {
mutateCount++;
is(e.isTrusted, true, "untrusted mutation event");
var w = document.createTreeWalker(e.target, NodeFilter.SHOW_ALL, null, false);
var w = document.createTreeWalker(e.target, NodeFilter.SHOW_ALL, null);
do {
var index = nodes.indexOf(w.currentNode);
ok(index != -1, "missing removed node (" + w.currentNode + ") when " + testName);

View File

@ -1,8 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/UndoManager.h"
#include "mozilla/dom/DOMTransactionBinding.h"
#include "nsDOMClassInfoID.h"
#include "nsIClassInfo.h"
@ -18,8 +20,6 @@
#include "mozilla/Preferences.h"
#include "mozilla/ErrorResult.h"
#include "nsIUndoManagerTransaction.h"
// Includes for mutation observer.
#include "nsIDOMHTMLElement.h"
#include "nsStubMutationObserver.h"
@ -725,14 +725,13 @@ class FunctionCallTxn : public UndoTxn {
NS_IMETHOD RedoTransaction();
NS_IMETHOD UndoTransaction();
FunctionCallTxn(nsIUndoManagerTransaction* aTransaction, uint32_t aFlags);
FunctionCallTxn(DOMTransaction* aTransaction, uint32_t aFlags);
protected:
/**
* Call a function member on the transaction object with the
* specified function name.
*/
nsresult CallTransactionMember(const char* aFunctionName);
nsCOMPtr<nsIUndoManagerTransaction> mTransaction;
nsRefPtr<DOMTransaction> mTransaction;
uint32_t mFlags;
};
@ -746,7 +745,7 @@ NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(FunctionCallTxn)
NS_IMPL_CYCLE_COLLECTING_RELEASE(FunctionCallTxn)
FunctionCallTxn::FunctionCallTxn(nsIUndoManagerTransaction* aTransaction,
FunctionCallTxn::FunctionCallTxn(DOMTransaction* aTransaction,
uint32_t aFlags)
: mTransaction(aTransaction), mFlags(aFlags) {}
@ -757,7 +756,13 @@ FunctionCallTxn::RedoTransaction()
return NS_OK;
}
mTransaction->Redo();
ErrorResult rv;
nsRefPtr<DOMTransactionCallback> redo = mTransaction->GetRedo(rv);
if (!rv.Failed() && redo) {
redo->Call(mTransaction.get(), rv);
}
// We ignore rv because we want to avoid the rollback behavior of the
// nsITransactionManager.
return NS_OK;
}
@ -769,7 +774,13 @@ FunctionCallTxn::UndoTransaction()
return NS_OK;
}
mTransaction->Undo();
ErrorResult rv;
nsRefPtr<DOMTransactionCallback> undo = mTransaction->GetUndo(rv);
if (!rv.Failed() && undo) {
undo->Call(mTransaction.get(), rv);
}
// We ignore rv because we want to avoid the rollback behavior of the
// nsITransactionManager.
return NS_OK;
}
@ -822,7 +833,7 @@ UndoManager::UndoManager(nsIContent* aNode)
UndoManager::~UndoManager() {}
void
UndoManager::Transact(JSContext* aCx, nsIUndoManagerTransaction& aTransaction,
UndoManager::Transact(JSContext* aCx, DOMTransaction& aTransaction,
bool aMerge, ErrorResult& aRv)
{
if (mIsDisconnected || mInTransaction) {
@ -833,12 +844,15 @@ UndoManager::Transact(JSContext* aCx, nsIUndoManagerTransaction& aTransaction,
TxnScopeGuard guard(this);
// First try executing an automatic transaction.
AutomaticTransact(&aTransaction, aRv);
if (aRv.ErrorCode() == NS_ERROR_XPC_JSOBJECT_HAS_NO_FUNCTION_NAMED) {
// If the automatic transaction didn't work due to the function being
// undefined, then try a manual transaction.
aRv = NS_OK;
nsRefPtr<DOMTransactionCallback> executeAutomatic =
aTransaction.GetExecuteAutomatic(aRv);
if (aRv.Failed()) {
return;
}
if (executeAutomatic) {
AutomaticTransact(&aTransaction, executeAutomatic, aRv);
} else {
ManualTransact(&aTransaction, aRv);
}
@ -861,9 +875,12 @@ UndoManager::Transact(JSContext* aCx, nsIUndoManagerTransaction& aTransaction,
}
void
UndoManager::AutomaticTransact(nsIUndoManagerTransaction* aTransaction,
UndoManager::AutomaticTransact(DOMTransaction* aTransaction,
DOMTransactionCallback* aCallback,
ErrorResult& aRv)
{
MOZ_ASSERT(aCallback);
nsCOMPtr<nsIMutationObserver> mutationObserver =
new UndoMutationObserver(mTxnManager);
@ -881,29 +898,29 @@ UndoManager::AutomaticTransact(nsIUndoManagerTransaction* aTransaction,
mTxnManager->DoTransaction(undoTxn);
mHostNode->AddMutationObserver(mutationObserver);
nsresult rv = aTransaction->ExecuteAutomatic();
aCallback->Call(aTransaction, aRv);
mHostNode->RemoveMutationObserver(mutationObserver);
mTxnManager->DoTransaction(redoTxn);
mTxnManager->EndBatch(true);
if (NS_FAILED(rv)) {
if (aRv.Failed()) {
mTxnManager->RemoveTopUndo();
aRv.Throw(rv);
return;
}
}
void
UndoManager::ManualTransact(nsIUndoManagerTransaction* aTransaction,
UndoManager::ManualTransact(DOMTransaction* aTransaction,
ErrorResult& aRv)
{
nsRefPtr<FunctionCallTxn> txn = new FunctionCallTxn(aTransaction,
FunctionCallTxn::CALL_ON_REDO | FunctionCallTxn::CALL_ON_UNDO);
nsresult rv = aTransaction->Execute();
if (NS_FAILED(rv)) {
aRv.Throw(rv);
nsRefPtr<DOMTransactionCallback> execute = aTransaction->GetExecute(aRv);
if (!aRv.Failed() && execute) {
execute->Call(aTransaction, aRv);
}
if (aRv.Failed()) {
return;
}
@ -948,7 +965,7 @@ UndoManager::GetLength(ErrorResult& aRv)
void
UndoManager::ItemInternal(uint32_t aIndex,
nsTArray<nsIUndoManagerTransaction*>& aItems,
nsTArray<DOMTransaction*>& aItems,
ErrorResult& aRv)
{
int32_t numRedo;
@ -984,7 +1001,7 @@ UndoManager::ItemInternal(uint32_t aIndex,
}
// Obtain data from transaction list and convert to list of
// nsIUndoManagerTransaction.
// DOMTransaction*.
nsISupports** listData;
uint32_t listDataLength;
rv = txnList->GetData(listIndex, &listDataLength, &listData);
@ -994,11 +1011,7 @@ UndoManager::ItemInternal(uint32_t aIndex,
}
for (uint32_t i = 0; i < listDataLength; i++) {
nsCOMPtr<nsIUndoManagerTransaction> transaction =
do_QueryInterface(listData[i]);
MOZ_ASSERT(transaction,
"Only nsIUndoManagerTransaction should be stored as data.");
aItems.AppendElement(transaction);
aItems.AppendElement(static_cast<DOMTransaction*>(listData[i]));
NS_RELEASE(listData[i]);
}
NS_Free(listData);
@ -1006,7 +1019,7 @@ UndoManager::ItemInternal(uint32_t aIndex,
void
UndoManager::Item(uint32_t aIndex,
Nullable<nsTArray<nsRefPtr<nsIUndoManagerTransaction> > >& aItems,
Nullable<nsTArray<nsRefPtr<DOMTransaction> > >& aItems,
ErrorResult& aRv)
{
int32_t numRedo;
@ -1031,13 +1044,13 @@ UndoManager::Item(uint32_t aIndex,
return;
}
nsTArray<nsIUndoManagerTransaction*> transactions;
nsTArray<DOMTransaction*> transactions;
ItemInternal(aIndex, transactions, aRv);
if (aRv.Failed()) {
return;
}
nsTArray<nsRefPtr<nsIUndoManagerTransaction> >& items = aItems.SetValue();
nsTArray<nsRefPtr<DOMTransaction> >& items = aItems.SetValue();
for (uint32_t i = 0; i < transactions.Length(); i++) {
items.AppendElement(transactions[i]);
}
@ -1117,7 +1130,7 @@ UndoManager::DispatchTransactionEvent(JSContext* aCx, const nsAString& aType,
uint32_t aPreviousPosition,
ErrorResult& aRv)
{
nsTArray<nsIUndoManagerTransaction*> items;
nsTArray<DOMTransaction*> items;
ItemInternal(aPreviousPosition, items, aRv);
if (aRv.Failed()) {
return;
@ -1145,16 +1158,12 @@ UndoManager::DispatchTransactionEvent(JSContext* aCx, const nsAString& aType,
nsCOMPtr<nsIWritableVariant> transactions = new nsVariant();
// Unwrap the nsIUndoManagerTransactions into jsvals, then convert
// Unwrap the DOMTransactions into jsvals, then convert
// to nsIVariant then put into a nsIVariant array. Arrays in XPIDL suck.
JSObject* obj;
nsCOMArray<nsIVariant> keepAlive;
nsTArray<nsIVariant*> transactionItems;
for (uint32_t i = 0; i < items.Length(); i++) {
nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS = do_QueryInterface(items[i]);
MOZ_ASSERT(wrappedJS, "All transactions should be WrappedJS.");
wrappedJS->GetJSObject(&obj);
jsval txVal = JS::ObjectValue(*obj);
JS::Value txVal = JS::ObjectValue(*items[i]->Callback());
if (!JS_WrapValue(aCx, &txVal)) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return;

View File

@ -15,7 +15,6 @@
#include "mozilla/dom/Nullable.h"
#include "nsIContent.h"
class nsIUndoManagerTransaction;
class nsITransactionManager;
class nsIMutationObserver;
@ -23,6 +22,9 @@ namespace mozilla {
class ErrorResult;
namespace dom {
class DOMTransaction;
class DOMTransactionCallback;
class UndoManager : public nsISupports,
public nsWrapperCache
{
@ -33,12 +35,12 @@ public:
explicit UndoManager(nsIContent* aNode);
void Transact(JSContext* aCx, nsIUndoManagerTransaction& aTransaction,
void Transact(JSContext* aCx, DOMTransaction& aTransaction,
bool aMerge, ErrorResult& aRv);
void Undo(JSContext* aCx, ErrorResult& aRv);
void Redo(JSContext* acx, ErrorResult& aRv);
void Item(uint32_t aIndex,
Nullable<nsTArray<nsRefPtr<nsIUndoManagerTransaction> > >& aItems,
Nullable<nsTArray<nsRefPtr<DOMTransaction> > >& aItems,
ErrorResult& aRv);
uint32_t GetLength(ErrorResult& aRv);
uint32_t GetPosition(ErrorResult& aRv);
@ -69,13 +71,15 @@ protected:
/**
* Executes |aTransaction| as a manual transaction.
*/
void ManualTransact(nsIUndoManagerTransaction* aTransaction,
void ManualTransact(DOMTransaction* aTransaction,
ErrorResult& aRv);
/**
* Executes |aTransaction| as an automatic transaction.
* Executes |aTransaction| as an automatic transaction, calling
* aCallback to do the work.
*/
void AutomaticTransact(nsIUndoManagerTransaction* aTransaction,
void AutomaticTransact(DOMTransaction* aTransaction,
DOMTransactionCallback* aCallback,
ErrorResult& aRv);
/**
@ -83,7 +87,7 @@ protected:
* to the array |aItems|.
*/
void ItemInternal(uint32_t aIndex,
nsTArray<nsIUndoManagerTransaction*>& aItems,
nsTArray<DOMTransaction*>& aItems,
ErrorResult& aRv);
/**

View File

@ -21,6 +21,8 @@
#include "nsIScriptError.h"
#include "nsContentUtils.h"
#include "mozilla/dom/ElementBinding.h"
using namespace mozilla;
using namespace mozilla::dom;
@ -941,3 +943,9 @@ nsMathMLElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttr,
return rv;
}
JSObject*
nsMathMLElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return ElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}

View File

@ -27,7 +27,9 @@ public:
nsMathMLElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsMathMLElementBase(aNodeInfo), Link(this),
mIncrementScriptLevel(false)
{}
{
SetIsDOMBinding();
}
// Implementation of nsISupports is inherited from nsMathMLElementBase
NS_DECL_ISUPPORTS_INHERITED
@ -104,6 +106,11 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope,
bool *aTriedToWrap) MOZ_OVERRIDE;
private:
bool mIncrementScriptLevel;
};

View File

@ -16,6 +16,7 @@
#include "mozilla/RefPtr.h"
#include "nsIThreadPool.h"
#include "nsXPCOMCIDInternal.h"
#include <algorithm>
namespace mozilla {

View File

@ -374,10 +374,10 @@ function test_isEqualNode_wholeDoc()
var doc2 = ParseFile("isequalnode_data.xml");
var tw1 =
doc.createTreeWalker(doc, Components.interfaces.nsIDOMNodeFilter.SHOW_ALL,
null, false);
null);
var tw2 =
doc2.createTreeWalker(doc2, Components.interfaces.nsIDOMNodeFilter.SHOW_ALL,
null, false);
null);
do {
check_eq_nodes(tw1.currentNode, tw2.currentNode);
tw1.nextNode();

View File

@ -133,8 +133,7 @@ function evalXPathInDocumentFragment(aContextNode, aPath) {
var walker = aContextNode.ownerDocument.createTreeWalker(
aContextNode,
targetType,
filter,
true);
filter);
var targetNode = walker.nextNode();
do_check_neq(targetNode, null);
@ -187,8 +186,7 @@ function getParsedDocument(aPath) {
var walker = doc.createTreeWalker(doc,
C_i.nsIDOMNodeFilter.SHOW_TEXT |
C_i.nsIDOMNodeFilter.SHOW_CDATA_SECTION,
isWhitespace,
false);
isWhitespace);
while (walker.nextNode()) {
var parent = walker.currentNode.parentNode;
parent.removeChild(walker.currentNode);
@ -279,8 +277,7 @@ function run_extract_test() {
dump("Ensure the original nodes weren't extracted - test " + i + "\n\n");
var walker = doc.createTreeWalker(baseFrag,
C_i.nsIDOMNodeFilter.SHOW_ALL,
null,
false);
null);
var foundStart = false;
var foundEnd = false;
do {
@ -313,8 +310,7 @@ function run_extract_test() {
dump("Ensure the original nodes weren't deleted - test " + i + "\n\n");
walker = doc.createTreeWalker(baseFrag,
C_i.nsIDOMNodeFilter.SHOW_ALL,
null,
false);
null);
foundStart = false;
foundEnd = false;
do {

View File

@ -19,7 +19,7 @@ function test_treeWalker_currentNode()
var body = doc.getElementsByTagName("body")[0];
var filter = I.nsIDOMNodeFilter.SHOW_ELEMENT | I.nsIDOMNodeFilter.SHOW_TEXT;
var walker = doc.createTreeWalker(body, filter, null, false);
var walker = doc.createTreeWalker(body, filter, null);
walker.currentNode = body.firstChild;
walker.nextNode();
}

View File

@ -19,6 +19,7 @@
#include "nsCOMPtr.h"
#include "nsDOMString.h"
#include "nsStringBuffer.h"
#include "nsTArray.h"
namespace mozilla {
namespace dom {
@ -212,6 +213,172 @@ private:
bool mIsNull;
};
// Class for representing optional arguments.
template<typename T>
class Optional
{
public:
Optional()
{}
bool WasPassed() const
{
return !mImpl.empty();
}
void Construct()
{
mImpl.construct();
}
template <class T1>
void Construct(const T1 &t1)
{
mImpl.construct(t1);
}
template <class T1, class T2>
void Construct(const T1 &t1, const T2 &t2)
{
mImpl.construct(t1, t2);
}
const T& Value() const
{
return mImpl.ref();
}
T& Value()
{
return mImpl.ref();
}
// If we ever decide to add conversion operators for optional arrays
// like the ones Nullable has, we'll need to ensure that Maybe<> has
// the boolean before the actual data.
private:
// Forbid copy-construction and assignment
Optional(const Optional& other) MOZ_DELETE;
const Optional &operator=(const Optional &other) MOZ_DELETE;
Maybe<T> mImpl;
};
// Specialization for strings.
// XXXbz we can't pull in FakeDependentString here, because it depends on
// internal strings. So we just have to forward-declare it and reimplement its
// ToAStringPtr.
struct FakeDependentString;
template<>
class Optional<nsAString>
{
public:
Optional() : mPassed(false) {}
bool WasPassed() const
{
return mPassed;
}
void operator=(const nsAString* str)
{
MOZ_ASSERT(str);
mStr = str;
mPassed = true;
}
// If this code ever goes away, remove the comment pointing to it in the
// FakeDependentString class in BindingUtils.h.
void operator=(const FakeDependentString* str)
{
MOZ_ASSERT(str);
mStr = reinterpret_cast<const nsDependentString*>(str);
mPassed = true;
}
const nsAString& Value() const
{
MOZ_ASSERT(WasPassed());
return *mStr;
}
private:
// Forbid copy-construction and assignment
Optional(const Optional& other) MOZ_DELETE;
const Optional &operator=(const Optional &other) MOZ_DELETE;
bool mPassed;
const nsAString* mStr;
};
// Class for representing sequences in arguments. We use an auto array that can
// hold 16 elements, to avoid having to allocate in common cases. This needs to
// be fallible because web content controls the length of the array, and can
// easily try to create very large lengths.
template<typename T>
class Sequence : public AutoFallibleTArray<T, 16>
{
public:
Sequence() : AutoFallibleTArray<T, 16>()
{}
};
class RootedJSValue
{
public:
RootedJSValue()
: mCx(nullptr)
{}
~RootedJSValue()
{
if (mCx) {
JS_RemoveValueRoot(mCx, &mValue);
}
}
bool SetValue(JSContext* aCx, JS::Value aValue)
{
// We don't go ahead and root if v is null, because we want to allow
// null-initialization even when there is no cx.
MOZ_ASSERT_IF(!aValue.isNull(), aCx);
// Be careful to not clobber mCx if it's already set, just in case we're
// being null-initialized (with a null cx for some reason) after we have
// already been initialized properly with a non-null value.
if (!aValue.isNull() && !mCx) {
if (!JS_AddNamedValueRoot(aCx, &mValue, "RootedJSValue::mValue")) {
return false;
}
mCx = aCx;
}
mValue = aValue;
return true;
}
operator JS::Value()
{
return mValue;
}
operator const JS::Value() const
{
return mValue;
}
private:
// Don't allow copy-construction of these objects, because it'll do the wrong
// thing with our flag mCx.
RootedJSValue(const RootedJSValue&) MOZ_DELETE;
JS::Value mValue;
JSContext* mCx;
};
} // namespace dom
} // namespace mozilla

View File

@ -23,6 +23,7 @@
#include "nsWrapperCacheInlines.h"
#include "mozilla/Likely.h"
#include "mozilla/dom/BindingDeclarations.h"
#include "mozilla/dom/CallbackObject.h"
// nsGlobalWindow implements nsWrapperCache, but doesn't always use it. Don't
// try to use it without fixing that first.
@ -1120,18 +1121,36 @@ struct GetParentObject<T, false>
}
};
MOZ_ALWAYS_INLINE
JSObject* GetJSObjectFromCallback(CallbackObject* callback)
{
return callback->Callback();
}
MOZ_ALWAYS_INLINE
JSObject* GetJSObjectFromCallback(void* noncallback)
{
return nullptr;
}
template<typename T>
static inline JSObject*
WrapCallThisObject(JSContext* cx, JSObject* scope, const T& p)
{
// WrapNativeParent is a bit of a Swiss army knife that will
// wrap anything for us.
JSObject* obj = WrapNativeParent(cx, scope, p);
// Callbacks are nsISupports, so WrapNativeParent will just happily wrap them
// up as an nsISupports XPCWrappedNative... which is not at all what we want.
// So we need to special-case them.
JSObject* obj = GetJSObjectFromCallback(p);
if (!obj) {
return nullptr;
// WrapNativeParent is a bit of a Swiss army knife that will
// wrap anything for us.
obj = WrapNativeParent(cx, scope, p);
if (!obj) {
return nullptr;
}
}
// But it won't necessarily put things in the compartment of cx.
// But all that won't necessarily put things in the compartment of cx.
if (!JS_WrapObject(cx, &obj)) {
return nullptr;
}
@ -1415,6 +1434,8 @@ struct FakeDependentString {
mFlags |= nsDependentString::F_VOIDED;
}
// If this ever changes, change the corresponding code in the
// Optional<nsAString> specialization as well.
const nsAString* ToAStringPtr() const {
return reinterpret_cast<const nsDependentString*>(this);
}
@ -1507,97 +1528,6 @@ ConvertJSValueToString(JSContext* cx, const JS::Value& v, JS::Value* pval,
return true;
}
// Class for representing optional arguments.
template<typename T>
class Optional {
public:
Optional() {}
bool WasPassed() const {
return !mImpl.empty();
}
void Construct() {
mImpl.construct();
}
template <class T1>
void Construct(const T1 &t1) {
mImpl.construct(t1);
}
template <class T1, class T2>
void Construct(const T1 &t1, const T2 &t2) {
mImpl.construct(t1, t2);
}
const T& Value() const {
return mImpl.ref();
}
T& Value() {
return mImpl.ref();
}
// If we ever decide to add conversion operators for optional arrays
// like the ones Nullable has, we'll need to ensure that Maybe<> has
// the boolean before the actual data.
private:
// Forbid copy-construction and assignment
Optional(const Optional& other) MOZ_DELETE;
const Optional &operator=(const Optional &other) MOZ_DELETE;
Maybe<T> mImpl;
};
// Specialization for strings.
template<>
class Optional<nsAString> {
public:
Optional() : mPassed(false) {}
bool WasPassed() const {
return mPassed;
}
void operator=(const nsAString* str) {
MOZ_ASSERT(str);
mStr = str;
mPassed = true;
}
void operator=(const FakeDependentString* str) {
MOZ_ASSERT(str);
mStr = str->ToAStringPtr();
mPassed = true;
}
const nsAString& Value() const {
MOZ_ASSERT(WasPassed());
return *mStr;
}
private:
// Forbid copy-construction and assignment
Optional(const Optional& other) MOZ_DELETE;
const Optional &operator=(const Optional &other) MOZ_DELETE;
bool mPassed;
const nsAString* mStr;
};
// Class for representing sequences in arguments. We use an auto array that can
// hold 16 elements, to avoid having to allocate in common cases. This needs to
// be fallible because web content controls the length of the array, and can
// easily try to create very large lengths.
template<typename T>
class Sequence : public AutoFallibleTArray<T, 16>
{
public:
Sequence() : AutoFallibleTArray<T, 16>() {}
};
// Class for holding the type of members of a union. The union type has an enum
// to keep track of which of its UnionMembers has been constructed.
template<class T>

View File

@ -322,12 +322,6 @@ DOMInterfaces = {
'workers': True,
},
'DOMTransaction': [
{
'nativeType': 'nsIUndoManagerTransaction',
'headerFile': 'nsIUndoManagerTransaction.h',
}],
'UndoManager': [
{
'implicitJSContext' : [ 'undo', 'redo', 'transact' ]

View File

@ -2479,8 +2479,7 @@ for (uint32_t i = 0; i < length; ++i) {
if (descriptor.interface.isCallback() and
descriptor.interface.identifier.name != "NodeFilter" and
descriptor.interface.identifier.name != "EventListener" and
descriptor.interface.identifier.name != "DOMTransaction"):
descriptor.interface.identifier.name != "EventListener"):
if descriptor.workers:
if type.nullable():
declType = CGGeneric("JSObject*")
@ -2831,13 +2830,21 @@ for (uint32_t i = 0; i < length; ++i) {
if type.isAny():
assert not isEnforceRange and not isClamp
if isMember:
raise TypeError("Can't handle member 'any'; need to sort out "
"rooting issues")
templateBody = "${declName} = ${val};"
templateBody = handleDefaultNull(templateBody,
"${declName} = JS::NullValue()")
return (templateBody, CGGeneric("JS::Value"), None, isOptional)
if isMember == "Dictionary":
declType = "RootedJSValue"
templateBody = ("if (!${declName}.SetValue(cx, ${val})) {\n"
" return false;\n"
"}")
nullHandling = "${declName}.SetValue(nullptr, JS::NullValue())"
elif isMember:
raise TypeError("Can't handle sequence member 'any'; need to sort "
"out rooting issues")
else:
declType = "JS::Value"
templateBody = "${declName} = ${val};"
nullHandling = "${declName} = JS::NullValue()"
templateBody = handleDefaultNull(templateBody, nullHandling)
return (templateBody, CGGeneric(declType), None, isOptional)
if type.isObject():
assert not isEnforceRange and not isClamp
@ -3322,8 +3329,7 @@ if (!returnArray) {
if (type.isGeckoInterface() and
(not type.isCallbackInterface() or
type.unroll().inner.identifier.name == "EventListener" or
type.unroll().inner.identifier.name == "NodeFilter" or
type.unroll().inner.identifier.name == "DOMTransaction")):
type.unroll().inner.identifier.name == "NodeFilter")):
descriptor = descriptorProvider.getDescriptor(type.unroll().inner.identifier.name)
if type.nullable():
wrappingCode = ("if (!%s) {\n" % (result) +
@ -7283,8 +7289,7 @@ class CGNativeMember(ClassMethod):
if (type.isGeckoInterface() and
(not type.isCallbackInterface() or
type.unroll().inner.identifier.name == "NodeFilter" or
type.unroll().inner.identifier.name == "EventListener" or
type.unroll().inner.identifier.name == "DOMTransaction")):
type.unroll().inner.identifier.name == "EventListener")):
iface = type.unroll().inner
argIsPointer = type.nullable() or iface.isExternal()
forceOwningType = iface.isCallback() or isMember

View File

@ -533,6 +533,7 @@ dictionary Dict : ParentDict {
boolean prototype;
object? anotherObj = null;
TestCallback? someCallback = null;
any someAny;
};
dictionary ParentDict : GrandparentDict {

View File

@ -226,7 +226,9 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
nsIScriptContext* sc = GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS_VOID(rv);
if (!SetJsObject(sc->GetNativeContext(), value, mJsUuids)) {
if (NS_FAILED(nsTArrayToJSArray(sc->GetNativeContext(),
mUuids,
&mJsUuids))) {
NS_WARNING("Cannot set JS UUIDs object!");
return;
}
@ -237,7 +239,9 @@ BluetoothAdapter::SetPropertyByValue(const BluetoothNamedValue& aValue)
nsIScriptContext* sc = GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS_VOID(rv);
if (!SetJsObject(sc->GetNativeContext(), value, mJsDeviceAddresses)) {
if (NS_FAILED(nsTArrayToJSArray(sc->GetNativeContext(),
mDeviceAddresses,
&mJsDeviceAddresses))) {
NS_WARNING("Cannot set JS Devices object!");
return;
}
@ -576,7 +580,7 @@ BluetoothAdapter::SetPinCode(const nsAString& aDeviceAddress,
}
req.forget(aRequest);
return NS_OK;
return NS_OK;
}
nsresult
@ -599,7 +603,7 @@ BluetoothAdapter::SetPasskey(const nsAString& aDeviceAddress, uint32_t aPasskey,
}
req.forget(aRequest);
return NS_OK;
return NS_OK;
}
nsresult
@ -625,7 +629,7 @@ BluetoothAdapter::SetPairingConfirmation(const nsAString& aDeviceAddress,
}
req.forget(aRequest);
return NS_OK;
return NS_OK;
}
nsresult
@ -648,7 +652,7 @@ BluetoothAdapter::SetAuthorization(const nsAString& aDeviceAddress, bool aAllow,
}
req.forget(aRequest);
return NS_OK;
return NS_OK;
}
NS_IMETHODIMP

View File

@ -12,6 +12,8 @@
#include "nsDOMClassInfo.h"
#include "nsContentUtils.h"
#include "nsTArrayHelpers.h"
#include "mozilla/dom/bluetooth/BluetoothTypes.h"
USING_BLUETOOTH_NAMESPACE
@ -117,7 +119,9 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue)
nsIScriptContext* sc = GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS_VOID(rv);
if (!SetJsObject(sc->GetNativeContext(), value, mJsUuids)) {
if (NS_FAILED(nsTArrayToJSArray(sc->GetNativeContext(),
mUuids,
&mJsUuids))) {
NS_WARNING("Cannot set JS UUIDs object!");
return;
}
@ -128,8 +132,10 @@ BluetoothDevice::SetPropertyByValue(const BluetoothNamedValue& aValue)
nsIScriptContext* sc = GetContextForEventHandlers(&rv);
NS_ENSURE_SUCCESS_VOID(rv);
if (!SetJsObject(sc->GetNativeContext(), value, mJsServices)) {
NS_WARNING("Cannot set JS Devices object!");
if (NS_FAILED(nsTArrayToJSArray(sc->GetNativeContext(),
mServices,
&mJsServices))) {
NS_WARNING("Cannot set JS Services object!");
return;
}
Root();
@ -169,8 +175,8 @@ BluetoothDevice::Notify(const BluetoothSignal& aData)
if (aData.name().EqualsLiteral("PropertyChanged")) {
NS_ASSERTION(v.type() == BluetoothValue::TArrayOfBluetoothNamedValue,
"PropertyChanged: Invalid value type");
const InfallibleTArray<BluetoothNamedValue>& arr =
v.get_ArrayOfBluetoothNamedValue();
const InfallibleTArray<BluetoothNamedValue>& arr =
v.get_ArrayOfBluetoothNamedValue();
NS_ASSERTION(arr.Length() == 1,
"Got more than one property in a change message!");

View File

@ -16,7 +16,6 @@
#include "nsISystemMessagesInternal.h"
#include "nsString.h"
#include "nsTArray.h"
#include "nsTArrayHelpers.h"
BEGIN_BLUETOOTH_NAMESPACE
@ -27,51 +26,45 @@ SetJsObject(JSContext* aContext,
{
MOZ_ASSERT(aContext && aObj);
if (aValue.type() == BluetoothValue::TArrayOfnsString) {
const nsTArray<nsString>& sourceArray = aValue.get_ArrayOfnsString();
if (NS_FAILED(nsTArrayToJSArray(aContext, sourceArray, &aObj))) {
NS_WARNING("Cannot set JS UUIDs object!");
if (aValue.type() != BluetoothValue::TArrayOfBluetoothNamedValue) {
NS_WARNING("SetJsObject: Invalid parameter type");
return false;
}
const nsTArray<BluetoothNamedValue>& arr =
aValue.get_ArrayOfBluetoothNamedValue();
for (uint32_t i = 0; i < arr.Length(); i++) {
jsval val;
const BluetoothValue& v = arr[i].value();
JSString* jsData;
switch(v.type()) {
case BluetoothValue::TnsString:
jsData =
JS_NewStringCopyN(aContext,
NS_ConvertUTF16toUTF8(v.get_nsString()).get(),
v.get_nsString().Length());
NS_ENSURE_TRUE(jsData, false);
val = STRING_TO_JSVAL(jsData);
break;
case BluetoothValue::Tuint32_t:
val = INT_TO_JSVAL(v.get_uint32_t());
break;
case BluetoothValue::Tbool:
val = BOOLEAN_TO_JSVAL(v.get_bool());
break;
default:
NS_WARNING("SetJsObject: Parameter is not handled");
break;
}
if (!JS_SetProperty(aContext, aObj,
NS_ConvertUTF16toUTF8(arr[i].name()).get(),
&val)) {
NS_WARNING("Failed to set property");
return false;
}
} else if (aValue.type() == BluetoothValue::TArrayOfBluetoothNamedValue) {
const nsTArray<BluetoothNamedValue>& arr =
aValue.get_ArrayOfBluetoothNamedValue();
for (uint32_t i = 0; i < arr.Length(); i++) {
jsval val;
const BluetoothValue& v = arr[i].value();
JSString* JsData;
switch(v.type()) {
case BluetoothValue::TnsString:
JsData =
JS_NewStringCopyN(aContext,
NS_ConvertUTF16toUTF8(v.get_nsString()).get(),
v.get_nsString().Length());
NS_ENSURE_TRUE(JsData, false);
val = STRING_TO_JSVAL(JsData);
break;
case BluetoothValue::Tuint32_t:
val = INT_TO_JSVAL(v.get_uint32_t());
break;
case BluetoothValue::Tbool:
val = BOOLEAN_TO_JSVAL(v.get_bool());
break;
default:
NS_WARNING("SetJsObject: Parameter is not handled");
break;
}
if (!JS_SetProperty(aContext, aObj,
NS_ConvertUTF16toUTF8(arr[i].name()).get(),
&val)) {
NS_WARNING("Failed to set property");
return false;
}
}
} else {
NS_WARNING("Not handle the type of BluetoothValue!");
return false;
}
return true;

View File

@ -385,7 +385,13 @@ ContactManager.prototype = {
if (req) {
let result = contacts.map(function(c) {
let contact = new Contact();
contact.init( { name: [c.alphaId], tel: [ { value: c.number } ] } );
let prop = {name: [c.alphaId], tel: [ { value: c.number } ]};
if (c.email) {
prop.email = [{value: c.email}];
}
contact.init(prop);
return contact;
});
if (DEBUG) debug("result: " + JSON.stringify(result));

View File

@ -139,7 +139,7 @@
"NodeIterator interface: attribute pointerBeforeReferenceNode": true,
"NodeIterator interface: attribute whatToShow": true,
"NodeIterator interface: attribute filter": true,
"Stringification of document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)": "debug",
"Stringification of document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null)": "debug",
"TreeWalker interface: existence and properties of interface object": true,
"TreeWalker interface: existence and properties of interface prototype object": true,
"TreeWalker interface: existence and properties of interface prototype object's \"constructor\" property": true,
@ -147,7 +147,7 @@
"TreeWalker interface: attribute whatToShow": true,
"TreeWalker interface: attribute filter": true,
"TreeWalker interface: attribute currentNode": true,
"Stringification of document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null, false)": "debug",
"Stringification of document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null)": "debug",
"NodeFilter interface: existence and properties of interface object": true,
"NodeFilter interface: existence and properties of interface prototype object": true,
"NodeFilter interface: existence and properties of interface prototype object's \"constructor\" property": true,

View File

@ -509,8 +509,8 @@ idlArray.add_objects({
ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'],
Comment: ['document.createComment("abc")'],
Range: ['document.createRange()', 'detachedRange'],
NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)'],
TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null, false)'],
NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null)'],
TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null)'],
NodeList: ['document.querySelectorAll("script")'],
HTMLCollection: ['document.body.children'],
DOMTokenList: ['document.body.classList'],

View File

@ -84,7 +84,6 @@ SDK_XPIDLSRCS = \
nsIDOMHTMLVideoElement.idl \
nsIDOMHTMLAudioElement.idl \
nsIDOMValidityState.idl \
nsIUndoManagerTransaction.idl \
nsIDOMMozBrowserFrame.idl \
$(NULL)

View File

@ -1,17 +0,0 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
[scriptable, uuid(3802f155-e0f5-49ba-9972-e1aadcf2fdf0)]
interface nsIUndoManagerTransaction : nsISupports
{
attribute DOMString label;
void executeAutomatic();
void execute();
void undo();
void redo();
};

View File

@ -16,9 +16,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=791330
pc.close();
navigator.mozGetUserMedia({audio: true, fake: true}, function (stream) {
pc.addStream(stream);
pc.createOffer(function (offer) {});
finish();
try {
pc.addStream(stream);
pc.createOffer(function (offer) {});
}
finally {
stream.stop();
finish();
}
}, function () {});
}
</script>

View File

@ -18,6 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=799419
v1.close();
}
</script>
</head>
<body onload="boom()">
<video id="pc1video" width="100" height="100" controls></video>
<video id="pc2video" width="100" height="100" controls></video>

View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=837421
-->
<head>
<meta charset="utf-8">
<title>Bug 837421</title>
<script type="application/javascript">
function start() {
var o0 = mozRTCPeerConnection();
var o1 = new mozRTCIceCandidate({"candidate":"127 15 UDP 1 stun.sipgate.net 134117531 type 2001:db8:85a3:0:0:8a2e:370:3478 rport","sdpMid":"application 3566220586 RTP/AVP 5000","sdpMLineIndex":-32767});
o0.connectDataConnection(3478,-1);
o0.connectDataConnection(-1,3478,2);
var o2 = mozRTCPeerConnection();
o2.addIceCandidate(o1);
o2.connectDataConnection(-1,3478,0.5);
o2.connectDataConnection(3478,-1,0.5);
var o3 = new mozRTCIceCandidate({"candidate":"31 2097151 IP 33554431 ::ffff:192.0.2.128 3999799469 type numb.viagenie.ca host","sdpMid":"application 1261077875 RTP/AVP 5000","sdpMLineIndex":16777215});
o2.connectDataConnection(1,3478);
o2.connectDataConnection(3478,1);
try {o2.updateIce()} catch(e) {}
o2.addIceCandidate(o3);
}
</script>
</head>
<body onload="start();"></body>
</html>

View File

@ -8,5 +8,6 @@ load 799419.html
load 801227.html
load 802982.html
load 812785.html
load 834100.html
load 822197.html
load 834100.html
load 837421.html

View File

@ -220,6 +220,8 @@ NetworkManager.prototype = {
this.waitForConnectionReadyCallback.call(this);
this.waitForConnectionReadyCallback = null;
}
// Probing the public network accessibility after routing table is ready
CaptivePortalDetectionHelper.notify(CaptivePortalDetectionHelper.EVENT_CONNECT, this.active);
break;
case Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED:
// Remove host route for data calls
@ -228,6 +230,8 @@ NetworkManager.prototype = {
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL) {
this.removeHostRoute(network);
}
// Abort ongoing captive portal detection on the wifi interface
CaptivePortalDetectionHelper.notify(CaptivePortalDetectionHelper.EVENT_DISCONNECT, network);
this.setAndConfigureActive();
// Update data connection when Wifi connected/disconnected
if (network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
@ -835,6 +839,75 @@ NetworkManager.prototype = {
}
};
let CaptivePortalDetectionHelper = (function() {
const EVENT_CONNECT = "Connect";
const EVENT_DISCONNECT = "Disconnect";
let _ongoingInterface = null;
let _available = ("nsICaptivePortalDetector" in Ci);
let getService = function () {
return Cc['@mozilla.org/services/captive-detector;1'].getService(Ci.nsICaptivePortalDetector);
};
let _performDetection = function (interfaceName, callback) {
let capService = getService();
let capCallback = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsICaptivePortalCallback]),
prepare: function prepare() {
capService.finishPreparation(interfaceName);
},
complete: function complete(success) {
_ongoingInterface = null;
callback(success);
}
};
// Abort any unfinished captive portal detection.
if (_ongoingInterface != null) {
capService.abort(_ongoingInterface);
_ongoingInterface = null;
}
capService.checkCaptivePortal(interfaceName, capCallback);
_ongoingInterface = interfaceName;
};
let _abort = function (interfaceName) {
if (_ongoingInterface !== interfaceName) {
return;
}
let capService = getService();
capService.abort(_ongoingInterface);
_ongoingInterface = null;
};
return {
EVENT_CONNECT: EVENT_CONNECT,
EVENT_DISCONNECT: EVENT_DISCONNECT,
notify: function notify(eventType, network) {
switch (eventType) {
case EVENT_CONNECT:
// perform captive portal detection on wifi interface
if (_available && network &&
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
_performDetection(network.name, function () {
// TODO: bug 837600
// We can disconnect wifi in here if user abort the login procedure.
});
}
break;
case EVENT_DISCONNECT:
if (_available &&
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
_abort(network.name);
}
break;
}
}
};
}());
XPCOMUtils.defineLazyServiceGetter(NetworkManager.prototype, "mRIL",
"@mozilla.org/ril;1",
"nsIRadioInterfaceLayer");

View File

@ -9149,6 +9149,82 @@ let ICCRecordHelper = {
onerror: onerror});
},
/**
* Read ICC EF_IAP. (Index Administration Phonebook)
*
* @see TS 131.102, clause 4.4.2.2
*
* @param fileId EF id of the IAP.
* @param recordNumber The number of the record shall be loaded.
* @param onsuccess Callback to be called when success.
* @param onerror Callback to be called when error.
*/
readIAP: function readIAP(fileId, recordNumber, onsuccess, onerror) {
function callback(options) {
let strLen = Buf.readUint32();
let octetLen = strLen / 2;
let iap = GsmPDUHelper.readHexOctetArray(octetLen);
Buf.readStringDelimiter(strLen);
if (onsuccess) {
onsuccess(iap);
}
}
ICCIOHelper.loadLinearFixedEF({fileId: fileId,
recordNumber: recordNumber,
callback: callback.bind(this),
onerror: onerror});
},
/**
* Read USIM Phonebook EF_EMAIL.
*
* @see TS 131.102, clause 4.4.2.13
*
* @param fileId EF id of the EMAIL.
* @param fileType The type of the EMAIL, one of the ICC_USIM_TYPE* constants.
* @param recordNumber The number of the record shall be loaded.
* @param onsuccess Callback to be called when success.
* @param onerror Callback to be called when error.
*/
readEmail: function readEmail(fileId, fileType, recordNumber, onsuccess, onerror) {
function callback(optoins) {
let strLen = Buf.readUint32();
let octetLen = strLen / 2;
let email = null;
// Read contact's email
//
// | Byte | Description | Length | M/O
// | 1 ~ X | E-mail Address | X | M
// | X+1 | ADN file SFI | 1 | C
// | X+2 | ADN file Record Identifier | 1 | C
// Note: The fields marked as C above are mandatort if the file
// is not type 1 (as specified in EF_PBR)
if (fileType == ICC_USIM_TYPE1_TAG) {
email = GsmPDUHelper.read8BitUnpackedToString(octetLen);
} else {
email = GsmPDUHelper.read8BitUnpackedToString(octetLen - 2);
// Consumes the remaining buffer
Buf.seekIncoming(2 * PDU_HEX_OCTET_SIZE); // For ADN SFI and Record Identifier
}
Buf.readStringDelimiter(strLen);
if (onsuccess) {
onsuccess(email);
}
}
ICCIOHelper.loadLinearFixedEF({fileId: fileId,
recordNumber: recordNumber,
callback: callback.bind(this),
onerror: onerror});
},
/**
* Read the PLMNsel (Public Land Mobile Network) from the ICC.
*
@ -9897,8 +9973,20 @@ let ICCContactHelper = {
readUSimContacts: function readUSimContacts(onsuccess, onerror) {
let gotPbrCb = function gotPbrCb(pbr) {
if (pbr.adn) {
let gotAdnCb = function gotAdnCb(contacts) {
// Only try to read contact's email when the email tag is shown in pbr.
if (!pbr.email) {
if (onsuccess) {
onsuccess(contacts)
}
return;
}
this.readUSimEmails(pbr, contacts, onsuccess, onerror);
}.bind(this);
let fileId = pbr.adn.fileId;
ICCRecordHelper.readADN(fileId, onsuccess, onerror);
ICCRecordHelper.readADN(fileId, gotAdnCb, onerror);
} else {
let error = onerror || debug;
error("Cannot access ADN.");
@ -9908,6 +9996,66 @@ let ICCContactHelper = {
ICCRecordHelper.readPBR(gotPbrCb, onerror);
},
/**
* Read all contacts' email from USIM.
*
* @param pbr The phonebook reference file.
* @param contacts The contacts need to get email.
* @param onsuccess Callback to be called when success.
* @param onerror Callback to be called when error.
*/
readUSimEmails: function readUSimEmails(pbr, contacts, onsuccess, onerror) {
(function doReadContactEmail(n) {
if (n >= contacts.length) {
// All contact's email are readed.
if (onsuccess) {
onsuccess(contacts);
}
return;
}
// get n-th contact's email
ICCContactHelper.readUSimContactEmail(
pbr, contacts[n], doReadContactEmail.bind(this, n + 1), onerror);
})(0);
},
/**
* Read contact's email from USIM.
*
* @param pbr The phonebook reference file.
* @param contact The contact needs to get email.
* @param onsuccess Callback to be called when success.
* @param onerror Callback to be called when error.
*/
readUSimContactEmail: function readUSimContactEmail(pbr, contact, onsuccess, onerror) {
let gotRecordIdCb = function gotRecordIdCb(recordId) {
if (recordId == 0xff) {
// Need not to read EF_EMAIL
if (onsuccess) {
onsuccess();
}
return;
}
let fileId = pbr.email.fileId;
let fileType = pbr.email.fileType;
let gotEmailCb = function gotEmailCb(email) {
// Add email into contact if any
if (email) {
contact.email = email;
}
if (onsuccess) {
onsuccess();
}
}.bind(this);
ICCRecordHelper.readEmail(fileId, fileType, recordId, gotEmailCb, onerror);
}.bind(this);
this.getEmailRecordId(pbr, contact, gotRecordIdCb, onerror);
},
/**
* Read contacts from SIM.
*
@ -9949,6 +10097,41 @@ let ICCContactHelper = {
updateSimContact: function updateSimContact(contact, onsuccess, onerror) {
ICCRecordHelper.updateADN(ICC_EF_ADN, contact, onsuccess, onerror);
},
/**
* Get the recordId of Email.
*
* If the fileType of Email is ICC_USIM_TYPE1_TAG, use corresponding ADN recordId.
* otherwise get the recordId from IAP.
*
* @see TS 131.102, clause 4.4.2.2
*
* @param pbr The phonebook reference file.
* @param contact The contact will be updated.
* @param onsuccess Callback to be called when success.
* @param onerror Callback to be called when error.
*/
getEmailRecordId: function getEmailRecordId(pbr, contact, onsuccess, onerror) {
if (pbr.email.fileType == ICC_USIM_TYPE1_TAG) {
// If the file type is ICC_USIM_TYPE1_TAG, use corresponding ADN recordId.
if (onsuccess) {
onsuccess(contact.recordId);
}
} else {
// If the file type is ICC_USIM_TYPE2_TAG, the recordId shall be got from IAP.
let gotIapCb = function gotIapCb(iap) {
let indexInIAP = pbr.email.indexInIAP;
let recordId = iap[indexInIAP];
if (onsuccess) {
onsuccess(recordId);
}
}.bind(this);
let fileId = pbr.iap.fileId;
ICCRecordHelper.readIAP(fileId, contact.recordId, gotIapCb, onerror);
}
},
};
/**

View File

@ -1619,3 +1619,53 @@ add_test(function test_stk_event_download_idle_screen_available() {
event: event
});
});
/**
* Verify ICCRecordHelper.readEmail
*/
add_test(function test_read_email() {
let worker = newUint8Worker();
let helper = worker.GsmPDUHelper;
let record = worker.ICCRecordHelper;
let buf = worker.Buf;
let io = worker.ICCIOHelper;
io.loadLinearFixedEF = function fakeLoadLinearFixedEF(options) {
let email_1 = [
0x65, 0x6D, 0x61, 0x69, 0x6C,
0x00, 0x6D, 0x6F, 0x7A, 0x69,
0x6C, 0x6C, 0x61, 0x2E, 0x63,
0x6F, 0x6D, 0x02, 0x23];
// Write data size
buf.writeUint32(email_1.length * 2);
// Write email
for (let i = 0; i < email_1.length; i++) {
helper.writeHexOctet(email_1[i]);
}
// Write string delimiter
buf.writeStringDelimiter(email_1.length * 2);
if (options.callback) {
options.callback(options);
}
};
function doTestReadEmail(type, expectedResult) {
let fileId = 0x6a75;
let recordNumber = 1;
// fileId and recordNumber are dummy arguments.
record.readEmail(fileId, type, recordNumber, function (email) {
do_check_eq(email, expectedResult);
});
};
doTestReadEmail(ICC_USIM_TYPE1_TAG, "email@mozilla.com$#");
doTestReadEmail(ICC_USIM_TYPE2_TAG, "email@mozilla.com");
run_next_test();
});

View File

@ -10,40 +10,46 @@ function test() {
"dom/tests/browser/browser_geolocation_privatebrowsing_page.html";
waitForExplicitFinish();
var windowsToClose = [];
function testOnWindow(aIsPrivate, aCallback) {
var win = OpenBrowserWindow({private: aIsPrivate});
waitForFocus(aCallback, win);
win.addEventListener("load", function onLoad() {
win.removeEventListener("load", onLoad, false);
windowsToClose.push(win);
executeSoon(function() { aCallback(win); });
}, false);
}
registerCleanupFunction(function () {
windowsToClose.forEach(function(win) {
win.close();
});
});
testOnWindow(false, function(aNormalWindow) {
aNormalWindow.gBrowser.selectedTab = aNormalWindow.gBrowser.addTab();
aNormalWindow.gBrowser.selectedBrowser.addEventListener("georesult", function load(ev) {
aNormalWindow.gBrowser.selectedBrowser.removeEventListener("georesult", load, false);
is(ev.detail, 200, "unexpected access token");
prefs.setCharPref("geo.wifi.uri", baseProvider + "?desired_access_token=ggg");
aNormalWindow.close();
testOnWindow(true, function(aPrivateWindow) {
aPrivateWindow.gBrowser.selectedTab = aPrivateWindow.gBrowser.addTab();
aPrivateWindow.gBrowser.selectedBrowser.addEventListener("georesult", function load2(ev) {
aPrivateWindow.gBrowser.selectedBrowser.removeEventListener("georesult", load2, false);
is(ev.detail, 200, "unexpected access token");
prefs.setCharPref("geo.wifi.uri", baseProvider + "?expected_access_token=fff");
aPrivateWindow.close();
testOnWindow(false, function(aNormalWindow) {
aNormalWindow.gBrowser.selectedTab = aNormalWindow.gBrowser.addTab();
aNormalWindow.gBrowser.selectedBrowser.addEventListener("georesult", function load3(ev) {
aNormalWindow.gBrowser.selectedBrowser.removeEventListener("georesult", load3, false);
testOnWindow(false, function(aAnotherNormalWindow) {
aAnotherNormalWindow.gBrowser.selectedBrowser.addEventListener("georesult", function load3(ev) {
aAnotherNormalWindow.gBrowser.selectedBrowser.removeEventListener("georesult", load3, false);
is(ev.detail, 200, "unexpected access token");
prefs.setBoolPref("geo.prompt.testing", false);
prefs.setBoolPref("geo.prompt.testing.allow", false);
aNormalWindow.close();
finish();
}, false, true);
aNormalWindow.content.location = testPageURL;
aAnotherNormalWindow.content.location = testPageURL;
});
}, false, true);
aPrivateWindow.content.location = testPageURL;

View File

@ -32,8 +32,7 @@ function test()
if ("foo" + window == "fooPIRATES!")
return NodeFilter.FILTER_ACCEPT;
return NodeFilter.FILTER_REJECT;
},
true);
});
// That should have been enough to create a leak, but we should do at least
// a couple tests while we're here so that this document doesn't show up as

View File

@ -10,11 +10,13 @@
* liability, trademark and document use rules apply.
*/
callback DOMTransactionCallback = void();
callback interface DOMTransaction {
attribute DOMString label;
void executeAutomatic();
void execute();
void undo();
void redo();
readonly attribute DOMString? label;
readonly attribute DOMTransactionCallback? executeAutomatic;
readonly attribute DOMTransactionCallback? execute;
readonly attribute DOMTransactionCallback? undo;
readonly attribute DOMTransactionCallback? redo;
};

View File

@ -10,8 +10,6 @@
* liability, trademark and document use rules apply.
*/
interface DOMTransaction;
[PrefControlled]
interface UndoManager {
[Throws] void transact(DOMTransaction transaction, boolean merge);

View File

@ -204,7 +204,9 @@ URL::CreateObjectURL(const WorkerGlobalObject& aGlobal, JSObject* aBlob,
nsCOMPtr<nsIDOMBlob> blob = file::GetDOMBlobFromJSObject(aBlob);
if (!blob) {
SetDOMStringToNull(aResult);
aRv.Throw(NS_ERROR_TYPE_ERR);
NS_NAMED_LITERAL_STRING(blobStr, "Blob");
aRv.ThrowTypeError(MSG_DOES_NOT_IMPLEMENT_INTERFACE, &blobStr);
return;
}

View File

@ -59,5 +59,14 @@ onmessage = function() {
postMessage({type: 'status', status: status, msg: 'Blob URL2:' + url});
postMessage({type: 'url', url: url});
status = false;
try {
URL.createObjectURL(new Object());
} catch(e) {
status = true;
}
postMessage({type: 'status', status: status, msg: 'Exception wanted' });
postMessage({type: 'finish' });
}

View File

@ -1627,7 +1627,7 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal(
nsIDOMNodeFilter::SHOW_ELEMENT |
nsIDOMNodeFilter::SHOW_DOCUMENT |
nsIDOMNodeFilter::SHOW_PROCESSING_INSTRUCTION,
nullptr, true, getter_AddRefs(walker));
nullptr, 1, getter_AddRefs(walker));
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMNode> currentNode;

View File

@ -11,6 +11,11 @@
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/GuardObjects.h"
#include "mozilla/ASan.h"
#if defined(MOZ_VALGRIND)
#include "valgrind/memcheck.h"
#endif
/*
* This data structure supports stacky LIFO allocation (mark/release and
@ -66,7 +71,9 @@ class BumpChunk
void setBump(void *ptr) {
JS_ASSERT(bumpBase() <= ptr);
JS_ASSERT(ptr <= limit);
mozilla::DebugOnly<char *> prevBump = bump;
#if defined(DEBUG) || defined(MOZ_ASAN) || defined(MOZ_VALGRIND)
char* prevBump = bump;
#endif
bump = static_cast<char *>(ptr);
#ifdef DEBUG
JS_ASSERT(contains(prevBump));
@ -75,6 +82,19 @@ class BumpChunk
if (prevBump > bump)
memset(bump, 0xcd, prevBump - bump);
#endif
/* Poison/Unpoison memory that we just free'd/allocated */
#if defined(MOZ_ASAN)
if (prevBump > bump)
ASAN_POISON_MEMORY_REGION(bump, prevBump - bump);
else if (bump > prevBump)
ASAN_UNPOISON_MEMORY_REGION(prevBump, bump - prevBump);
#elif defined(MOZ_VALGRIND)
if (prevBump > bump)
VALGRIND_MAKE_MEM_NOACCESS(bump, prevBump - bump);
else if (bump > prevBump)
VALGRIND_MAKE_MEM_UNDEFINED(prevBump, bump - prevBump);
#endif
}
public:

View File

@ -0,0 +1,179 @@
// Binary: cache/js-dbg-32-30b481fd82f5-linux
// Flags: -j
//
var Native = function(k) {
var f = k.initialize;
var d = f;
var j = function(n, l, o, m) {
n.prototype[l] = o;
};
d.alias = function(n, l, o) {
n = this.prototype[n]
return j(this, l, n, o);
};
d.implement = function(m, l, o) {
for (var n in m) {
j(this, n, m[n], l);
}
}
return d;
};
(function() {
var a = {
Array: Array,
Function: Function,
};
for (var h in a) {
new Native({
initialize: a[h],
});
}
} ());
Array.alias("forEach", "each");
function $merge() {
var a = Array.slice(arguments);
a.unshift({});
return $mixin.apply(null, a);
}
function $mixin(e) {
for (var d = 1, a = arguments.length; d < a; d++) {
var b = arguments[d];
for (var c in b) {
var g = b[c],
f = e[c];
e[c] = f && $type(g) == "object" && $type(f) == "object" ? $mixin(f, g) : $unlink(g);
}
}
}
function $type(a) {
if (a == undefined) {
return false;
}
if (a.$family) {
}
return typeof a;
}
function $unlink(c) {
if ($type(c) == "object") {
b = {};
}
return b;
}
var Window = new Native({
initialize: function(a) {},
});
Array.implement({
extend: function(c) {
return this;
}
});
Function.implement({
extend: function(a) {
for (var b in a) {
this[b] = a[b];
}
return this;
},
run: function(a, b) {
return this.apply(b, a);
}
});
function Class(b) {
var a = function() {
Object.reset(this);
var c = this.initialize ? this.initialize.apply(this, arguments) : this;
}.extend(this);
a.implement(b);
return a;
}
Object.reset = function(a, c) {
if (c == null) {
for (var e in a) {
Object.reset(a, e);
}
}
switch ($type(a[c])) {
case "object":
var d = function() {};
d.prototype = a[c];
var b = new d;
a[c] = Object.reset(b);
}
return a;
};
(new Native({initialize: Class})).extend({});
function wrap(a, b, c) {
return function() {
var d = c.apply(this, arguments);
}.extend({});
}
Class.implement({
implement: function(a, d) {
if ($type(a) == "object") {
for (var e in a) {
this.implement(e, a[e]);
}
}
var f = Class.Mutators[a];
if (f) {
d = f.call(this, d);
}
var c = this.prototype;
switch ($type(d)) {
case "function":
c[a] = wrap(this, a, d);
break;
case "object":
var b = c[a];
if ($type(b) == "object") {
$mixin(b, d);
} else {
c[a] = $unlink(d);
}
}
}
});
Class.Mutators = {
Extends: function(a) {
this.prototype = new a;
},
Implements: function(a) {
a.each(function(b) {
b = new b;
this.implement(b);
},
this);
}
};
var Events = new Class({});
var Options = new Class({
setOptions: function() {
this.options = $merge.run([this.options].extend(arguments));
}
});
var Autocompleter = {};
Autocompleter.Base = new Class({
Implements: [Options, Events],
options: {},
});
Autocompleter.Ajax = {};
Autocompleter.Ajax.Base = new Class({
Extends: Autocompleter.Base,
options: {
postVar: "value",
onRequest: function(){},
}
});
Autocompleter.Ajax.Json = new Class({
Extends: Autocompleter.Ajax.Base,
});
Autocompleter.JsonP = new Class({
Extends: Autocompleter.Ajax.Json,
options: {
minLength: 1
},
initialize: function(el, url, options) {
this.setOptions({});
}
});
new Autocompleter.JsonP();

View File

@ -0,0 +1,5 @@
// Binary: cache/js-dbg-32-aa85b2f55960-linux
// Flags:
//
var str = 'afoo$40bar'.substr(1);
print(str.replace(str, str));

View File

@ -0,0 +1,6 @@
// |jit-test| error:SyntaxError
// Binary: cache/js-dbg-64-4c1fbfcf1d0d-linux
// Flags:
//
Iterator(evalcx('#2=*'))

View File

@ -0,0 +1,25 @@
// |jit-test| error:ReferenceError
// Binary: cache/js-dbg-64-82545b1e4129-linux
// Flags:
//
var g = newGlobal('new-compartment');
g.eval("var line0 = Error().lineNumber;\n" +
"function f() {\n" + // line0 + 1
" return 2;\n" + // line0 + 2
"}\n");
var N = 4;
for (var i = 0; i < N; i++) {
var dbg = Debugger(g);
dbg.onDebuggerStatement = function (frame) {
var handler = {hit: function () { hits++; }};
var s = frame.eval("f").return.script;
var offs = s.getLineOffsets(g.line0 + 2);
for (var j = 0; j < offs.length; j++)
s.setBreakpoint(offs[j], handler);
};
g.eval('debugger;');
}
gc(/c$...$/);
assertEq(g.f(), 2);

View File

@ -0,0 +1,11 @@
// Binary: cache/js-dbg-64-f189dd6316eb-linux
// Flags:
//
var g = newGlobal('new-compartment');
g.eval("var a = {};");
var dbg = new Debugger;
var gw = dbg.addDebuggee(g);
var desc = gw.getOwnPropertyDescriptor("a");
gw.defineProperty("b", desc);
Debugger(g.a, g.b);

View File

@ -0,0 +1,26 @@
// Binary: cache/js-dbg-64-48e43edc8834-linux
// Flags:
//
var g = newGlobal('new-compartment');
var dbg = Debugger(g);
dbg.onDebuggerStatement = function (frame) {
var s = frame.eval("f").return.script;
};
function test(s) {
g.eval("line0 = Error().lineNumber;\n" +
"debugger;\n" + // line0 + 1
"function f(i) {\n" + // line0 + 2
"}\n");
}
test("i = 128;\n" + "}\n");
var hits = 0;
dbg.onNewScript = function (s) {
hits++;
};
assertEq(g.eval("eval('2 + 3')"), 5);
this.gczeal(hits, 2);
var fn = g.Function("a", "return 5 + a;");
var g2 = newGlobal('new-compartment');
dbg.addDebuggee(g2, dbg);
g2.clone(fn);

View File

@ -0,0 +1,17 @@
// |jit-test| error:Error
// Binary: cache/js-dbg-64-48e43edc8834-linux
// Flags:
//
function f() {
frame = dbg.getNewestFrame();
}
var g = newGlobal('new-compartment');
g.f = function (a, b) { return a + "/" + this . f( ) ; };
var dbg = Debugger(g);
dbg.onDebuggerStatement = function (frame) {
var f = frame.eval("f").return;
assertEq(f.call(null, "a", "b").return, "a/b");
};
g.eval("debugger;");

View File

@ -0,0 +1,11 @@
// |jit-test| error:Error
// Binary: cache/js-dbg-32-48e43edc8834-linux
// Flags: -j -m -a
//
var g = newGlobal('new-compartment');
var dbg = Debugger(g);
dbg.onDebuggerStatement = function (stack) { return {return: 1234}; };
g.eval("function f() { debugger; return 'bad'; }");
assertEq(new g.f(), 1234);

View File

@ -0,0 +1,14 @@
// |jit-test| slow;
// Binary: cache/js-dbg-32-1463dc6308a8-linux
// Flags:
//
var fe="vv";
for (i=0; i<24; i++)
fe += fe;
var fu=new Function(
fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe,
fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe, fe,
"done"
);

View File

@ -0,0 +1,18 @@
// Binary: cache/js-dbg-64-acf3c1fb7c94-linux
// Flags:
//
genexp = "x * x for (x in [])";
genexpParened = "(" + genexp + ")";
needParens(2, "if (1, xx) { }");
function needParens(section, pat, exp) {
ft = pat.replace(/xx/, genexpParened);
try {
f = new Function(ft);
} catch(e) { }
overParenTest(section, f, exp);
}
function overParenTest(section, f, exp) {
var uf = "" + f;
if (uf.indexOf(genexpParened) != -1) { }
}

View File

@ -0,0 +1,20 @@
// |jit-test| error:ReferenceError
// Binary: cache/js-dbg-64-acf3c1fb7c94-linux
// Flags: --ion-eager
//
function k(f_arg) {
for (var i = 0; i < 10; ++i) {
f_arg( ) ;
}
}
function t() {
k(function (i) { actual ^ this | this; });
}
var ans = 0;
for (var j = 0; j < 10; ++j) {
for (var i = 0; i < 10; ++i) {
ans += t();
}
}

View File

@ -0,0 +1,16 @@
// Binary: cache/js-dbg-64-b01eb1ba58ce-linux
// Flags:
//
expect = 'Test skipped.';
function addPointImagedata(pointArray, n, col, row) {
pointArray[expect + 2] = 2;
}
function createMandelSet() {
points = new Array;
for (var idx = 0; idx < 1440000 ; ++idx) {
points[idx] = 0
}
addPointImagedata(points, ({}, {}), 0,0)
}
createMandelSet();

View File

@ -0,0 +1,12 @@
// Binary: cache/js-dbg-64-b01eb1ba58ce-linux
// Flags: -m -n
//
gczeal(2);
var g1 = newGlobal('same-compartment');
var proxyStr = "Proxy.create( "+
" { getOwnPropertyDescriptor: function() assertEq(true,false), "+
" fix: function() assertEq(true,false), }, "+
" Object.prototype "+
"); ";
var proxy1 = g1.eval(proxyStr);

View File

@ -0,0 +1,18 @@
// Binary: cache/js-dbg-64-1210706b4576-linux
// Flags:
//
this.__proto__ = null;
Object.prototype.__proto__ = this;
function exploreProperties(obj) {
var props = [];
for (var o = obj; o; o = Object.getPrototypeOf(o)) {
props = props.concat(Object.getOwnPropertyNames(o));
}
for (var i = 0; i < props.length; ++i) {
var p = props[i];
var v = obj[p];
}
}
var c = [{}];
exploreProperties(c);

View File

@ -0,0 +1,15 @@
// |jit-test| error:InternalError; slow;
// Binary: cache/js-dbg-64-c60535115ea1-linux
// Flags:
//
gczeal(2);
test();
function test() {
function t(o, proplist) {
var props=proplist.split(/\s+/g);
};
t({ bar: 123, baz: 123, quux: 123 }, 'bar baz quux');
( test(), this )(( "7.4.2-6-n" ) , actual, summary + ' : nonjit');
}

View File

@ -0,0 +1,8 @@
// |jit-test| error:ReferenceError
// Binary: cache/js-dbg-64-a335853be219-linux
// Flags:
//
gczeal(4);
jsTestDriverEnd();

View File

@ -0,0 +1,32 @@
// |jit-test| slow;
// Binary: cache/js-dbg-32-e5e66f40c35b-linux
// Flags:
//
gczeal(2);
function subset(list, size) {
if (size == 0 || !list.length)
return [list.slice(0, 0)];
var result = [];
for (var i = 0, n = list.length; i < n; i++) {
var pick = list.slice(i, i+1);
var rest = list.slice(0, i).concat(list.slice(i+1));
for each (var x in subset(rest, size-1))
result.push(pick.concat(x));
}
return result;
}
var bops = [
["=", "|=", "^=", "&=", "<<=", ">>=", ">>>=", "+=", "-=", "*=", "/=", "%="],
];
var aops = [];
for (var i = 0; i < bops.length; i++) {
for (var j = 0; j < bops[i].length; j++) {
var k = bops[i][j];
aops.push(k);
}
for (i = 2; i < 5; i++) {
var sets = subset(aops, i);
}
}

View File

@ -0,0 +1,15 @@
// Binary: cache/js-dbg-64-c34398f961e7-linux
// Flags: --ion-eager
//
var lfcode = new Array();
lfcode.push("gczeal(4);");
lfcode.push("");
while (true) {
var file = lfcode.shift();
if (file == undefined) { break; }
loadFile(file);
}
function loadFile(lfVarx) {
eval(lfVarx);
}

View File

@ -0,0 +1,42 @@
// Binary: cache/js-dbg-64-ca97bbcd6b90-linux
// Flags: --ion-eager
//
gczeal(4);
function TestCase(n, d, e, a) {}
TestCase.prototype.dump = function () {};
TestCase.prototype.testFailed = (function TestCase_testFailed() {
});
try {
try { } catch(ex1) { }
} catch(ex) { }
options.initvalues = {};
var optionNames = options().split(',');
var optionsframe = {};
try {
optionsClear();
} catch(ex) { }
var lfcode = new Array();
lfcode.push("\
try { } catch (exception) { }\
try { } catch (exception) { }\
try { } catch (exception) { }\
try { } catch (actual) { }\
var props = {};\
function test(which) {\
var g = newGlobal(\"new-compartment\");\
function addDebugger(g, i) {\
var dbg = Debugger(g);\
dbg.onDebuggerStatement = function (frame) { };\
}\
for (var i = 0; i < 3; i++) {\
addDebugger(g, i);\
}\
g.eval(\"debugger;\");\
}\
for (var j = 0; j < 3; j++) test(j);\
");
while (true) {
var file = lfcode.shift(); if (file == undefined) { break; }
try { evaluate(file); } catch (lfVare) { }
}

View File

@ -0,0 +1,15 @@
// |jit-test| error:InternalError
// Binary: cache/js-dbg-64-5a04fd69aa09-linux
// Flags: --ion-eager
//
var patterns = new Array();
patterns[0] = '';
test();
function test() {
for (i in patterns) {
s = patterns[i];
status =(test)(s);
}
}

View File

@ -0,0 +1,12 @@
// |jit-test| error:ReferenceError
// Binary: cache/js-opt-64-5a04fd69aa09-linux
// Flags: --ion-eager
//
function deep1(x) {
if (0) { }
else i : dumpStack();
}
for (var i = 0; 1; ++i)
deep1(i);

View File

@ -0,0 +1,10 @@
// |jit-test| error:SyntaxError
// Binary: cache/js-dbg-64-1fd6c40d3852-linux
// Flags: --ion-eager
//
var ary = ["\u001Cfoo", "\u001Dfoo", "\u001Efoo", "\u001Ffoo"];
for (var i in ary) {
ary[Number(i)].search("var MYVAR='077';++MYVAR")
}

View File

@ -0,0 +1,69 @@
// Binary: cache/js-dbg-64-1fd6c40d3852-linux
// Flags: --ion-eager
//
function TestCase(n, d, e, a) {}
var msPerDay = 86400000;
var msPerHour = 3600000;
var now = new Date();
var TIME_NOW = now.valueOf();
function DaysInYear( y ) {
if ( y % 4 != 0 ) {
return 365;
}
return 366;
}
function TimeInYear( y ) {
return ( DaysInYear(y) * msPerDay );
}
function TimeFromYear( y ) {
return ( msPerDay * DayFromYear(y) );
}
function DayFromYear( y ) {
return ( 365*(y-1970) +
Math.floor((y-1601)/400) );
}
function InLeapYear( t ) {
if ( DaysInYear(YearFromTime(t)) == 365 ) {
return 0;
}
if ( DaysInYear(YearFromTime(t)) == 366 ) {
}
}
function YearFromTime( t ) {
var sign = ( t < 0 ) ? -1 : 1;
var year = ( sign < 0 ) ? 1969 : 1970;
for ( var timeToTimeZero = t; ; ) {
timeToTimeZero -= sign * TimeInYear(year)
if ( sign < 0 ) {
} else {
if ( sign * timeToTimeZero < 0 ) {
break;
} else {
year += sign;
}
}
}
return ( year );
}
function WeekDay( t ) {}
function LocalTZA() {}
function LocalTime( t ) {
var dst_start = GetDSTStart(t);
}
function GetFirstSundayInMonth( t, m ) {
var leap = InLeapYear(t);
}
function GetDSTStart( t ) {
return (GetFirstSundayInMonth(t, 2) + 7*msPerDay + 2*msPerHour - LocalTZA());
}
var SECTION = "15.9.5.12";
addTestCase( TIME_NOW );
function addTestCase( t ) {
var start = TimeFromYear(YearFromTime(t));
var stop = TimeFromYear(YearFromTime(t) + 1);
for (var d = start; d < stop; d += msPerDay) {
new TestCase( SECTION,
WeekDay((LocalTime(d))),
(__lookupGetter__) );
}
}

View File

@ -0,0 +1,19 @@
// Binary: cache/js-dbg-64-1fd6c40d3852-linux
// Flags: --ion-eager
//
var cnName = 'name';
var cnNameGetter = function() {this.nameGETS++; return this._name;};
obj = (new (function ( ) { } ) );
obj.__defineGetter__(cnName, cnNameGetter);
function lameFunc(x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (obj.name) + (y >> 16) + (lsw >> 16);
}
function runSomeTimes(func, iters) {
for (var i = 0; i < iters; ++i) {
result = func(42, 42);
}
}
for (var i = 0; i < 11000; ++i)
runSomeTimes(lameFunc, 1);

View File

@ -0,0 +1,30 @@
// Binary: cache/js-dbg-32-1fd6c40d3852-linux
// Flags: --ion-eager
//
function TestCase(n, d, e, a) {};
this.__proto__ = [];
var msPerDay = 86400000;
var TIME_1900 = -2208988800000;
function TimeFromYear( y ) {
return ( msPerDay * DayFromYear(y) );
}
function DayFromYear( y ) {
return ( 365*(y-1970) +
Math.floor((y-1601)/400) );
}
function YearFromTime( t ) {
var sign = ( t < 0 ) ? -1 : 1;
var year = ( sign < 0 ) ? 1969 : 1970;
return ( year );
}
var SECTION = "15.9.5.10";
addTestCase( TIME_1900 );
function addTestCase( t ) {
var start = TimeFromYear(YearFromTime(t));
var stop = TimeFromYear(YearFromTime(t) + 1);
for (var d = start; d < stop; d += msPerDay) {
new TestCase( SECTION,
(new Date( SECTION ? "Failed" : prototype += "'abc'.search(new RegExp('^'))") ).getDate() );
}
}

View File

@ -0,0 +1,12 @@
// |jit-test| error:ReferenceError
// Binary: cache/js-dbg-64-1fd6c40d3852-linux
// Flags: --ion-eager
//
j = 0;
out1:
for ((exception) = 0; ; j++)
if (j == 50)
break out1;
while (dbgeval("[]").proto ? g : 50) {}

View File

@ -0,0 +1,21 @@
// |jit-test| error:ReferenceError
// Binary: cache/js-dbg-64-b5b6e6aebb36-linux
// Flags: --ion-eager
//
function loopy(p0)
{
var r3 = p0;
var r4 = p0;
var r6 = p0;
var r7 = p0;
while (r2) {
while (r2) {
r5 = r6 & r1;
r3 = r4 & r3;
r2 = r7;
}
}
}
loopy(0);

View File

@ -0,0 +1,36 @@
// Binary: cache/js-dbg-32-e96d5b1f47b8-linux
// Flags: --ion-eager
//
function b(z) {
switch (z) {
default:
primarySandbox = newGlobal("new-compartment")
}
return function(f, code) {
try {
evalcx(code, primarySandbox)
} catch (e) {}
}
}
function a(code) {
gc();
f = Function(code)
c(f, code)
}
c = b()
a("\
f2 = (function() {\
a0 + o2.m;\
a2.shift()\
});\
a2 = new Array;\
Object.defineProperty(a2, 0, {\
get: f2\
});\
o2 = {};\
a0 = [];\
a2.shift();\
var x;\
")
a("a0 = x")
a("a2.shift()")

View File

@ -0,0 +1,142 @@
// |jit-test| slow;
// Binary: cache/js-dbg-32-be41973873db-linux
// Flags: --ion-eager
//
function MersenneTwister19937() {
N = 624;
var M = 397;
MATRIX_A = 567483615;
UPPER_MASK = 2147483648;
var LOWER_MASK = 767;
mt = Array();
function unsigned32(n1) {
return n1 < 0 ? (n1 ^ UPPER_MASK) + UPPER_MASK : n1;
}
function addition32(n1, n2) {
return unsigned32(n1 + n2 & 4294967295);
}
function multiplication32(n1, n2) {
sum = 0;
for (i = 0; i < 32; ++i) {
if (n1 >> i & 1) {
sum = addition32(sum, unsigned32(n2 << i));
}
}
return sum;
}
this.init_genrand = function() {
for (mti = 1; mti < N; mti++) {
mt[mti] = addition32(multiplication32(181433253, unsigned32(mt[mti - 1] ^ mt[mti - 1] >>> 30)), mti);
}
};
this.genrand_int32 = function() {
mag01 = Array(0, MATRIX_A);
if (mti > N) {
for (kk = 0; kk < N - M; kk++) {
y = unsigned32(mt[kk] & UPPER_MASK | mt[kk + 1] & LOWER_MASK);
}
for (; kk < N; kk++) {
mt[kk] = unsigned32(mt[kk + (M - N)] ^ y >>> 1 ^ mag01[y & 1]);
}
mti = 0;
}
y = mt[mti++];
return y;
};
}
(function() {
var fuzzMT = new MersenneTwister19937;
fuzzSeed = 4;
fuzzMT.init_genrand(fuzzSeed);
rnd = function(n) {
var x = fuzzMT.genrand_int32() * 2.2e-10;
return Math.floor(x * n);
};
}());
function rndElt(a) {
return a[rnd(a.length)];
}
varBinderFor = ["", "t", ""];
function forLoopHead(d, b, v, reps) {
var sInit = rndElt(varBinderFor) + v + "=0";
var sCond = v + "<" + reps;
sNext = "++" + v;
return "for(" + sInit + ";" + sCond + ";" + sNext + ")";
}
function makeBranchUnstableLoop(d, b) {
var reps = rnd(rnd(9));
v = uniqueVarName();
var mod = rnd();
target = rnd(mod);
return "" + forLoopHead(d, b, v, reps) + "{" + "if(" + v + "%" + mod + "==" + target + "){" + makeStatement(d - 2, b) + "}" + "{" + makeStatement(d - 2) + "}" + "}";
}
function weighted(wa) {
a = [];
for (var i = 0; i < wa.length; ++i) {
for (var j = 0; j < wa[i].w; ++j) {
a.push(wa[i].fun);
}
}
return a;
}
statementMakers = weighted([{
w: 6,
fun: makeBranchUnstableLoop
}, {}]);
(function() {
builderStatementMakers = weighted([{
w: 1,
fun: function() {
return "gc()";
}
}, {
w: 10,
fun: function() {}
}]);
makeBuilderStatement = function() {
return rndElt(builderStatementMakers)();
};
}());
function uniqueVarName() {
for (i = 0; i < 6; ++i) {
s = String.fromCharCode(97 + rnd(6));
}
return s;
}
function makeLittleStatement(d) {
rnd(0);
if (rnd) {
rndElt(littleStatementMakers)();
}
}
littleStatementMakers = [function() {}];
function testOne() {
var code = makeOv(10);
tryItOut(code);
}
function makeStatement(d, b) {
if (rnd(0)) {}
if (rnd(2)) {
return makeBuilderStatement();
}
d < 6 && rnd() == 0;
if (d < rnd(8)) {
return makeLittleStatement();
}
return rndElt(statementMakers)(d, b);
}
function makeOv(d, B) {
if (rnd() == 0) {}
return "" + makeStatement(d, [""]);
}
function tryItOut(code) {
try {
f = Function(code);
f();
} catch (r) {}
}
for (let aa = 0; aa < 9999; aa++) {
testOne();
}

View File

@ -0,0 +1,20 @@
// Binary: cache/js-dbg-64-940078281bbf-linux
// Flags: --ion-eager
//
function List(l) {
this.l = l;
}
function f(p) {
return g(p.l);
};
function g(p) {
return !(p instanceof List) ? null : f(p.l);
};
list =
new List(new List(
new List(new List(
new List(new List(
new List(new List(null))))))))
for (let i = 0; i < 99999; i++) {
g(list);
}

View File

@ -0,0 +1,14 @@
// |jit-test| error:InternalError
// Binary: cache/js-dbg-32-92fe907ddac8-linux
// Flags: -m -n
//
mjitChunkLimit(31)
o = {}
o.valueOf = function() {
for (var p in undefined) {
a = new Function;
}
+o;
};
+o;

View File

@ -0,0 +1,9 @@
// Binary: cache/js-dbg-32-e96d5b1f47b8-linux
// Flags: --ion-eager
//
var a = new Array(1000 * 100);
var i = a.length;
while (i-- != 0) {}
gc();
(({ }).break--);

View File

@ -0,0 +1,51 @@
// Binary: cache/js-dbg-64-a9a18824b4c1-linux
// Flags: --ion-eager
//
{
try
{
try
{
}
catch(ex1)
{
}
}
catch(ex)
{
}
}
function optionsClear() {
var optionNames = options().split(',');
for (var i = 0; i < optionNames.length; i++)
{
var optionName = optionNames[i];
if (optionName &&
optionName != "methodjit_always")
{
options(optionName);
}
}
}
{
optionsClear();
{
}
}
function test() {
for ( gTc=0; gTc < gTestcases.length; gTc++ ) {
try
{
}
catch(e)
{
}
}
}
try {
var g = newGlobal('new-compartment');
g.eval("(" + function () {
dbg = new Debugger(debuggeeGlobal);
} + ")();");
} catch(exc0) {}

Some files were not shown because too many files have changed in this diff Show More