Merge m-c to s-c.

This commit is contained in:
Richard Newman 2013-02-06 19:26:09 -08:00
commit 8dd69fba34
312 changed files with 4696 additions and 2039 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

@ -330,9 +330,6 @@ pref("browser.download.manager.resumeOnWakeDelay", 10000);
// This allows disabling the Downloads Panel in favor of the old interface.
pref("browser.download.useToolkitUI", false);
// This controls retention behavior in the Downloads Panel only.
pref("browser.download.panel.removeFinishedDownloads", false);
// This records whether or not the panel has been shown at least once.
pref("browser.download.panel.shown", false);

View File

@ -1080,7 +1080,6 @@ var PlacesStarButton = {
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onBeforeItemRemoved: function () {},
onItemVisited: function () {},
onItemMoved: function () {}
};

View File

@ -209,7 +209,7 @@ var gPluginHandler = {
this._handleClickToPlayEvent(plugin);
let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox");
let pluginName = this._getPluginInfo(plugin).pluginName;
let messageString = gNavigatorBundle.getFormattedString("PluginClickToPlay", [pluginName]);
let messageString = gNavigatorBundle.getFormattedString("PluginClickToActivate", [pluginName]);
let overlayText = doc.getAnonymousElementByAttribute(plugin, "class", "msg msgClickToPlay");
overlayText.textContent = messageString;
if (eventType == "PluginVulnerableUpdatable" ||
@ -452,7 +452,7 @@ var gPluginHandler = {
overlay.addEventListener("click", function(aEvent) {
// Have to check that the target is not the link to update the plugin
if (!(aEvent.originalTarget instanceof HTMLAnchorElement) &&
!(aEvent.originalTarget instanceof HTMLButtonElement) &&
(aEvent.originalTarget.getAttribute('anonid') != 'closeIcon') &&
aEvent.button == 0 && aEvent.isTrusted) {
gPluginHandler.activateSinglePlugin(aEvent.target.ownerDocument.defaultView.top, aPlugin);
aEvent.stopPropagation();

View File

@ -159,8 +159,14 @@ let gBrowserThumbnails = {
if (httpChannel) {
// Continue only if we have a 2xx status code.
if (Math.floor(httpChannel.responseStatus / 100) != 2)
try {
if (Math.floor(httpChannel.responseStatus / 100) != 2)
return false;
} catch (e) {
// Can't get response information from the httpChannel
// because mResponseHead is not available.
return false;
}
// Cache-Control: no-store.
if (httpChannel.isNoStoreResponse())

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

@ -1240,7 +1240,6 @@ DownloadsPlacesView.prototype = {
nodeKeywordChanged: function() {},
nodeDateAddedChanged: function() {},
nodeLastModifiedChanged: function() {},
nodeReplaced: function() {},
nodeHistoryDetailsChanged: function() {},
nodeTagsChanged: function() {},
sortingChanged: function() {},

View File

@ -113,7 +113,6 @@
<image class="downloadTypeIcon" />
<vbox>
<description id="downloadsSummaryDescription"
class="downloadTarget"
style="min-width: &downloadsSummary.minWidth2;"/>
<progressmeter id="downloadsSummaryProgress"
class="downloadProgress"
@ -121,7 +120,6 @@
max="100"
mode="normal" />
<description id="downloadsSummaryDetails"
class="downloadDetails"
style="width: &downloadDetails.width;"
crop="end"/>
</vbox>

View File

@ -123,16 +123,10 @@ DownloadsStartup.prototype = {
break;
case "download-manager-change-retention":
// When the panel interface is enabled, we use a different preference to
// determine whether downloads should be removed from view as soon as
// they are finished. We do this to allow proper migration to the new
// feature when using the same profile on multiple versions of the
// product (bug 697678).
// If we're using the Downloads Panel, we override the retention
// preference to always retain downloads on completion.
if (!DownloadsCommon.useToolkitUI) {
let removeFinishedDownloads = Services.prefs.getBoolPref(
"browser.download.panel.removeFinishedDownloads");
aSubject.QueryInterface(Ci.nsISupportsPRInt32)
.data = removeFinishedDownloads ? 0 : 2;
aSubject.QueryInterface(Ci.nsISupportsPRInt32).data = 2;
}
break;

View File

@ -35,7 +35,6 @@ function run_test() {
},
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onBeforeItemRemoved: function () {},
onItemRemoved: function () {},
onItemChanged: function () {},
onItemVisited: function () {},

View File

@ -546,26 +546,6 @@ PlacesViewBase.prototype = {
}
},
nodeReplaced:
function PVB_nodeReplaced(aParentPlacesNode, aOldPlacesNode, aNewPlacesNode, aIndex) {
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
if (parentElt._built) {
let elt = this._getDOMNodeForPlacesNode(aOldPlacesNode);
// Here we need the <menu>.
if (elt.localName == "menupopup")
elt = elt.parentNode;
parentElt.removeChild(elt);
// No worries: If elt is the last item (i.e. no nextSibling),
// _insertNewItem/_insertNewItemToPopup will insert the new element as
// the last item.
let nextElt = elt.nextSibling;
this._insertNewItemToPopup(aNewPlacesNode, parentElt, nextElt);
}
},
nodeHistoryDetailsChanged:
function PVB_nodeHistoryDetailsChanged(aPlacesNode, aTime, aCount) {
if (aPlacesNode.parent &&
@ -1281,31 +1261,6 @@ PlacesToolbar.prototype = {
}
},
nodeReplaced:
function PT_nodeReplaced(aParentPlacesNode,
aOldPlacesNode, aNewPlacesNode, aIndex) {
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
if (parentElt == this._rootElt) {
let elt = this._getDOMNodeForPlacesNode(aOldPlacesNode);
// Here we need the <menu>.
if (elt.localName == "menupopup")
elt = elt.parentNode;
this._removeChild(elt);
// No worries: If elt is the last item (i.e. no nextSibling),
// _insertNewItem/_insertNewItemToPopup will insert the new element as
// the last item.
let next = elt.nextSibling;
this._insertNewItem(aNewPlacesNode, next);
this.updateChevron();
return;
}
PlacesViewBase.prototype.nodeReplaced.apply(this, arguments);
},
invalidateContainer: function PT_invalidateContainer(aPlacesNode) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
if (elt == this._rootElt) {

View File

@ -1026,6 +1026,5 @@ var gEditItemOverlay = {
onItemRemoved: function() { },
onBeginUpdateBatch: function() { },
onEndUpdateBatch: function() { },
onBeforeItemRemoved: function() { },
onItemVisited: function() { },
};

View File

@ -763,24 +763,6 @@ PlacesTreeView.prototype = {
}
},
/**
* Be careful, the parameter 'aIndex' here specifies the node's index in the
* parent node, not the visible index.
*/
nodeReplaced:
function PTV_nodeReplaced(aParentNode, aOldNode, aNewNode, aIndexDoNotUse) {
NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result)
return;
// Nothing to do if the replaced node was not set.
let row = this._getRowForNode(aOldNode);
if (row != -1) {
this._rows[row] = aNewNode;
this._tree.invalidateRow(row);
}
},
_invalidateCellValue: function PTV__invalidateCellValue(aNode,
aColumnType) {
NS_ASSERT(this._result, "Got a notification but have no result!");

View File

@ -220,7 +220,6 @@ var bookmarksObserver = {
onBeginUpdateBatch: function PSB_onBeginUpdateBatch() {},
onEndUpdateBatch: function PSB_onEndUpdateBatch() {},
onBeforeItemRemoved: function PSB_onBeforeItemRemoved(aItemId) {},
onItemVisited: function() {},
onItemChanged: function PSB_onItemChanged(aItemId, aProperty,
aIsAnnotationProperty, aNewValue) {

View File

@ -237,7 +237,6 @@ var bookmarksObserver = {
onBeginUpdateBatch: function PSB_onBeginUpdateBatch() {},
onEndUpdateBatch: function PSB_onEndUpdateBatch() {},
onBeforeItemRemoved: function PSB_onBeforeItemRemoved(aItemId) {},
onItemVisited: function() {},
onItemChanged: function PSB_onItemChanged(aItemId, aProperty,

View File

@ -28,8 +28,6 @@ function waitForBookmarkNotification(aNotification, aCallback, aProperty)
url: aURI ? aURI.spec : null,
title: aTitle });
},
onBeforeItemRemoved: function onBeforeItemRemoved()
this.validate(arguments.callee.name, arguments),
onItemRemoved: function onItemRemoved()
this.validate(arguments.callee.name, arguments),
onItemChanged: function onItemChanged(aItemId, aProperty, aIsAnno,

View File

@ -27,7 +27,6 @@ let bookmarksObserver = {
continue_test();
},
onItemAdded: function() {},
onBeforeItemRemoved: function(id) {},
onItemRemoved: function(id, folder, index, itemType) {},
onItemChanged: function() {},
onItemVisited: function(id, visitID, time) {},

View File

@ -27,7 +27,6 @@ let bookmarksObserver = {
continue_test();
},
onItemAdded: function() {},
onBeforeItemRemoved: function(id) {},
onItemRemoved: function(id, folder, index, itemType) {},
onItemChanged: function() {},
onItemVisited: function(id, visitID, time) {},

View File

@ -27,7 +27,6 @@ let bookmarksObserver = {
continue_test();
},
onItemAdded: function() {},
onBeforeItemRemoved: function(id) {},
onItemRemoved: function(id, folder, index, itemType) {},
onItemChanged: function() {},
onItemVisited: function(id, visitID, time) {},

View File

@ -52,7 +52,6 @@ function run_test() {
}
},
onItemAdded: function() {},
onBeforeItemRemoved: function(id) {},
onItemRemoved: function(id, folder, index, itemType) {},
onItemChanged: function() {},
onItemVisited: function(id, visitID, time) {},

View File

@ -27,7 +27,6 @@ let bookmarksObserver = {
continue_test();
},
onItemAdded: function() {},
onBeforeItemRemoved: function(id) {},
onItemRemoved: function(id, folder, index, itemType) {},
onItemChanged: function() {},
onItemVisited: function(id, visitID, time) {},

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

@ -46,7 +46,6 @@ function test() {
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onVisit: function () {},
onBeforeDeleteURI: function () {},
onDeleteURI: function () {},
onClearHistory: function () {},
onPageChanged: function () {},

View File

@ -63,7 +63,6 @@ function test() {
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onVisit: function () {},
onBeforeDeleteURI: function () {},
onDeleteURI: function () {},
onClearHistory: function () {},
onPageChanged: function () {},

View File

@ -513,7 +513,6 @@ let PageThumbsHistoryObserver = {
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onVisit: function () {},
onBeforeDeleteURI: function () {},
onPageChanged: function () {},
onDeleteVisits: function () {},

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

@ -304,7 +304,6 @@ function BookmarksObserver() {
BookmarksObserver.prototype = {
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onBeforeItemRemoved: function () {},
onItemVisited: function () {},
onItemAdded: function bo_onItemAdded(aId, aFolder, aIndex, aItemType, aURI) {
@ -485,7 +484,6 @@ Bookmark.prototype = {
onBeginUpdateBatch: function () {},
onEndUpdateBatch: function () {},
onItemAdded: function () {},
onBeforeItemRemoved: function () {},
onItemVisited: function () {},
onItemRemoved: function () {},
onItemChanged: function () {},
@ -659,7 +657,6 @@ BookmarkFolder.prototype = {
onBeginUpdateBatch: function () {},
onEndUpdateBatch : function () {},
onItemAdded : function () {},
onBeforeItemRemoved : function () {},
onItemRemoved : function () {},
onItemChanged : function () {},

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

@ -125,7 +125,7 @@ activatePluginsMessage.always.accesskey=c
activatePluginsMessage.never=Never activate plugins for this site
activatePluginsMessage.never.accesskey=N
activateSinglePlugin=Activate
PluginClickToPlay=Click here to activate the %S plugin.
PluginClickToActivate=Activate %S.
# LOCALIZATION NOTE - "vulnerable" indicates there is a security bug in the
# plugin that is being exploited by attackers.
PluginVulnerableUpdatable=This plugin is vulnerable and should be updated.

View File

@ -111,16 +111,23 @@ richlistitem[type="download"]:last-child {
font-size of .downloadContainer's parent, we use calc to go from the
smaller font-size back to the original font-size.
*/
#downloadsSummaryDetails,
.downloadContainer {
font-size: 90%;
}
#downloadsSummaryDescription,
.downloadTarget {
font-size: calc(100%/0.9);
margin-bottom: 7px;
cursor: inherit;
}
.downloadTarget {
font-size: calc(100%/0.9);
}
#downloadsSummaryDetails,
.downloadDetails {
margin-top: 1px;
opacity: 0.6;

View File

@ -4233,17 +4233,44 @@ panel[type="arrow"][popupid="click-to-play-plugins"] > .panel-arrowcontainer > .
}
}
@media (-moz-mac-lion-theme) {
#main-window[privatebrowsingmode=temporary] {
background-position: top right 40px;
}
#main-window[privatebrowsingmode=temporary] {
background-position: top right 40px;
}
#main-window[privatebrowsingmode=temporary]:-moz-locale-dir(rtl) {
background-position: top left 70px;
}
#main-window[privatebrowsingmode=temporary][inFullscreen] {
background-position: top right 10px;
}
#main-window[privatebrowsingmode=temporary]:-moz-locale-dir(rtl) {
background-position: top left 70px;
}
#main-window[privatebrowsingmode=temporary][inFullscreen]:-moz-locale-dir(rtl) {
background-position: top left 10px;
}
#main-window[privatebrowsingmode=temporary]:-moz-window-inactive {
background-color: -moz-mac-chrome-inactive;
}
#main-window[privatebrowsingmode=temporary][inFullscreen] #nav-bar[tabsontop=false] {
-moz-padding-end: 50px !important;
}
@media (-moz-mac-lion-theme) {
#main-window[privatebrowsingmode=temporary][inFullscreen] #TabsToolbar[tabsontop=true] {
-moz-padding-end: 50px;
}
}
@media not all and (-moz-mac-lion-theme) {
#main-window[privatebrowsingmode=temporary] {
background-position: top right 10px;
}
#main-window[privatebrowsingmode=temporary][inFullscreen][tabsontop=true] #window-controls {
-moz-padding-end: 50px;
}
}

View File

@ -133,16 +133,22 @@ richlistitem[type="download"]:last-child {
font-size of .downloadContainer's parent, we use calc to go from the
smaller font-size back to the original font-size.
*/
#downloadsSummaryDetails,
.downloadContainer {
font-size: 95%;
}
#downloadsSummaryDescription,
.downloadTarget {
font-size: calc(100%/0.95);
margin-bottom: 6px;
cursor: inherit;
}
.downloadTarget {
font-size: calc(100%/0.95);
}
#downloadsSummaryDetails,
.downloadDetails {
opacity: 0.7;
cursor: inherit;

View File

@ -123,16 +123,22 @@ richlistitem[type="download"]:first-child {
font-size of .downloadContainer's parent, we use calc to go from the
smaller font-size back to the original font-size.
*/
#downloadsSummaryDetails,
.downloadContainer {
font-size: 90%;
}
#downloadsSummaryDescription,
.downloadTarget {
font-size: calc(100%/0.9);
margin-bottom: 6px;
cursor: inherit;
}
.downloadTarget {
font-size: calc(100%/0.9);
}
#downloadsSummaryDetails,
.downloadDetails {
opacity: 0.6;
cursor: inherit;

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

@ -61,7 +61,7 @@ interface nsIDOMBlob : nsISupports
[notxpcom] FileInfo getFileInfo(in FileManager aFileManager);
};
[scriptable, builtinclass, uuid(cddf6087-0e83-4e1f-91b3-4861d5d4c53f)]
[scriptable, builtinclass, uuid(6928584d-7d87-4d56-9ce1-1c89c24f2c6a)]
interface nsIDOMFile : nsIDOMBlob
{
readonly attribute DOMString name;

View File

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

View File

@ -262,8 +262,7 @@ nsMixedContentBlocker::ShouldLoad(uint32_t aContentType,
// This content policy works as a whitelist.
default:
MOZ_NOT_REACHED("Mixed content of unknown type");
NS_WARNING("Mixed content of unknown type");
MOZ_ASSERT(false, "Mixed content of unknown type");
break;
}

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

@ -58,7 +58,6 @@ function test() {
onVisit: function(aURI, aVisitID, aTime, aSessionId, aReferringId,
aTransitionType, _added) {},
onTitleChanged: function(aURI, aPageTitle) {},
onBeforeDeleteURI: function(aURI) {},
onDeleteURI: function(aURI) {},
onClearHistory: function() {},
onPageChanged: function(aURI, aWhat, aValue) {

View File

@ -33,7 +33,6 @@ function test() {
finish();
}
},
onBeforeDeleteURI: function(aURI) {},
onDeleteURI: function(aURI) {},
onClearHistory: function() {},
onPageChanged: function(aURI, aWhat, aValue) {},

View File

@ -46,7 +46,6 @@ function test() {
onEndUpdateBatch: function() { },
onVisit: function() { },
onTitleChanged: function() { },
onBeforeDeleteURI: function() { },
onDeleteURI: function() { },
onClearHistory: function() { },
onDeleteVisits: function() { },

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

@ -365,10 +365,7 @@ GonkCameraHardware::PullParameters(uint32_t aHwHandle, CameraParameters& aParams
int
GonkCameraHardware::StartPreview()
{
if (mWindow.get()) {
GonkNativeWindow* window = static_cast<GonkNativeWindow*>(mWindow.get());
window->abandon();
} else {
if (!mWindow.get()) {
mWindow = new GonkNativeWindow(this);
mHardware->setPreviewWindow(mWindow);
}

View File

@ -19,6 +19,7 @@
#include "base/basictypes.h"
#include "GonkCameraHwMgr.h"
#include "mozilla/layers/ShadowLayers.h"
#include "mozilla/layers/ShadowLayerUtilsGralloc.h"
#include "mozilla/layers/ImageBridgeChild.h"
#include "GonkNativeWindow.h"
@ -60,6 +61,7 @@ void GonkNativeWindow::abandon()
nsAutoTArray<SurfaceDescriptor, NUM_BUFFER_SLOTS> freeList;
{
Mutex::Autolock lock(mMutex);
mAbandoned = true;
freeAllBuffersLocked(freeList);
}
@ -86,6 +88,7 @@ void GonkNativeWindow::init()
mBufferCount = MIN_BUFFER_SLOTS;
mFrameCounter = 0;
mGeneration = 0;
mAbandoned =false;
}
@ -174,6 +177,23 @@ void GonkNativeWindow::releaseBufferFreeListUnlocked(nsTArray<SurfaceDescriptor>
CNW_LOGD("releaseBufferFreeListUnlocked: X");
}
void GonkNativeWindow::clearRenderingStateBuffersLocked()
{
++mGeneration;
for (int i = 0; i < NUM_BUFFER_SLOTS; ++i) {
if (mSlots[i].mGraphicBuffer != NULL) {
// Don't try to destroy the gralloc buffer if it is still in the
// video stream awaiting rendering.
if (mSlots[i].mBufferState == BufferSlot::RENDERING) {
mSlots[i].mGraphicBuffer = NULL;
mSlots[i].mBufferState = BufferSlot::FREE;
mSlots[i].mFrameNumber = 0;
}
}
}
}
int GonkNativeWindow::setBufferCount(int bufferCount)
{
CNW_LOGD("setBufferCount: count=%d", bufferCount);
@ -182,35 +202,34 @@ int GonkNativeWindow::setBufferCount(int bufferCount)
{
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("setBufferCount: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
if (bufferCount > NUM_BUFFER_SLOTS) {
CNW_LOGE("setBufferCount: bufferCount larger than slots available");
return BAD_VALUE;
}
// special-case, nothing to do
if (bufferCount == mBufferCount) {
return OK;
}
if (bufferCount < MIN_BUFFER_SLOTS) {
CNW_LOGE("setBufferCount: requested buffer count (%d) is less than "
"minimum (%d)", bufferCount, MIN_BUFFER_SLOTS);
return BAD_VALUE;
}
// Error out if the user has dequeued buffers or sent buffers to
// video stream
// Error out if the user has dequeued buffers.
for (int i=0 ; i<mBufferCount ; i++) {
if (mSlots[i].mBufferState == BufferSlot::DEQUEUED ||
mSlots[i].mBufferState == BufferSlot::RENDERING) {
if (mSlots[i].mBufferState == BufferSlot::DEQUEUED) {
CNW_LOGE("setBufferCount: client owns some buffers");
return -EINVAL;
}
}
if (bufferCount > mBufferCount) {
// easy, we just have more buffers
if (bufferCount >= mBufferCount) {
mBufferCount = bufferCount;
//clear only buffers in RENDERING state.
clearRenderingStateBuffersLocked();
mDequeueCondition.signal();
return OK;
}
@ -236,6 +255,7 @@ int GonkNativeWindow::dequeueBuffer(android_native_buffer_t** buffer)
uint32_t generation;
bool alloc = false;
int buf = INVALID_BUFFER_SLOT;
SurfaceDescriptor descOld;
{
Mutex::Autolock lock(mMutex);
@ -247,6 +267,10 @@ int GonkNativeWindow::dequeueBuffer(android_native_buffer_t** buffer)
CNW_LOGD("dequeueBuffer: E");
while (tryAgain) {
if (mAbandoned) {
CNW_LOGE("dequeueBuffer: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
// look for a free buffer to give to the client
found = INVALID_BUFFER_SLOT;
dequeuedCount = 0;
@ -291,6 +315,15 @@ int GonkNativeWindow::dequeueBuffer(android_native_buffer_t** buffer)
const sp<GraphicBuffer>& gbuf(mSlots[buf].mGraphicBuffer);
alloc = (gbuf == NULL);
if ((gbuf!=NULL) &&
((uint32_t(gbuf->width) != mDefaultWidth) ||
(uint32_t(gbuf->height) != mDefaultHeight) ||
(uint32_t(gbuf->format) != mPixelFormat) ||
((uint32_t(gbuf->usage) & mUsage) != mUsage))) {
alloc = true;
descOld = mSlots[buf].mSurfaceDescriptor;
}
if (alloc) {
// get local copies for graphics buffer allocations
defaultWidth = mDefaultWidth;
@ -353,6 +386,10 @@ int GonkNativeWindow::dequeueBuffer(android_native_buffer_t** buffer)
}
}
if (alloc && IsSurfaceDescriptorValid(descOld)) {
ibc->DeallocSurfaceDescriptorGralloc(descOld);
}
if (alloc && tooOld) {
ibc->DeallocSurfaceDescriptorGralloc(desc);
}
@ -395,6 +432,12 @@ int GonkNativeWindow::queueBuffer(ANativeWindowBuffer* buffer)
{
Mutex::Autolock lock(mMutex);
CNW_LOGD("queueBuffer: E");
if (mAbandoned) {
CNW_LOGE("queueBuffer: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
int buf = getSlotFromBufferLocked(buffer);
if (buf < 0 || buf >= mBufferCount) {
@ -438,6 +481,11 @@ GonkNativeWindow::getCurrentBuffer()
CNW_LOGD("GonkNativeWindow::getCurrentBuffer");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("getCurrentBuffer: GonkNativeWindow has been abandoned!");
return NULL;
}
int found = -1;
for (int i = 0; i < mBufferCount; i++) {
const int state = mSlots[i].mBufferState;
@ -468,6 +516,11 @@ GonkNativeWindow::returnBuffer(uint32_t aIndex, uint32_t aGeneration)
CNW_LOGD("GonkNativeWindow::returnBuffer: slot=%d (generation=%d)", aIndex, aGeneration);
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGD("returnBuffer: GonkNativeWindow has been abandoned!");
return false;
}
if (aGeneration != mGeneration) {
CNW_LOGD("returnBuffer: buffer is from generation %d (current is %d)",
aGeneration, mGeneration);
@ -493,12 +546,22 @@ int GonkNativeWindow::lockBuffer(ANativeWindowBuffer* buffer)
{
CNW_LOGD("GonkNativeWindow::lockBuffer");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("lockBuffer: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
return OK;
}
int GonkNativeWindow::cancelBuffer(ANativeWindowBuffer* buffer)
{
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGD("cancelBuffer: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
int buf = getSlotFromBufferLocked(buffer);
CNW_LOGD("cancelBuffer: slot=%d", buf);
@ -554,6 +617,11 @@ int GonkNativeWindow::query(int what, int* outValue) const
{
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("query: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
int value;
switch (what) {
case NATIVE_WINDOW_WIDTH:
@ -627,6 +695,11 @@ int GonkNativeWindow::setUsage(uint32_t reqUsage)
{
CNW_LOGD("GonkNativeWindow::setUsage");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("setUsage: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
mUsage = reqUsage;
return OK;
}
@ -636,6 +709,11 @@ int GonkNativeWindow::setBuffersDimensions(int w, int h)
CNW_LOGD("GonkNativeWindow::setBuffersDimensions");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("setBuffersDimensions: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
if (w<0 || h<0)
return BAD_VALUE;
@ -653,6 +731,11 @@ int GonkNativeWindow::setBuffersFormat(int format)
CNW_LOGD("GonkNativeWindow::setBuffersFormat");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("setBuffersFormat: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
if (format<0)
return BAD_VALUE;
@ -665,6 +748,12 @@ int GonkNativeWindow::setBuffersTimestamp(int64_t timestamp)
{
CNW_LOGD("GonkNativeWindow::setBuffersTimestamp");
Mutex::Autolock lock(mMutex);
if (mAbandoned) {
CNW_LOGE("setBuffersTimestamp: GonkNativeWindow has been abandoned!");
return NO_INIT;
}
mTimestamp = timestamp;
return OK;
}

View File

@ -108,6 +108,12 @@ protected:
// this must be called with mMutex unlocked.
void releaseBufferFreeListUnlocked(nsTArray<SurfaceDescriptor>& freeList);
// clearRenderingStateBuffersLocked clear the resources in RENDERING state;
// But do not destroy the gralloc buffer. It is still in the video stream
// awaiting rendering.
// this must be called with mMutex locked.
void clearRenderingStateBuffersLocked();
private:
void init();
@ -196,6 +202,13 @@ private:
// mDequeueCondition condition used for dequeueBuffer in synchronous mode
mutable Condition mDequeueCondition;
// mAbandoned indicates that the GonkNativeWindow will no longer be used to
// consume buffers pushed to it.
// It is initialized to false, and set to true in the abandon method. A
// GonkNativeWindow that has been abandoned will return the NO_INIT error
// from all control methods capable of returning an error.
bool mAbandoned;
// mTimestamp is the timestamp that will be used for the next buffer queue
// operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that
// a timestamp is auto-generated when queueBuffer is called.

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

@ -142,7 +142,6 @@ TabChild::PreloadSlowThings()
NS_LITERAL_STRING("chrome://global/content/preload.js"));
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(tab->mWebNav);
nsCOMPtr<nsIPresShell> presShell;
if (nsIPresShell* presShell = docShell->GetPresShell()) {
// Initialize and do an initial reflow of the about:blank
// PresShell to let it preload some things for us.

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);

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