mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Merge mozilla-central into build-system
This commit is contained in:
commit
426ac0cdd3
@ -21,12 +21,12 @@ exports.testStringBundle = function(test) {
|
||||
getService(Ci.nsIStringBundleService).
|
||||
createBundle(url, appLocale);
|
||||
|
||||
let (name = "Yes") {
|
||||
let (name = "CheckMessage") {
|
||||
test.assertEqual(strings.get(name), stringBundle.GetStringFromName(name),
|
||||
"getting a string returns the string");
|
||||
}
|
||||
|
||||
let (name = "ExtensionCapability", args = ["foo"]) {
|
||||
let (name = "CreateWrapperDenied", args = ["foo"]) {
|
||||
test.assertEqual(strings.get(name, args),
|
||||
stringBundle.formatStringFromName(name, args, args.length),
|
||||
"getting a formatted string returns the formatted string");
|
||||
|
@ -25,8 +25,9 @@ tabbrowser {
|
||||
visibility: collapse;
|
||||
}
|
||||
|
||||
#tabbrowser-tabs:not([overflow="true"])[using-closing-tabs-spacer] ~ #alltabs-button {
|
||||
visibility: hidden; /* temporary space to keep a tab's close button under the cursor */
|
||||
#tabbrowser-tabs[overflow=true] > .tabbrowser-arrowscrollbox > .scrollbutton-up[collapsed=true],
|
||||
#tabbrowser-tabs[overflow=true] > .tabbrowser-arrowscrollbox > .scrollbutton-down[collapsed=true] {
|
||||
visibility: visible; /* keep a tab's close button under the cursor while it's closing tabs */
|
||||
}
|
||||
|
||||
.tabbrowser-tab {
|
||||
|
@ -814,21 +814,21 @@ function saveMedia()
|
||||
internalSave(aURIString, null, null, null, null, false, "SaveImageTitle",
|
||||
aChosenData, aBaseURI, gDocument);
|
||||
};
|
||||
|
||||
|
||||
for (var i = 0; i < rowArray.length; i++) {
|
||||
var v = rowArray[i];
|
||||
var dir = aDirectory.clone();
|
||||
var item = gImageView.data[v][COL_IMAGE_NODE];
|
||||
var uriString = gImageView.data[v][COL_IMAGE_ADDRESS];
|
||||
var uri = makeURI(uriString);
|
||||
|
||||
|
||||
try {
|
||||
uri.QueryInterface(Components.interfaces.nsIURL);
|
||||
dir.append(decodeURIComponent(uri.fileName));
|
||||
} catch(ex) {
|
||||
/* data: uris */
|
||||
}
|
||||
|
||||
|
||||
if (i == 0) {
|
||||
saveAnImage(uriString, new AutoChosen(dir, uri), makeURI(item.baseURI));
|
||||
} else {
|
||||
@ -938,7 +938,7 @@ function makePreview(row)
|
||||
numFrames = image.numFrames;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!mimeType)
|
||||
mimeType = getContentTypeFromHeaders(cacheEntry);
|
||||
|
||||
@ -985,7 +985,7 @@ function makePreview(row)
|
||||
if ((item instanceof HTMLLinkElement || item instanceof HTMLInputElement ||
|
||||
item instanceof HTMLImageElement ||
|
||||
item instanceof SVGImageElement ||
|
||||
(item instanceof HTMLObjectElement && mimeType.startsWith("image/")) || isBG) && isProtocolAllowed) {
|
||||
(item instanceof HTMLObjectElement && mimeType && mimeType.startsWith("image/")) || isBG) && isProtocolAllowed) {
|
||||
newImage.setAttribute("src", url);
|
||||
physWidth = newImage.width || 0;
|
||||
physHeight = newImage.height || 0;
|
||||
|
@ -2846,17 +2846,13 @@
|
||||
|
||||
var tabs = document.getBindingParent(this);
|
||||
|
||||
if (tabs.hasAttribute("dontresize") || tabs.hasAttribute("using-closing-tabs-spacer")) {
|
||||
tabs.mTabstrip._scrollButtonUp.style.visibility = "hidden";
|
||||
tabs.mTabstrip._scrollButtonDown.style.visibility = "hidden";
|
||||
} else {
|
||||
tabs.removeAttribute("overflow");
|
||||
}
|
||||
|
||||
tabs.tabbrowser._removingTabs.forEach(tabs.tabbrowser.removeTab,
|
||||
tabs.tabbrowser);
|
||||
|
||||
tabs._positionPinnedTabs();
|
||||
if (!tabs.hasAttribute("dontresize") && !tabs._closingTabsSpacer.style.minWidth) {
|
||||
tabs.removeAttribute("overflow");
|
||||
tabs._positionPinnedTabs();
|
||||
}
|
||||
]]></handler>
|
||||
<handler event="overflow"><![CDATA[
|
||||
if (event.detail == 0)
|
||||
@ -3112,16 +3108,19 @@
|
||||
if (!tabs.length)
|
||||
return;
|
||||
|
||||
var isEndTab = (aTab._tPos > tabs[tabs.length-1]._tPos);
|
||||
var tabWidth = aTab.getBoundingClientRect().width;
|
||||
this.tabbrowser.addEventListener("mousemove", this, false);
|
||||
window.addEventListener("mouseout", this, false);
|
||||
|
||||
// Locking is neither in effect nor needed, so let tabs expand normally.
|
||||
if (isEndTab && !this.hasAttribute("dontresize"))
|
||||
return;
|
||||
|
||||
// Let spacer grow to the maximum and lock it, then let tabs expand normally
|
||||
let isEndTab = (aTab._tPos > tabs[tabs.length-1]._tPos);
|
||||
if (isEndTab) {
|
||||
let spacer = this._closingTabsSpacer;
|
||||
if (!spacer.style.minWidth)
|
||||
spacer.style.minWidth = 0;
|
||||
|
||||
// Locking is neither in effect nor needed, so let tabs expand normally
|
||||
if (!this.hasAttribute("dontresize"))
|
||||
return;
|
||||
|
||||
spacer.style.MozBoxFlex = 1;
|
||||
spacer.style.minWidth = getComputedStyle(spacer).width;
|
||||
spacer.style.MozBoxFlex = "";
|
||||
@ -3134,6 +3133,7 @@
|
||||
}
|
||||
|
||||
if (!this.hasAttribute("dontresize")) {
|
||||
let tabWidth = aTab.getBoundingClientRect().width;
|
||||
this._delayResizingRule.style.setProperty("max-width", tabWidth + "px", "important");
|
||||
this.setAttribute("dontanimate", "true");
|
||||
this.setAttribute("dontresize", "true");
|
||||
@ -3144,21 +3144,16 @@
|
||||
if (!this.mTabstrip._scrollButtonUp.disabled) {
|
||||
let spacer = this._closingTabsSpacer;
|
||||
let width = parseFloat(spacer.style.minWidth) || 0;
|
||||
width += tabWidth;
|
||||
width += aTab.getBoundingClientRect().width;
|
||||
|
||||
if (!this.mTabstrip._scrollButtonDown.disabled) {
|
||||
let scrollbox = this.mTabstrip._scrollbox;
|
||||
width -= scrollbox.scrollLeftMax - scrollbox.scrollLeft;
|
||||
}
|
||||
|
||||
if (width >= 0) {
|
||||
if (width >= 0)
|
||||
spacer.style.minWidth = width + "px";
|
||||
this.setAttribute("using-closing-tabs-spacer", "true");
|
||||
}
|
||||
}
|
||||
|
||||
this.tabbrowser.addEventListener("mousemove", this, false);
|
||||
window.addEventListener("mouseout", this, false);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
@ -3168,13 +3163,12 @@
|
||||
window.removeEventListener("mouseout", this, false);
|
||||
|
||||
this._closingTabsSpacer.style.minWidth = "";
|
||||
this.removeAttribute("using-closing-tabs-spacer");
|
||||
this.removeAttribute("dontresize");
|
||||
|
||||
if (this.hasAttribute("overflow") && this.mTabstrip._scrollbox.scrollWidth <= this.mTabstrip._scrollbox.clientWidth) {
|
||||
this.mTabstrip._scrollButtonUp.style.visibility = "";
|
||||
this.mTabstrip._scrollButtonDown.style.visibility = "";
|
||||
if (this.hasAttribute("overflow") &&
|
||||
this.mTabstrip._scrollbox.scrollWidth <= this.mTabstrip._scrollbox.clientWidth) {
|
||||
this.removeAttribute("overflow");
|
||||
this._positionPinnedTabs();
|
||||
}
|
||||
]]></body>
|
||||
</method>
|
||||
|
@ -46,7 +46,6 @@ _BROWSER_FILES = \
|
||||
browser_tabview_bug599626.js \
|
||||
browser_tabview_bug600645.js \
|
||||
browser_tabview_bug600812.js \
|
||||
browser_tabview_bug602432.js \
|
||||
browser_tabview_bug604098.js \
|
||||
browser_tabview_bug606657.js \
|
||||
browser_tabview_bug606905.js \
|
||||
@ -57,7 +56,6 @@ _BROWSER_FILES = \
|
||||
browser_tabview_bug608184.js \
|
||||
browser_tabview_bug608405.js \
|
||||
browser_tabview_bug610208.js \
|
||||
browser_tabview_bug610242.js \
|
||||
browser_tabview_bug612470.js \
|
||||
browser_tabview_bug613541.js \
|
||||
browser_tabview_bug616729.js \
|
||||
@ -103,7 +101,6 @@ _BROWSER_FILES = \
|
||||
browser_tabview_bug642793.js \
|
||||
browser_tabview_bug643392.js \
|
||||
browser_tabview_bug644097.js \
|
||||
browser_tabview_bug648882.js \
|
||||
browser_tabview_bug649006.js \
|
||||
browser_tabview_bug649307.js \
|
||||
browser_tabview_bug649319.js \
|
||||
@ -112,7 +109,6 @@ _BROWSER_FILES = \
|
||||
browser_tabview_bug651311.js \
|
||||
browser_tabview_bug654295.js \
|
||||
browser_tabview_bug654721.js \
|
||||
browser_tabview_bug654941.js \
|
||||
browser_tabview_bug655269.js \
|
||||
browser_tabview_bug656778.js \
|
||||
browser_tabview_bug656913.js \
|
||||
@ -122,13 +118,10 @@ _BROWSER_FILES = \
|
||||
browser_tabview_bug665502.js \
|
||||
browser_tabview_bug669694.js \
|
||||
browser_tabview_bug673196.js \
|
||||
browser_tabview_bug673729.js \
|
||||
$(filter disabled-temporarily--bug-795265, browser_tabview_bug678374.js) \
|
||||
browser_tabview_bug681599.js \
|
||||
browser_tabview_bug685476.js \
|
||||
browser_tabview_bug685692.js \
|
||||
browser_tabview_bug686654.js \
|
||||
browser_tabview_bug696602.js \
|
||||
browser_tabview_bug697390.js \
|
||||
browser_tabview_bug705621.js \
|
||||
browser_tabview_bug706430.js \
|
||||
@ -167,6 +160,13 @@ _BROWSER_FILES = \
|
||||
|
||||
|
||||
# browser_tabview_bug597980.js is disabled for leaking, see bug 711907
|
||||
# browser_tabview_bug678374.js disabled for intermittent failures (bug 795265)
|
||||
# browser_tabview_bug602432.js disabled for intermittent failures (bug 704417)
|
||||
# browser_tabview_bug610242.js disabled for intermittent failures (bug 736036)
|
||||
# browser_tabview_bug648882.js disabled for intermittent failures (bug 752862)
|
||||
# browser_tabview_bug654941.js disabled for intermittent failures (bug 754222)
|
||||
# browser_tabview_bug673729.js disabled for intermittent failures (bug 749980)
|
||||
# browser_tabview_bug696602.js disabled for intermittent failures (bug 736425)
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
|
||||
|
@ -1025,7 +1025,7 @@ SourceScripts.prototype = {
|
||||
connect: function SS_connect() {
|
||||
dumpn("SourceScripts is connecting...");
|
||||
this.debuggerClient.addListener("newGlobal", this._onNewGlobal);
|
||||
this.activeThread.addListener("newSource", this._onNewSource);
|
||||
this.debuggerClient.addListener("newSource", this._onNewSource);
|
||||
this._handleTabNavigation();
|
||||
},
|
||||
|
||||
@ -1039,7 +1039,7 @@ SourceScripts.prototype = {
|
||||
dumpn("SourceScripts is disconnecting...");
|
||||
window.clearTimeout(this._newSourceTimeout);
|
||||
this.debuggerClient.removeListener("newGlobal", this._onNewGlobal);
|
||||
this.activeThread.removeListener("newSource", this._onNewSource);
|
||||
this.debuggerClient.removeListener("newSource", this._onNewSource);
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1110,7 +1110,7 @@ SourceScripts.prototype = {
|
||||
*/
|
||||
_onSourcesAdded: function SS__onSourcesAdded(aResponse) {
|
||||
if (aResponse.error) {
|
||||
Cu.reportError("Error getting sources: " + aResponse.error);
|
||||
Cu.reportError("Error getting sources: " + aResponse.message);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1175,8 +1175,8 @@ SourceScripts.prototype = {
|
||||
window.clearTimeout(fetchTimeout);
|
||||
|
||||
if (aResponse.error) {
|
||||
Cu.reportError("Error loading: " + aSource.url + "\n" + aResponse.error);
|
||||
return void aCallback(aSource.url, "");
|
||||
Cu.reportError("Error loading: " + aSource.url + "\n" + aResponse.message);
|
||||
return void aCallback(aSource.url, "", aResponse.error);
|
||||
}
|
||||
aSource.loaded = true;
|
||||
aSource.text = aResponse.source;
|
||||
|
@ -1706,7 +1706,11 @@ create({ constructor: GlobalSearchView, proto: MenuContainer.prototype }, {
|
||||
* @param string aContents
|
||||
* The text contents of the source.
|
||||
*/
|
||||
_onFetchSourceFinished: function DVGS__onFetchSourceFinished(aLocation, aContents) {
|
||||
_onFetchSourceFinished: function DVGS__onFetchSourceFinished(aLocation, aContents, aError) {
|
||||
if (aError) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remember the source in a cache so we don't have to fetch it again.
|
||||
this._cache.set(aLocation, aContents);
|
||||
|
||||
|
@ -484,7 +484,14 @@ function clickAndSwitch() {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendMouseEvent({ type: "click" }, gFilteredSources.visibleItems[0].target);
|
||||
|
||||
ok(gFilteredSources._container._parent.querySelectorAll(".dbg-source-item")[0]
|
||||
.classList.contains("dbg-source-item"),
|
||||
"The first visible item target isn't the correct one.");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gFilteredSources._container._parent.querySelector(".dbg-source-item"),
|
||||
gDebugger);
|
||||
}
|
||||
|
||||
function clickAndSwitchAgain() {
|
||||
@ -564,7 +571,14 @@ function clickAndSwitchAgain() {
|
||||
ok(false, "How did you get here?");
|
||||
}
|
||||
});
|
||||
EventUtils.sendMouseEvent({ type: "click" }, gFilteredSources.visibleItems[2].target);
|
||||
|
||||
ok(gFilteredSources._container._parent.querySelectorAll(".dbg-source-item")[2]
|
||||
.classList.contains("dbg-source-item"),
|
||||
"The first visible item target isn't the correct one.");
|
||||
|
||||
EventUtils.sendMouseEvent({ type: "click" },
|
||||
gFilteredSources._container._parent.querySelectorAll(".dbg-source-item")[2],
|
||||
gDebugger);
|
||||
}
|
||||
|
||||
function switchFocusWithEscape() {
|
||||
|
@ -154,6 +154,7 @@ function ResponsiveUI(aWindow, aTab)
|
||||
this.bound_addPreset = this.addPreset.bind(this);
|
||||
this.bound_removePreset = this.removePreset.bind(this);
|
||||
this.bound_rotate = this.rotate.bind(this);
|
||||
this.bound_close = this.close.bind(this);
|
||||
this.bound_startResizing = this.startResizing.bind(this);
|
||||
this.bound_stopResizing = this.stopResizing.bind(this);
|
||||
this.bound_onDrag = this.onDrag.bind(this);
|
||||
@ -183,7 +184,7 @@ function ResponsiveUI(aWindow, aTab)
|
||||
|
||||
ResponsiveUI.prototype = {
|
||||
_transitionsEnabled: true,
|
||||
_floatingScrollbars: false, // See bug 799471
|
||||
_floatingScrollbars: true,
|
||||
get transitionsEnabled() this._transitionsEnabled,
|
||||
set transitionsEnabled(aValue) {
|
||||
this._transitionsEnabled = aValue;
|
||||
@ -222,6 +223,7 @@ ResponsiveUI.prototype = {
|
||||
this.tab.removeEventListener("TabClose", this);
|
||||
this.tabContainer.removeEventListener("TabSelect", this);
|
||||
this.rotatebutton.removeEventListener("command", this.bound_rotate, true);
|
||||
this.closebutton.removeEventListener("command", this.bound_close, true);
|
||||
this.addbutton.removeEventListener("command", this.bound_addPreset, true);
|
||||
this.removebutton.removeEventListener("command", this.bound_removePreset, true);
|
||||
|
||||
@ -292,6 +294,7 @@ ResponsiveUI.prototype = {
|
||||
* <toolbar class="devtools-toolbar devtools-responsiveui-toolbar">
|
||||
* <menulist class="devtools-menulist"/> // presets
|
||||
* <toolbarbutton tabindex="0" class="devtools-toolbarbutton" label="rotate"/> // rotate
|
||||
* <toolbarbutton tabindex="0" class="devtools-toolbarbutton devtools-closebutton" tooltiptext="Leave Responsive Design View"/> // close
|
||||
* </toolbar>
|
||||
* <stack class="browserStack"> From tabbrowser.xml
|
||||
* <browser/>
|
||||
@ -334,6 +337,13 @@ ResponsiveUI.prototype = {
|
||||
this.rotatebutton.className = "devtools-toolbarbutton";
|
||||
this.rotatebutton.addEventListener("command", this.bound_rotate, true);
|
||||
|
||||
this.closebutton = this.chromeDoc.createElement("toolbarbutton");
|
||||
this.closebutton.setAttribute("tabindex", "0");
|
||||
this.closebutton.className = "devtools-toolbarbutton devtools-closebutton";
|
||||
this.closebutton.setAttribute("tooltiptext", this.strings.GetStringFromName("responsiveUI.close"));
|
||||
this.closebutton.addEventListener("command", this.bound_close, true);
|
||||
|
||||
this.toolbar.appendChild(this.closebutton);
|
||||
this.toolbar.appendChild(this.menulist);
|
||||
this.toolbar.appendChild(this.rotatebutton);
|
||||
|
||||
|
@ -35,6 +35,9 @@ responsiveUI.namedResolution=%S (%S)
|
||||
# the user to specify a name for a new custom preset.
|
||||
responsiveUI.customNamePromptTitle=Responsive Design View
|
||||
|
||||
# LOCALIZATION NOTE (responsiveUI.close): tooltip text of the close button.
|
||||
responsiveUI.close=Leave Responsive Design View
|
||||
|
||||
# LOCALIZATION NOTE (responsiveUI.customNamePromptMsg): prompt message when asking
|
||||
# the user to specify a name for a new custom preset.
|
||||
responsiveUI.customNamePromptMsg=Give a name to the %Sx%S preset
|
||||
|
@ -34,24 +34,46 @@ var ContextCommands = {
|
||||
|
||||
// Text specific
|
||||
|
||||
cut: function cc_cut() {
|
||||
let target = ContextMenuUI.popupState.target;
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (target.localName === "browser") {
|
||||
// content
|
||||
if (ContextMenuUI.popupState.string) {
|
||||
this.sendCommand("cut");
|
||||
|
||||
SelectionHelperUI.closeEditSessionAndClear();
|
||||
}
|
||||
} else {
|
||||
// chrome
|
||||
target.editor.cut();
|
||||
}
|
||||
|
||||
target.focus();
|
||||
},
|
||||
|
||||
copy: function cc_copy() {
|
||||
let target = ContextMenuUI.popupState.target;
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
if (target.localName == "browser") {
|
||||
// content
|
||||
if (ContextMenuUI.popupState.string != "undefined") {
|
||||
this.clipboard.copyString(ContextMenuUI.popupState.string,
|
||||
this.docRef);
|
||||
this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied"));
|
||||
if (ContextMenuUI.popupState.string) {
|
||||
this.sendCommand("copy");
|
||||
|
||||
SelectionHelperUI.closeEditSessionAndClear();
|
||||
}
|
||||
} else {
|
||||
// chrome
|
||||
target.editor.copy();
|
||||
this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied"));
|
||||
}
|
||||
|
||||
if (target)
|
||||
target.focus();
|
||||
target.focus();
|
||||
},
|
||||
|
||||
paste: function cc_paste() {
|
||||
@ -149,7 +171,6 @@ var ContextCommands = {
|
||||
copyLink: function cc_copyLink() {
|
||||
this.clipboard.copyString(ContextMenuUI.popupState.linkURL,
|
||||
this.docRef);
|
||||
this.showToast(Strings.browser.GetStringFromName("selectionHelper.linkCopied"));
|
||||
},
|
||||
|
||||
bookmarkLink: function cc_bookmarkLink() {
|
||||
@ -162,8 +183,6 @@ var ContextCommands = {
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.showToast(Strings.browser.GetStringFromName("alertLinkBookmarked"));
|
||||
},
|
||||
|
||||
// Image specific
|
||||
@ -180,7 +199,6 @@ var ContextCommands = {
|
||||
copyImageSrc: function cc_copyImageSrc() {
|
||||
this.clipboard.copyString(ContextMenuUI.popupState.mediaURL,
|
||||
this.docRef);
|
||||
this.showToast(Strings.browser.GetStringFromName("selectionHelper.linkCopied"));
|
||||
},
|
||||
|
||||
openImageInNewTab: function cc_openImageInNewTab() {
|
||||
@ -196,7 +214,6 @@ var ContextCommands = {
|
||||
copyVideoSrc: function cc_copyVideoSrc() {
|
||||
this.clipboard.copyString(ContextMenuUI.popupState.mediaURL,
|
||||
this.docRef);
|
||||
this.showToast(Strings.browser.GetStringFromName("selectionHelper.linkCopied"));
|
||||
},
|
||||
|
||||
openVideoInNewTab: function cc_openVideoInNewTab() {
|
||||
@ -269,12 +286,7 @@ var ContextCommands = {
|
||||
});
|
||||
},
|
||||
|
||||
showToast: function showToast(aString) {
|
||||
let toaster = Cc["@mozilla.org/toaster-alerts-service;1"].getService(Ci.nsIAlertsService);
|
||||
toaster.showAlertNotification(null, aString, "", false, "", null);
|
||||
},
|
||||
|
||||
sendCommand: function cc_playVideo(aCommand) {
|
||||
sendCommand: function sendCommand(aCommand) {
|
||||
// Send via message manager over to ContextMenuHandler
|
||||
let browser = ContextMenuUI.popupState.target;
|
||||
browser.messageManager.sendAsyncMessage("Browser:ContextCommand", { command: aCommand });
|
||||
|
@ -375,6 +375,7 @@
|
||||
|
||||
let json = { types: ["input-text"], string: "" };
|
||||
if (selectionStart != selectionEnd) {
|
||||
json.types.push("cut");
|
||||
json.types.push("copy");
|
||||
json.string = aTextbox.value.slice(selectionStart, selectionEnd);
|
||||
} else if (aTextbox.value) {
|
||||
|
@ -537,6 +537,8 @@ var BrowserUI = {
|
||||
break;
|
||||
case "metro_viewstate_changed":
|
||||
this._adjustDOMforViewState();
|
||||
if (aData == "snapped")
|
||||
FlyoutPanelsUI.hide();
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
@ -1233,7 +1233,7 @@ var PopupBlockerObserver = {
|
||||
case "mousedown":
|
||||
let box = Browser.getNotificationBox();
|
||||
let notification = box.getNotificationWithValue("popup-blocked");
|
||||
if (notification)
|
||||
if (notification && !notification.contains(aEvent.target))
|
||||
box.removeNotification(notification);
|
||||
break;
|
||||
}
|
||||
@ -1276,17 +1276,17 @@ var PopupBlockerObserver = {
|
||||
{
|
||||
isDefault: false,
|
||||
label: strings.GetStringFromName("popupButtonAllowOnce2"),
|
||||
accessKey: null,
|
||||
accessKey: "",
|
||||
callback: function() { PopupBlockerObserver.showPopupsForSite(); }
|
||||
},
|
||||
{
|
||||
label: strings.GetStringFromName("popupButtonAlwaysAllow3"),
|
||||
accessKey: null,
|
||||
accessKey: "",
|
||||
callback: function() { PopupBlockerObserver.allowPopupsForSite(true); }
|
||||
},
|
||||
{
|
||||
label: strings.GetStringFromName("popupButtonNeverWarn3"),
|
||||
accessKey: null,
|
||||
accessKey: "",
|
||||
callback: function() { PopupBlockerObserver.allowPopupsForSite(false); }
|
||||
}
|
||||
];
|
||||
|
@ -546,8 +546,12 @@
|
||||
<!-- ux spec: https://bug782810.bugzilla.mozilla.org/attachment.cgi?id=714804 -->
|
||||
|
||||
<!-- Text related -->
|
||||
<!-- for text inputs, this will copy selected text, or if no text is selected, copy all -->
|
||||
<richlistitem id="context-copy" type="copy,selectable" onclick="ContextCommands.copy();">
|
||||
<!-- for text inputs, this will cut selected text -->
|
||||
<richlistitem id="context-cut" type="cut" onclick="ContextCommands.cut();">
|
||||
<label value="&contextTextCut.label;"/>
|
||||
</richlistitem>
|
||||
<!-- for text inputs, this will copy selected text -->
|
||||
<richlistitem id="context-copy" type="copy" onclick="ContextCommands.copy();">
|
||||
<label value="&contextTextCopy.label;"/>
|
||||
</richlistitem>
|
||||
<!-- only displayed if there is text on the clipboard -->
|
||||
|
@ -8,6 +8,7 @@ dump("### ContextMenuHandler.js loaded\n");
|
||||
|
||||
var ContextMenuHandler = {
|
||||
_types: [],
|
||||
_previousState: null,
|
||||
|
||||
init: function ch_init() {
|
||||
// Events we catch from content during the bubbling phase
|
||||
@ -56,6 +57,18 @@ var ContextMenuHandler = {
|
||||
let command = aMessage.json.command;
|
||||
|
||||
switch (command) {
|
||||
case "cut":
|
||||
this._onCut();
|
||||
break;
|
||||
|
||||
case "copy":
|
||||
this._onCopy();
|
||||
break;
|
||||
|
||||
case "paste":
|
||||
this._onPaste();
|
||||
break;
|
||||
|
||||
case "play":
|
||||
case "pause":
|
||||
if (node instanceof Ci.nsIDOMHTMLMediaElement)
|
||||
@ -75,10 +88,6 @@ var ContextMenuHandler = {
|
||||
this._onSelectAll();
|
||||
break;
|
||||
|
||||
case "paste":
|
||||
this._onPaste();
|
||||
break;
|
||||
|
||||
case "copy-image-contents":
|
||||
this._onCopyImage();
|
||||
break;
|
||||
@ -88,7 +97,7 @@ var ContextMenuHandler = {
|
||||
/*
|
||||
* Handler for selection overlay context menu events.
|
||||
*/
|
||||
_onContextAtPoint: function _onContextCommand(aMessage) {
|
||||
_onContextAtPoint: function _onContextAtPoint(aMessage) {
|
||||
// we need to find popupNode as if the context menu were
|
||||
// invoked on underlying content.
|
||||
let { element, frameX, frameY } =
|
||||
@ -151,6 +160,35 @@ var ContextMenuHandler = {
|
||||
Util.copyImageToClipboard(this._target);
|
||||
},
|
||||
|
||||
_onCut: function _onCut() {
|
||||
if (this._isTextInput(this._target)) {
|
||||
let edit = this._target.QueryInterface(Ci.nsIDOMNSEditableElement);
|
||||
if (edit) {
|
||||
edit.editor.cut();
|
||||
} else {
|
||||
Util.dumpLn("error: target element does not support nsIDOMNSEditableElement");
|
||||
}
|
||||
}
|
||||
this.reset();
|
||||
},
|
||||
|
||||
_onCopy: function _onCopy() {
|
||||
if (this._isTextInput(this._target)) {
|
||||
let edit = this._target.QueryInterface(Ci.nsIDOMNSEditableElement);
|
||||
if (edit) {
|
||||
edit.editor.copy();
|
||||
} else {
|
||||
Util.dumpLn("error: target element does not support nsIDOMNSEditableElement");
|
||||
}
|
||||
} else {
|
||||
let selectionText = this._previousState.string;
|
||||
|
||||
Cc["@mozilla.org/widget/clipboardhelper;1"]
|
||||
.getService(Ci.nsIClipboardHelper).copyString(selectionText);
|
||||
}
|
||||
this.reset();
|
||||
},
|
||||
|
||||
/******************************************************
|
||||
* Utility routines
|
||||
*/
|
||||
@ -205,6 +243,9 @@ var ContextMenuHandler = {
|
||||
linkTitle: "",
|
||||
linkProtocol: null,
|
||||
mediaURL: "",
|
||||
contentType: "",
|
||||
contentDisposition: "",
|
||||
string: "",
|
||||
};
|
||||
|
||||
// Do checks for nodes that never have children.
|
||||
@ -266,6 +307,7 @@ var ContextMenuHandler = {
|
||||
// Don't include "copy" for password fields.
|
||||
if (!(elem instanceof Ci.nsIDOMHTMLInputElement) || elem.mozIsTextField(true)) {
|
||||
if (selectionStart != selectionEnd) {
|
||||
state.types.push("cut");
|
||||
state.types.push("copy");
|
||||
state.string = elem.value.slice(selectionStart, selectionEnd);
|
||||
}
|
||||
@ -334,6 +376,8 @@ var ContextMenuHandler = {
|
||||
if (this._types[i].handler(state, popupNode))
|
||||
state.types.push(this._types[i].name);
|
||||
|
||||
this._previousState = state;
|
||||
|
||||
sendAsyncMessage("Content:ContextMenu", state);
|
||||
},
|
||||
|
||||
|
@ -454,8 +454,11 @@ MenuPopup.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
if (aX < 0)
|
||||
if (aX < 0) {
|
||||
aX = 0;
|
||||
} else if (aX + width + kPositionPadding > screenWidth){
|
||||
aX = screenWidth - width - kPositionPadding;
|
||||
}
|
||||
|
||||
if (aY < 0 && aPositionOptions.moveBelowToFit) {
|
||||
// show context menu below when it doesn't fit.
|
||||
|
@ -502,9 +502,6 @@ var SelectionHelperUI = {
|
||||
},
|
||||
|
||||
_onSelectionCopied: function _onSelectionCopied(json) {
|
||||
if (json.succeeded) {
|
||||
this.showToast(Strings.browser.GetStringFromName("selectionHelper.textCopied"));
|
||||
}
|
||||
this.closeEditSessionAndClear();
|
||||
},
|
||||
|
||||
@ -687,11 +684,4 @@ var SelectionHelperUI = {
|
||||
json.change = aMarker.tag;
|
||||
this._sendAsyncMessage("Browser:SelectionMove", json);
|
||||
},
|
||||
|
||||
showToast: function showToast(aString) {
|
||||
let toaster =
|
||||
Cc["@mozilla.org/toaster-alerts-service;1"]
|
||||
.getService(Ci.nsIAlertsService);
|
||||
toaster.showAlertNotification(null, aString, "", false, "", null);
|
||||
},
|
||||
};
|
||||
|
@ -43,6 +43,7 @@ gTests.push({
|
||||
yield addTab(chromeRoot + "browser_context_menu_tests_02.html");
|
||||
|
||||
purgeEventQueue();
|
||||
emptyClipboard();
|
||||
|
||||
let win = Browser.selectedTab.browser.contentWindow;
|
||||
|
||||
@ -68,10 +69,21 @@ gTests.push({
|
||||
checkContextUIMenuItemVisibility(["context-copy",
|
||||
"context-search"]);
|
||||
|
||||
let menuItem = document.getElementById("context-copy");
|
||||
promise = waitForEvent(document, "popuphidden");
|
||||
ContextMenuUI.hide();
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, win);
|
||||
|
||||
yield promise;
|
||||
ok(promise && !(promise instanceof Error), "promise error");
|
||||
|
||||
// The wait is needed to give time to populate the clipboard.
|
||||
let string = "";
|
||||
yield waitForCondition(function () {
|
||||
string = SpecialPowers.getClipboardData("text/unicode");
|
||||
return string === span.textContent;
|
||||
});
|
||||
ok(string === span.textContent, "copied selected text from span");
|
||||
|
||||
win.getSelection().removeAllRanges();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -136,21 +148,46 @@ gTests.push({
|
||||
// should be visible
|
||||
ok(ContextMenuUI._menuPopup._visible, "is visible");
|
||||
|
||||
checkContextUIMenuItemVisibility(["context-copy",
|
||||
checkContextUIMenuItemVisibility(["context-select",
|
||||
"context-select-all"]);
|
||||
|
||||
// copy menu item should not exist when no text is selected
|
||||
let menuItem = document.getElementById("context-copy");
|
||||
ok(menuItem && menuItem.hidden, "menu item is not visible");
|
||||
|
||||
promise = waitForEvent(document, "popuphidden");
|
||||
ContextMenuUI.hide();
|
||||
yield promise;
|
||||
ok(promise && !(promise instanceof Error), "promise error");
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// context in input with selection copied to clipboard
|
||||
|
||||
let input = win.document.getElementById("text3-input");
|
||||
input.value = "hello, I'm sorry but I must be going.";
|
||||
input.setSelectionRange(0, 5);
|
||||
promise = waitForEvent(document, "popupshown");
|
||||
sendContextMenuClickToElement(win, input, 20, 10);
|
||||
yield promise;
|
||||
ok(promise && !(promise instanceof Error), "promise error");
|
||||
|
||||
// should be visible
|
||||
ok(ContextMenuUI._menuPopup._visible, "is visible");
|
||||
|
||||
checkContextUIMenuItemVisibility(["context-cut",
|
||||
"context-copy",
|
||||
"context-select",
|
||||
"context-select-all"]);
|
||||
|
||||
// copy menu item should copy all text
|
||||
let menuItem = document.getElementById("context-copy");
|
||||
ok(menuItem, "menu item exists");
|
||||
ok(!menuItem.hidden, "menu item visible");
|
||||
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, win);
|
||||
|
||||
yield popupPromise;
|
||||
ok(popupPromise && !(popupPromise instanceof Error), "promise error");
|
||||
|
||||
let string = SpecialPowers.getClipboardData("text/unicode");
|
||||
ok(string, "hello, I'm sorry but I must be going.", "copy all");
|
||||
ok(string === "hello", "copied selected text");
|
||||
|
||||
emptyClipboard();
|
||||
|
||||
@ -168,8 +205,8 @@ gTests.push({
|
||||
ok(ContextMenuUI._menuPopup._visible, "is visible");
|
||||
|
||||
// selected text context:
|
||||
checkContextUIMenuItemVisibility(["context-copy",
|
||||
"context-search"]);
|
||||
checkContextUIMenuItemVisibility(["context-cut",
|
||||
"context-copy"]);
|
||||
|
||||
promise = waitForEvent(document, "popuphidden");
|
||||
ContextMenuUI.hide();
|
||||
@ -191,8 +228,8 @@ gTests.push({
|
||||
ok(ContextMenuUI._menuPopup._visible, "is visible");
|
||||
|
||||
// selected text context:
|
||||
checkContextUIMenuItemVisibility(["context-copy",
|
||||
"context-search",
|
||||
checkContextUIMenuItemVisibility(["context-cut",
|
||||
"context-copy",
|
||||
"context-paste"]);
|
||||
|
||||
promise = waitForEvent(document, "popuphidden");
|
||||
@ -200,6 +237,41 @@ gTests.push({
|
||||
yield promise;
|
||||
ok(promise && !(promise instanceof Error), "promise error");
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// context in input with selection cut to clipboard
|
||||
|
||||
emptyClipboard();
|
||||
|
||||
let input = win.document.getElementById("text3-input");
|
||||
input.value = "hello, I'm sorry but I must be going.";
|
||||
input.setSelectionRange(0, 5);
|
||||
promise = waitForEvent(document, "popupshown");
|
||||
sendContextMenuClickToElement(win, input, 20, 10);
|
||||
yield promise;
|
||||
ok(promise && !(promise instanceof Error), "promise error");
|
||||
|
||||
// should be visible
|
||||
ok(ContextMenuUI._menuPopup._visible, "is visible");
|
||||
|
||||
checkContextUIMenuItemVisibility(["context-cut",
|
||||
"context-copy",
|
||||
"context-select",
|
||||
"context-select-all"]);
|
||||
|
||||
let menuItem = document.getElementById("context-cut");
|
||||
let popupPromise = waitForEvent(document, "popuphidden");
|
||||
EventUtils.synthesizeMouse(menuItem, 10, 10, {}, win);
|
||||
|
||||
yield popupPromise;
|
||||
ok(popupPromise && !(popupPromise instanceof Error), "promise error");
|
||||
|
||||
let string = SpecialPowers.getClipboardData("text/unicode");
|
||||
let inputValue = input.value;
|
||||
ok(string === "hello", "cut selected text in clipboard");
|
||||
ok(inputValue === ", I'm sorry but I must be going.", "cut selected text from input value");
|
||||
|
||||
emptyClipboard();
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// context in empty input, data on clipboard (paste operation)
|
||||
|
||||
|
@ -51,6 +51,7 @@
|
||||
<!ENTITY consoleErrColumn.label "Column:">
|
||||
|
||||
<!-- TEXT CONTEXT MENU -->
|
||||
<!ENTITY contextTextCut.label "Cut">
|
||||
<!ENTITY contextTextCopy.label "Copy">
|
||||
<!ENTITY contextTextPaste.label "Paste">
|
||||
<!-- unique item that is only added to the url bar context menu -->
|
||||
|
@ -87,7 +87,3 @@ opensearch.search=Search: %S
|
||||
# %S is the name of the app, like "YouTube" or "Picassa"
|
||||
openinapp.specific=Open in %S App
|
||||
openinapp.general=Open in Another App
|
||||
|
||||
# Selection alerts
|
||||
selectionHelper.textCopied=Text copied to clipboard
|
||||
selectionHelper.linkCopied=Link copied to clipboard
|
||||
|
@ -20,9 +20,7 @@
|
||||
margin: 10px 0;
|
||||
padding: 0;
|
||||
box-shadow: none;
|
||||
%ifdef XP_WIN
|
||||
border-bottom-width: 0;
|
||||
%endif
|
||||
}
|
||||
|
||||
.devtools-responsiveui-toolbar > menulist,
|
||||
|
@ -23,6 +23,12 @@ public interface Actions {
|
||||
/** Blocks until the event has been received and returns data associated with the event. */
|
||||
public String blockForEventData();
|
||||
|
||||
/**
|
||||
* Blocks until the event has been received, or until the timeout has been exceeded.
|
||||
* Returns the data associated with the event, if applicable.
|
||||
*/
|
||||
public String blockForEventDataWithTimeout(long millis);
|
||||
|
||||
/** Polls to see if the event has been received. Once this returns true, subsequent calls will also return true. */
|
||||
public boolean eventReceived();
|
||||
}
|
||||
|
@ -115,20 +115,27 @@ public class FennecNativeActions implements Actions {
|
||||
}
|
||||
|
||||
public synchronized void blockForEvent() {
|
||||
blockForEvent(MAX_WAIT_MS, true);
|
||||
}
|
||||
|
||||
private synchronized void blockForEvent(long millis, boolean failOnTimeout) {
|
||||
long startTime = SystemClock.uptimeMillis();
|
||||
long endTime = 0;
|
||||
while (! mEventReceived) {
|
||||
try {
|
||||
this.wait(MAX_WAIT_MS);
|
||||
this.wait(millis);
|
||||
} catch (InterruptedException ie) {
|
||||
FennecNativeDriver.log(LogLevel.ERROR, ie);
|
||||
break;
|
||||
}
|
||||
endTime = SystemClock.uptimeMillis();
|
||||
if (!mEventReceived && (endTime - startTime >= MAX_WAIT_MS)) {
|
||||
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
|
||||
mAsserter.ok(false, "GeckoEventExpecter",
|
||||
"blockForEvent timeout: "+mGeckoEvent);
|
||||
if (!mEventReceived && (endTime - startTime >= millis)) {
|
||||
if (failOnTimeout) {
|
||||
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
|
||||
mAsserter.ok(false, "GeckoEventExpecter",
|
||||
"blockForEvent timeout: "+mGeckoEvent);
|
||||
}
|
||||
mEventData = null;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -199,6 +206,11 @@ public class FennecNativeActions implements Actions {
|
||||
return mEventData;
|
||||
}
|
||||
|
||||
public synchronized String blockForEventDataWithTimeout(long millis) {
|
||||
blockForEvent(millis, false);
|
||||
return mEventData;
|
||||
}
|
||||
|
||||
public synchronized boolean eventReceived() {
|
||||
return mEventEverReceived;
|
||||
}
|
||||
@ -287,20 +299,22 @@ public class FennecNativeActions implements Actions {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void blockForEvent() {
|
||||
private synchronized void blockForEvent(long millis, boolean failOnTimeout) {
|
||||
long startTime = SystemClock.uptimeMillis();
|
||||
long endTime = 0;
|
||||
while (!mPaintDone) {
|
||||
try {
|
||||
this.wait(MAX_WAIT_MS);
|
||||
this.wait(millis);
|
||||
} catch (InterruptedException ie) {
|
||||
FennecNativeDriver.log(LogLevel.ERROR, ie);
|
||||
break;
|
||||
}
|
||||
endTime = SystemClock.uptimeMillis();
|
||||
if (!mPaintDone && (endTime - startTime >= MAX_WAIT_MS)) {
|
||||
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
|
||||
mAsserter.ok(false, "PaintExpecter", "blockForEvent timeout");
|
||||
if (!mPaintDone && (endTime - startTime >= millis)) {
|
||||
if (failOnTimeout) {
|
||||
FennecNativeDriver.logAllStackTraces(FennecNativeDriver.LogLevel.ERROR);
|
||||
mAsserter.ok(false, "PaintExpecter", "blockForEvent timeout");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -311,11 +325,20 @@ public class FennecNativeActions implements Actions {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void blockForEvent() {
|
||||
blockForEvent(MAX_WAIT_MS, true);
|
||||
}
|
||||
|
||||
public synchronized String blockForEventData() {
|
||||
blockForEvent();
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized String blockForEventDataWithTimeout(long millis) {
|
||||
blockForEvent(millis, false);
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized boolean eventReceived() {
|
||||
return mPaintDone;
|
||||
}
|
||||
|
@ -49,3 +49,12 @@
|
||||
obj:/lib64/libgobject-2.0.so.0.2200.5
|
||||
...
|
||||
}
|
||||
{
|
||||
Bug 850134
|
||||
Memcheck:Leak
|
||||
fun:realloc
|
||||
fun:_ZN2js6VectorImLm0ENS_15TempAllocPolicyEE13growStorageByEm
|
||||
fun:_ZN2js8SCOutput5writeEm
|
||||
fun:_ZN2js8SCOutput9writePairEjj
|
||||
...
|
||||
}
|
||||
|
@ -3959,7 +3959,7 @@ MOZ_ARG_WITH_BOOL(system-nss,
|
||||
_USE_SYSTEM_NSS=1 )
|
||||
|
||||
if test -n "$_USE_SYSTEM_NSS"; then
|
||||
AM_PATH_NSS(3.14.2, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
|
||||
AM_PATH_NSS(3.14.3, [MOZ_NATIVE_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
|
||||
fi
|
||||
|
||||
if test -n "$MOZ_NATIVE_NSS"; then
|
||||
|
@ -16,6 +16,7 @@ namespace dom {
|
||||
// QueryInterface implementation for DOMImplementation
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(DOMImplementation)
|
||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMDOMImplementation)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
@ -34,7 +35,18 @@ bool
|
||||
DOMImplementation::HasFeature(const nsAString& aFeature,
|
||||
const nsAString& aVersion)
|
||||
{
|
||||
return nsContentUtils::InternalIsSupported(this, aFeature, aVersion);
|
||||
return nsContentUtils::InternalIsSupported(
|
||||
static_cast<nsIDOMDOMImplementation*>(this),
|
||||
aFeature, aVersion);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMImplementation::HasFeature(const nsAString& aFeature,
|
||||
const nsAString& aVersion,
|
||||
bool* aReturn)
|
||||
{
|
||||
*aReturn = HasFeature(aFeature, aVersion);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<DocumentType>
|
||||
@ -66,6 +78,17 @@ DOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
|
||||
return docType.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMImplementation::CreateDocumentType(const nsAString& aQualifiedName,
|
||||
const nsAString& aPublicId,
|
||||
const nsAString& aSystemId,
|
||||
nsIDOMDocumentType** aReturn)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aReturn = CreateDocumentType(aQualifiedName, aPublicId, aSystemId, rv).get();
|
||||
return rv.ErrorCode();
|
||||
}
|
||||
|
||||
nsresult
|
||||
DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
|
||||
const nsAString& aQualifiedName,
|
||||
@ -127,6 +150,17 @@ DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
|
||||
return document.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMImplementation::CreateDocument(const nsAString& aNamespaceURI,
|
||||
const nsAString& aQualifiedName,
|
||||
nsIDOMDocumentType* aDoctype,
|
||||
nsIDOMDocument** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
return CreateDocument(aNamespaceURI, aQualifiedName, aDoctype,
|
||||
getter_AddRefs(document), aReturn);
|
||||
}
|
||||
|
||||
nsresult
|
||||
DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
||||
nsIDocument** aDocument,
|
||||
@ -217,5 +251,13 @@ DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
||||
return document.forget();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMImplementation::CreateHTMLDocument(const nsAString& aTitle,
|
||||
nsIDOMDocument** aReturn)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document;
|
||||
return CreateHTMLDocument(aTitle, getter_AddRefs(document), aReturn);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -5,6 +5,7 @@
|
||||
#ifndef mozilla_dom_DOMImplementation_h
|
||||
#define mozilla_dom_DOMImplementation_h
|
||||
|
||||
#include "nsIDOMDOMImplementation.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
@ -23,7 +24,7 @@ namespace mozilla {
|
||||
namespace dom {
|
||||
class DocumentType;
|
||||
|
||||
class DOMImplementation MOZ_FINAL : public nsISupports
|
||||
class DOMImplementation MOZ_FINAL : public nsIDOMDOMImplementation
|
||||
, public nsWrapperCache
|
||||
{
|
||||
public:
|
||||
@ -54,6 +55,9 @@ public:
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
// nsIDOMDOMImplementation
|
||||
NS_DECL_NSIDOMDOMIMPLEMENTATION
|
||||
|
||||
bool HasFeature(const nsAString& aFeature, const nsAString& aVersion);
|
||||
|
||||
already_AddRefed<DocumentType>
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
#include "nsDOMAttribute.h"
|
||||
#include "nsIDOMDOMStringList.h"
|
||||
#include "nsIDOMDOMImplementation.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
@ -4538,7 +4539,7 @@ nsDocument::GetDoctype(nsIDOMDocumentType** aDoctype)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocument::GetImplementation(nsISupports** aImplementation)
|
||||
nsDocument::GetImplementation(nsIDOMDOMImplementation** aImplementation)
|
||||
{
|
||||
ErrorResult rv;
|
||||
*aImplementation = GetImplementation(rv);
|
||||
|
@ -128,10 +128,7 @@ nsDOMNotifyPaintEvent::Serialize(IPC::Message* aMsg,
|
||||
uint32_t length = mInvalidateRequests.Length();
|
||||
IPC::WriteParam(aMsg, length);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.x);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.y);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.width);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect.height);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mRect);
|
||||
IPC::WriteParam(aMsg, mInvalidateRequests[i].mFlags);
|
||||
}
|
||||
}
|
||||
@ -146,10 +143,7 @@ nsDOMNotifyPaintEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
mInvalidateRequests.SetCapacity(length);
|
||||
for (uint32_t i = 0; i < length; ++i) {
|
||||
nsInvalidateRequestList::Request req;
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.x), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.y), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.width), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect.height), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mRect), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &req.mFlags), false);
|
||||
mInvalidateRequests.AppendElement(req);
|
||||
}
|
||||
|
@ -343,6 +343,7 @@ MOCHITEST_FILES = \
|
||||
test_style_attributes_reflection.html \
|
||||
test_bug629801.html \
|
||||
test_bug839371.html \
|
||||
test_element_prototype.html \
|
||||
test_formData.html \
|
||||
$(NULL)
|
||||
|
||||
|
@ -112,7 +112,7 @@ HTML_TAG("aside", "");
|
||||
HTML_TAG("b", "");
|
||||
HTML_TAG("base", "Base");
|
||||
HTML_TAG("bdo", "");
|
||||
HTML_TAG("bgsound", "Span");
|
||||
HTML_TAG("bgsound", "Unknown");
|
||||
HTML_TAG("big", "");
|
||||
HTML_TAG("blink", "");
|
||||
HTML_TAG("blockquote", "Quote");
|
||||
@ -159,7 +159,7 @@ HTML_TAG("html", "Html");
|
||||
HTML_TAG("i", "");
|
||||
HTML_TAG("iframe", "IFrame", [ "nsIDOMGetSVGDocument", "nsIDOMMozBrowserFrame" ],
|
||||
[ "nsIFrameLoaderOwner" ]);
|
||||
HTML_TAG("image", "Span");
|
||||
HTML_TAG("image", "");
|
||||
HTML_TAG("img", "Image", [ "nsIImageLoadingContent" ], []);
|
||||
HTML_TAG("input", "Input", [], [ "imgINotificationObserver",
|
||||
"nsIImageLoadingContent",
|
||||
@ -179,7 +179,7 @@ HTML_TAG("marquee", "Div");
|
||||
HTML_TAG("menu", "Menu");
|
||||
HTML_TAG("meta", "Meta");
|
||||
HTML_TAG("meter", "Meter");
|
||||
HTML_TAG("multicol", "Span");
|
||||
HTML_TAG("multicol", "Unknown");
|
||||
HTML_TAG("nav", "")
|
||||
HTML_TAG("nobr", "");
|
||||
HTML_TAG("noembed", "");
|
||||
@ -244,10 +244,18 @@ for (var tag of allTags) {
|
||||
"Unexpected classname for " + tagName(tag));
|
||||
is(node instanceof window[classInfoString], true,
|
||||
tagName(tag) + " not an instance of " + classInfos[tag]);
|
||||
is(node instanceof HTMLUnknownElement, false,
|
||||
tagName(tag) + " is an instance of HTMLUnknownElement");
|
||||
is(node instanceof SpecialPowers.Ci.nsIDOMHTMLUnknownElement, false,
|
||||
tagName(tag) + " is an instance of nsIDOMHTMLUnknownElement");
|
||||
|
||||
if (classInfoString != 'HTMLUnknownElement') {
|
||||
is(node instanceof HTMLUnknownElement, false,
|
||||
tagName(tag) + " is an instance of HTMLUnknownElement");
|
||||
is(node instanceof SpecialPowers.Ci.nsIDOMHTMLUnknownElement, false,
|
||||
tagName(tag) + " is an instance of nsIDOMHTMLUnknownElement");
|
||||
} else {
|
||||
is(node instanceof HTMLUnknownElement, true,
|
||||
tagName(tag) + " is an instance of HTMLUnknownElement");
|
||||
is(node instanceof SpecialPowers.Ci.nsIDOMHTMLUnknownElement, true,
|
||||
tagName(tag) + " is an instance of nsIDOMHTMLUnknownElement");
|
||||
}
|
||||
|
||||
// Check that each node QIs to all the things we expect it to QI to
|
||||
for (var iface of interfaces[tag].concat(interfacesNonClassinfo[tag])) {
|
||||
|
32
content/html/content/test/test_element_prototype.html
Normal file
32
content/html/content/test/test_element_prototype.html
Normal file
@ -0,0 +1,32 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=844127
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 844127</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=844127">Mozilla Bug 844127</a>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
/** Test for Bug 844127 **/
|
||||
|
||||
var a1 = document.createElement('bgsound');
|
||||
var a2 = document.createElement('image');
|
||||
var a3 = document.createElement('multicol');
|
||||
var a4 = document.createElement('spacer');
|
||||
var a5 = document.createElement('isindex');
|
||||
|
||||
is(Object.getPrototypeOf(a1), HTMLUnknownElement.prototype, "Prototype for bgsound should be correct");
|
||||
is(Object.getPrototypeOf(a2), HTMLElement.prototype, "Prototype for image should be correct");
|
||||
is(Object.getPrototypeOf(a3), HTMLUnknownElement.prototype, "Prototype for multicol should be correct");
|
||||
is(Object.getPrototypeOf(a4), HTMLUnknownElement.prototype, "Prototype for spacer should be correct");
|
||||
is(Object.getPrototypeOf(a5), HTMLUnknownElement.prototype, "Prototype for isindex should be correct");
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -11,6 +11,10 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
struct ThreeDPoint;
|
||||
}
|
||||
|
||||
class AudioNodeStream;
|
||||
|
||||
// We ensure that the graph advances in steps that are multiples of the Web
|
||||
@ -133,6 +137,11 @@ public:
|
||||
{
|
||||
NS_ERROR("Invalid SetTimelineParameter index");
|
||||
}
|
||||
virtual void SetThreeDPointParameter(uint32_t aIndex,
|
||||
const dom::ThreeDPoint& aValue)
|
||||
{
|
||||
NS_ERROR("Invalid SetThreeDPointParameter index");
|
||||
}
|
||||
virtual void SetBuffer(already_AddRefed<ThreadSharedFloatArrayBufferList> aBuffer)
|
||||
{
|
||||
NS_ERROR("SetBuffer called on engine that doesn't support it");
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "MediaStreamGraphImpl.h"
|
||||
#include "AudioNodeEngine.h"
|
||||
#include "ThreeDPoint.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@ -118,6 +119,26 @@ AudioNodeStream::SetTimelineParameter(uint32_t aIndex,
|
||||
GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
|
||||
}
|
||||
|
||||
void
|
||||
AudioNodeStream::SetThreeDPointParameter(uint32_t aIndex, const ThreeDPoint& aValue)
|
||||
{
|
||||
class Message : public ControlMessage {
|
||||
public:
|
||||
Message(AudioNodeStream* aStream, uint32_t aIndex, const ThreeDPoint& aValue)
|
||||
: ControlMessage(aStream), mValue(aValue), mIndex(aIndex) {}
|
||||
virtual void Run()
|
||||
{
|
||||
static_cast<AudioNodeStream*>(mStream)->Engine()->
|
||||
SetThreeDPointParameter(mIndex, mValue);
|
||||
}
|
||||
ThreeDPoint mValue;
|
||||
uint32_t mIndex;
|
||||
};
|
||||
|
||||
MOZ_ASSERT(this);
|
||||
GraphImpl()->AppendMessage(new Message(this, aIndex, aValue));
|
||||
}
|
||||
|
||||
void
|
||||
AudioNodeStream::SetBuffer(already_AddRefed<ThreadSharedFloatArrayBufferList> aBuffer)
|
||||
{
|
||||
|
@ -19,6 +19,10 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
struct ThreeDPoint;
|
||||
}
|
||||
|
||||
class ThreadSharedFloatArrayBufferList;
|
||||
|
||||
/**
|
||||
@ -54,6 +58,7 @@ public:
|
||||
void SetDoubleParameter(uint32_t aIndex, double aValue);
|
||||
void SetInt32Parameter(uint32_t aIndex, int32_t aValue);
|
||||
void SetTimelineParameter(uint32_t aIndex, const dom::AudioParamTimeline& aValue);
|
||||
void SetThreeDPointParameter(uint32_t aIndex, const dom::ThreeDPoint& aValue);
|
||||
void SetBuffer(already_AddRefed<ThreadSharedFloatArrayBufferList> aBuffer);
|
||||
|
||||
virtual AudioNodeStream* AsAudioNodeStream() { return this; }
|
||||
|
@ -37,6 +37,36 @@ AudioListener::WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
return AudioListenerBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
void
|
||||
AudioListener::RegisterPannerNode(PannerNode* aPannerNode)
|
||||
{
|
||||
mPanners.AppendElement(aPannerNode);
|
||||
|
||||
// Let the panner node know about our parameters
|
||||
aPannerNode->SendThreeDPointParameterToStream(PannerNode::LISTENER_POSITION, mPosition);
|
||||
aPannerNode->SendThreeDPointParameterToStream(PannerNode::LISTENER_ORIENTATION, mOrientation);
|
||||
aPannerNode->SendThreeDPointParameterToStream(PannerNode::LISTENER_UPVECTOR, mUpVector);
|
||||
aPannerNode->SendThreeDPointParameterToStream(PannerNode::LISTENER_VELOCITY, mVelocity);
|
||||
aPannerNode->SendDoubleParameterToStream(PannerNode::LISTENER_DOPPLER_FACTOR, mDopplerFactor);
|
||||
aPannerNode->SendDoubleParameterToStream(PannerNode::LISTENER_SPEED_OF_SOUND, mSpeedOfSound);
|
||||
}
|
||||
|
||||
void
|
||||
AudioListener::SendDoubleParameterToStream(uint32_t aIndex, double aValue)
|
||||
{
|
||||
for (uint32_t i = 0; i < mPanners.Length(); ++i) {
|
||||
mPanners[i]->SendDoubleParameterToStream(aIndex, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioListener::SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue)
|
||||
{
|
||||
for (uint32_t i = 0; i < mPanners.Length(); ++i) {
|
||||
mPanners[i]->SendThreeDPointParameterToStream(aIndex, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "nsAutoPtr.h"
|
||||
#include "ThreeDPoint.h"
|
||||
#include "AudioContext.h"
|
||||
#include "PannerNode.h"
|
||||
|
||||
struct JSContext;
|
||||
|
||||
@ -46,6 +47,7 @@ public:
|
||||
void SetDopplerFactor(double aDopplerFactor)
|
||||
{
|
||||
mDopplerFactor = aDopplerFactor;
|
||||
SendDoubleParameterToStream(PannerNode::LISTENER_DOPPLER_FACTOR, mDopplerFactor);
|
||||
}
|
||||
|
||||
double SpeedOfSound() const
|
||||
@ -55,6 +57,7 @@ public:
|
||||
void SetSpeedOfSound(double aSpeedOfSound)
|
||||
{
|
||||
mSpeedOfSound = aSpeedOfSound;
|
||||
SendDoubleParameterToStream(PannerNode::LISTENER_SPEED_OF_SOUND, mSpeedOfSound);
|
||||
}
|
||||
|
||||
void SetPosition(double aX, double aY, double aZ)
|
||||
@ -62,6 +65,7 @@ public:
|
||||
mPosition.x = aX;
|
||||
mPosition.y = aY;
|
||||
mPosition.z = aZ;
|
||||
SendThreeDPointParameterToStream(PannerNode::LISTENER_POSITION, mPosition);
|
||||
}
|
||||
|
||||
void SetOrientation(double aX, double aY, double aZ,
|
||||
@ -73,6 +77,8 @@ public:
|
||||
mUpVector.x = aXUp;
|
||||
mUpVector.y = aYUp;
|
||||
mUpVector.z = aZUp;
|
||||
SendThreeDPointParameterToStream(PannerNode::LISTENER_ORIENTATION, mOrientation);
|
||||
SendThreeDPointParameterToStream(PannerNode::LISTENER_UPVECTOR, mUpVector);
|
||||
}
|
||||
|
||||
void SetVelocity(double aX, double aY, double aZ)
|
||||
@ -80,8 +86,19 @@ public:
|
||||
mVelocity.x = aX;
|
||||
mVelocity.y = aY;
|
||||
mVelocity.z = aZ;
|
||||
SendThreeDPointParameterToStream(PannerNode::LISTENER_VELOCITY, mVelocity);
|
||||
}
|
||||
|
||||
void RegisterPannerNode(PannerNode* aPannerNode);
|
||||
void UnregisterPannerNode(PannerNode* aPannerNode)
|
||||
{
|
||||
mPanners.RemoveElement(aPannerNode);
|
||||
}
|
||||
|
||||
private:
|
||||
void SendDoubleParameterToStream(uint32_t aIndex, double aValue);
|
||||
void SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue);
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioContext> mContext;
|
||||
ThreeDPoint mPosition;
|
||||
@ -90,6 +107,7 @@ private:
|
||||
ThreeDPoint mVelocity;
|
||||
double mDopplerFactor;
|
||||
double mSpeedOfSound;
|
||||
nsTArray<PannerNode*> mPanners;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -175,6 +175,30 @@ AudioNode::Connect(AudioNode& aDestination, uint32_t aOutput,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioNode::SendDoubleParameterToStream(uint32_t aIndex, double aValue)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetDoubleParameter(aIndex, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
AudioNode::SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetInt32Parameter(aIndex, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
AudioNode::SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue)
|
||||
{
|
||||
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
|
||||
MOZ_ASSERT(ns, "How come we don't have a stream here?");
|
||||
ns->SetThreeDPointParameter(aIndex, aValue);
|
||||
}
|
||||
|
||||
void
|
||||
AudioNode::Disconnect(uint32_t aOutput, ErrorResult& aRv)
|
||||
{
|
||||
|
@ -23,6 +23,8 @@ class ErrorResult;
|
||||
|
||||
namespace dom {
|
||||
|
||||
struct ThreeDPoint;
|
||||
|
||||
/**
|
||||
* The DOM object representing a Web Audio AudioNode.
|
||||
*
|
||||
@ -135,6 +137,11 @@ public:
|
||||
protected:
|
||||
static void Callback(AudioNode* aNode) { /* not implemented */ }
|
||||
|
||||
// Helpers for sending different value types to streams
|
||||
void SendDoubleParameterToStream(uint32_t aIndex, double aValue);
|
||||
void SendInt32ParameterToStream(uint32_t aIndex, int32_t aValue);
|
||||
void SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue);
|
||||
|
||||
private:
|
||||
nsRefPtr<AudioContext> mContext;
|
||||
|
||||
|
@ -54,6 +54,7 @@ EXPORTS_mozilla/dom := \
|
||||
|
||||
EXPORTS := \
|
||||
MediaBufferDecoder.h \
|
||||
ThreeDPoint.h \
|
||||
$(NULL)
|
||||
|
||||
FORCE_STATIC_LIB := 1
|
||||
|
@ -5,12 +5,110 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "PannerNode.h"
|
||||
#include "AudioNodeEngine.h"
|
||||
#include "AudioNodeStream.h"
|
||||
#include "AudioListener.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class PannerNodeEngine : public AudioNodeEngine
|
||||
{
|
||||
public:
|
||||
PannerNodeEngine()
|
||||
// Please keep these default values consistent with PannerNode::PannerNode below.
|
||||
: mPanningModel(PanningModelTypeValues::HRTF)
|
||||
, mDistanceModel(DistanceModelTypeValues::Inverse)
|
||||
, mPosition()
|
||||
, mOrientation(1., 0., 0.)
|
||||
, mVelocity()
|
||||
, mRefDistance(1.)
|
||||
, mMaxDistance(10000.)
|
||||
, mRolloffFactor(1.)
|
||||
, mConeInnerAngle(360.)
|
||||
, mConeOuterAngle(360.)
|
||||
, mConeOuterGain(0.)
|
||||
// These will be initialized when a PannerNode is created, so just initialize them
|
||||
// to some dummy values here.
|
||||
, mListenerDopplerFactor(0.)
|
||||
, mListenerSpeedOfSound(0.)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void SetInt32Parameter(uint32_t aIndex, int32_t aParam) MOZ_OVERRIDE
|
||||
{
|
||||
switch (aIndex) {
|
||||
case PannerNode::PANNING_MODEL:
|
||||
mPanningModel = PanningModelType(aParam);
|
||||
break;
|
||||
case PannerNode::DISTANCE_MODEL:
|
||||
mDistanceModel = DistanceModelType(aParam);
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Bad PannerNodeEngine Int32Parameter");
|
||||
}
|
||||
}
|
||||
virtual void SetThreeDPointParameter(uint32_t aIndex, const ThreeDPoint& aParam) MOZ_OVERRIDE
|
||||
{
|
||||
switch (aIndex) {
|
||||
case PannerNode::LISTENER_POSITION: mListenerPosition = aParam; break;
|
||||
case PannerNode::LISTENER_ORIENTATION: mListenerOrientation = aParam; break;
|
||||
case PannerNode::LISTENER_UPVECTOR: mListenerUpVector = aParam; break;
|
||||
case PannerNode::LISTENER_VELOCITY: mListenerVelocity = aParam; break;
|
||||
case PannerNode::POSITION: mPosition = aParam; break;
|
||||
case PannerNode::ORIENTATION: mOrientation = aParam; break;
|
||||
case PannerNode::VELOCITY: mVelocity = aParam; break;
|
||||
default:
|
||||
NS_ERROR("Bad PannerNodeEngine ThreeDPointParameter");
|
||||
}
|
||||
}
|
||||
virtual void SetDoubleParameter(uint32_t aIndex, double aParam) MOZ_OVERRIDE
|
||||
{
|
||||
switch (aIndex) {
|
||||
case PannerNode::LISTENER_DOPPLER_FACTOR: mListenerDopplerFactor = aParam; break;
|
||||
case PannerNode::LISTENER_SPEED_OF_SOUND: mListenerSpeedOfSound = aParam; break;
|
||||
case PannerNode::REF_DISTANCE: mRefDistance = aParam; break;
|
||||
case PannerNode::MAX_DISTANCE: mMaxDistance = aParam; break;
|
||||
case PannerNode::ROLLOFF_FACTOR: mRolloffFactor = aParam; break;
|
||||
case PannerNode::CONE_INNER_ANGLE: mConeInnerAngle = aParam; break;
|
||||
case PannerNode::CONE_OUTER_ANGLE: mConeOuterAngle = aParam; break;
|
||||
case PannerNode::CONE_OUTER_GAIN: mConeOuterGain = aParam; break;
|
||||
default:
|
||||
NS_ERROR("Bad PannerNodeEngine DoubleParameter");
|
||||
}
|
||||
}
|
||||
|
||||
virtual void ProduceAudioBlock(AudioNodeStream* aStream,
|
||||
const AudioChunk& aInput,
|
||||
AudioChunk* aOutput,
|
||||
bool *aFinished) MOZ_OVERRIDE
|
||||
{
|
||||
// TODO: actually do 3D positioning computations here
|
||||
*aOutput = aInput;
|
||||
}
|
||||
|
||||
PanningModelType mPanningModel;
|
||||
DistanceModelType mDistanceModel;
|
||||
ThreeDPoint mPosition;
|
||||
ThreeDPoint mOrientation;
|
||||
ThreeDPoint mVelocity;
|
||||
double mRefDistance;
|
||||
double mMaxDistance;
|
||||
double mRolloffFactor;
|
||||
double mConeInnerAngle;
|
||||
double mConeOuterAngle;
|
||||
double mConeOuterGain;
|
||||
ThreeDPoint mListenerPosition;
|
||||
ThreeDPoint mListenerOrientation;
|
||||
ThreeDPoint mListenerUpVector;
|
||||
ThreeDPoint mListenerVelocity;
|
||||
double mListenerDopplerFactor;
|
||||
double mListenerSpeedOfSound;
|
||||
};
|
||||
|
||||
PannerNode::PannerNode(AudioContext* aContext)
|
||||
: AudioNode(aContext)
|
||||
// Please keep these default values consistent with PannerNodeEngine::PannerNodeEngine above.
|
||||
, mPanningModel(PanningModelTypeValues::HRTF)
|
||||
, mDistanceModel(DistanceModelTypeValues::Inverse)
|
||||
, mPosition()
|
||||
@ -23,6 +121,15 @@ PannerNode::PannerNode(AudioContext* aContext)
|
||||
, mConeOuterAngle(360.)
|
||||
, mConeOuterGain(0.)
|
||||
{
|
||||
mStream = aContext->Graph()->CreateAudioNodeStream(new PannerNodeEngine());
|
||||
// We should register once we have set up our stream and engine.
|
||||
Context()->Listener()->RegisterPannerNode(this);
|
||||
}
|
||||
|
||||
PannerNode::~PannerNode()
|
||||
{
|
||||
Context()->Listener()->UnregisterPannerNode(this);
|
||||
DestroyMediaStream();
|
||||
}
|
||||
|
||||
JSObject*
|
||||
|
@ -23,9 +23,15 @@ class PannerNode : public AudioNode
|
||||
{
|
||||
public:
|
||||
explicit PannerNode(AudioContext* aContext);
|
||||
virtual ~PannerNode();
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope);
|
||||
|
||||
virtual bool SupportsMediaStreams() const MOZ_OVERRIDE
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
PanningModelType PanningModel() const
|
||||
{
|
||||
return mPanningModel;
|
||||
@ -33,6 +39,7 @@ public:
|
||||
void SetPanningModel(PanningModelType aPanningModel)
|
||||
{
|
||||
mPanningModel = aPanningModel;
|
||||
SendInt32ParameterToStream(PANNING_MODEL, int32_t(mPanningModel));
|
||||
}
|
||||
|
||||
DistanceModelType DistanceModel() const
|
||||
@ -42,6 +49,7 @@ public:
|
||||
void SetDistanceModel(DistanceModelType aDistanceModel)
|
||||
{
|
||||
mDistanceModel = aDistanceModel;
|
||||
SendInt32ParameterToStream(DISTANCE_MODEL, int32_t(mDistanceModel));
|
||||
}
|
||||
|
||||
void SetPosition(double aX, double aY, double aZ)
|
||||
@ -49,6 +57,7 @@ public:
|
||||
mPosition.x = aX;
|
||||
mPosition.y = aY;
|
||||
mPosition.z = aZ;
|
||||
SendThreeDPointParameterToStream(POSITION, mPosition);
|
||||
}
|
||||
|
||||
void SetOrientation(double aX, double aY, double aZ)
|
||||
@ -56,6 +65,7 @@ public:
|
||||
mOrientation.x = aX;
|
||||
mOrientation.y = aY;
|
||||
mOrientation.z = aZ;
|
||||
SendThreeDPointParameterToStream(ORIENTATION, mOrientation);
|
||||
}
|
||||
|
||||
void SetVelocity(double aX, double aY, double aZ)
|
||||
@ -63,6 +73,7 @@ public:
|
||||
mVelocity.x = aX;
|
||||
mVelocity.y = aY;
|
||||
mVelocity.z = aZ;
|
||||
SendThreeDPointParameterToStream(VELOCITY, mVelocity);
|
||||
}
|
||||
|
||||
double RefDistance() const
|
||||
@ -72,6 +83,7 @@ public:
|
||||
void SetRefDistance(double aRefDistance)
|
||||
{
|
||||
mRefDistance = aRefDistance;
|
||||
SendDoubleParameterToStream(REF_DISTANCE, mRefDistance);
|
||||
}
|
||||
|
||||
double MaxDistance() const
|
||||
@ -81,6 +93,7 @@ public:
|
||||
void SetMaxDistance(double aMaxDistance)
|
||||
{
|
||||
mMaxDistance = aMaxDistance;
|
||||
SendDoubleParameterToStream(MAX_DISTANCE, mMaxDistance);
|
||||
}
|
||||
|
||||
double RolloffFactor() const
|
||||
@ -90,6 +103,7 @@ public:
|
||||
void SetRolloffFactor(double aRolloffFactor)
|
||||
{
|
||||
mRolloffFactor = aRolloffFactor;
|
||||
SendDoubleParameterToStream(ROLLOFF_FACTOR, mRolloffFactor);
|
||||
}
|
||||
|
||||
double ConeInnerAngle() const
|
||||
@ -99,6 +113,7 @@ public:
|
||||
void SetConeInnerAngle(double aConeInnerAngle)
|
||||
{
|
||||
mConeInnerAngle = aConeInnerAngle;
|
||||
SendDoubleParameterToStream(CONE_INNER_ANGLE, mConeInnerAngle);
|
||||
}
|
||||
|
||||
double ConeOuterAngle() const
|
||||
@ -108,6 +123,7 @@ public:
|
||||
void SetConeOuterAngle(double aConeOuterAngle)
|
||||
{
|
||||
mConeOuterAngle = aConeOuterAngle;
|
||||
SendDoubleParameterToStream(CONE_OUTER_ANGLE, mConeOuterAngle);
|
||||
}
|
||||
|
||||
double ConeOuterGain() const
|
||||
@ -117,8 +133,32 @@ public:
|
||||
void SetConeOuterGain(double aConeOuterGain)
|
||||
{
|
||||
mConeOuterGain = aConeOuterGain;
|
||||
SendDoubleParameterToStream(CONE_OUTER_GAIN, mConeOuterGain);
|
||||
}
|
||||
|
||||
private:
|
||||
friend class AudioListener;
|
||||
friend class PannerNodeEngine;
|
||||
enum EngineParameters {
|
||||
LISTENER_POSITION,
|
||||
LISTENER_ORIENTATION,
|
||||
LISTENER_UPVECTOR,
|
||||
LISTENER_VELOCITY,
|
||||
LISTENER_DOPPLER_FACTOR,
|
||||
LISTENER_SPEED_OF_SOUND,
|
||||
PANNING_MODEL,
|
||||
DISTANCE_MODEL,
|
||||
POSITION,
|
||||
ORIENTATION,
|
||||
VELOCITY,
|
||||
REF_DISTANCE,
|
||||
MAX_DISTANCE,
|
||||
ROLLOFF_FACTOR,
|
||||
CONE_INNER_ANGLE,
|
||||
CONE_OUTER_ANGLE,
|
||||
CONE_OUTER_GAIN
|
||||
};
|
||||
|
||||
private:
|
||||
PanningModelType mPanningModel;
|
||||
DistanceModelType mDistanceModel;
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "nsXBLInsertionPoint.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsXBLContentSink.h"
|
||||
#include "nsFixedSizeAllocator.h"
|
||||
#include "xptinfo.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
#include "nsIDocumentObserver.h"
|
||||
@ -81,38 +80,8 @@ class nsIIDKey : public nsHashKey {
|
||||
|
||||
class nsXBLAttributeEntry {
|
||||
public:
|
||||
nsIAtom* GetSrcAttribute() { return mSrcAttribute; }
|
||||
nsIAtom* GetDstAttribute() { return mDstAttribute; }
|
||||
int32_t GetDstNameSpace() { return mDstNameSpace; }
|
||||
|
||||
nsIContent* GetElement() { return mElement; }
|
||||
|
||||
nsXBLAttributeEntry* GetNext() { return mNext; }
|
||||
void SetNext(nsXBLAttributeEntry* aEntry) { mNext = aEntry; }
|
||||
|
||||
static nsXBLAttributeEntry*
|
||||
Create(nsIAtom* aSrcAtom, nsIAtom* aDstAtom, int32_t aDstNameSpace, nsIContent* aContent) {
|
||||
void* place = nsXBLPrototypeBinding::kAttrPool->Alloc(sizeof(nsXBLAttributeEntry));
|
||||
return place ? ::new (place) nsXBLAttributeEntry(aSrcAtom, aDstAtom, aDstNameSpace,
|
||||
aContent) : nullptr;
|
||||
}
|
||||
|
||||
static void
|
||||
Destroy(nsXBLAttributeEntry* aSelf) {
|
||||
aSelf->~nsXBLAttributeEntry();
|
||||
nsXBLPrototypeBinding::kAttrPool->Free(aSelf, sizeof(*aSelf));
|
||||
}
|
||||
|
||||
protected:
|
||||
nsIContent* mElement;
|
||||
|
||||
nsCOMPtr<nsIAtom> mSrcAttribute;
|
||||
nsCOMPtr<nsIAtom> mDstAttribute;
|
||||
int32_t mDstNameSpace;
|
||||
nsXBLAttributeEntry* mNext;
|
||||
|
||||
nsXBLAttributeEntry(nsIAtom* aSrcAtom, nsIAtom* aDstAtom, int32_t aDstNameSpace,
|
||||
nsIContent* aContent)
|
||||
nsXBLAttributeEntry(nsIAtom* aSrcAtom, nsIAtom* aDstAtom,
|
||||
int32_t aDstNameSpace, nsIContent* aContent)
|
||||
: mElement(aContent),
|
||||
mSrcAttribute(aSrcAtom),
|
||||
mDstAttribute(aDstAtom),
|
||||
@ -123,11 +92,22 @@ protected:
|
||||
NS_CONTENT_DELETE_LIST_MEMBER(nsXBLAttributeEntry, this, mNext);
|
||||
}
|
||||
|
||||
private:
|
||||
// Hide so that only Create() and Destroy() can be used to
|
||||
// allocate and deallocate from the heap
|
||||
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
|
||||
static void operator delete(void*, size_t) {}
|
||||
nsIAtom* GetSrcAttribute() { return mSrcAttribute; }
|
||||
nsIAtom* GetDstAttribute() { return mDstAttribute; }
|
||||
int32_t GetDstNameSpace() { return mDstNameSpace; }
|
||||
|
||||
nsIContent* GetElement() { return mElement; }
|
||||
|
||||
nsXBLAttributeEntry* GetNext() { return mNext; }
|
||||
void SetNext(nsXBLAttributeEntry* aEntry) { mNext = aEntry; }
|
||||
|
||||
protected:
|
||||
nsIContent* mElement;
|
||||
|
||||
nsCOMPtr<nsIAtom> mSrcAttribute;
|
||||
nsCOMPtr<nsIAtom> mDstAttribute;
|
||||
int32_t mDstNameSpace;
|
||||
nsXBLAttributeEntry* mNext;
|
||||
};
|
||||
|
||||
// nsXBLInsertionPointEntry and helpers. This class stores all the necessary
|
||||
@ -137,6 +117,11 @@ private:
|
||||
|
||||
class nsXBLInsertionPointEntry {
|
||||
public:
|
||||
nsXBLInsertionPointEntry(nsIContent* aParent)
|
||||
: mInsertionParent(aParent),
|
||||
mInsertionIndex(0)
|
||||
{}
|
||||
|
||||
~nsXBLInsertionPointEntry() {
|
||||
if (mDefaultContent) {
|
||||
nsAutoScriptBlocker scriptBlocker;
|
||||
@ -144,7 +129,7 @@ public:
|
||||
// document, and we own and manage it. Unhook it here, since we're going
|
||||
// away.
|
||||
mDefaultContent->UnbindFromTree();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsXBLInsertionPointEntry)
|
||||
@ -156,78 +141,14 @@ public:
|
||||
nsIContent* GetDefaultContent() { return mDefaultContent; }
|
||||
void SetDefaultContent(nsIContent* aChildren) { mDefaultContent = aChildren; }
|
||||
|
||||
|
||||
// We keep kPool alive as long as there is at least either a
|
||||
// nsXBLPrototypeBinding or a nsXBLInsertionPointEntry alive.
|
||||
// nsXBLPrototypeBinding has its own global refcount so it only adds 1 to
|
||||
// nsXBLInsertionPointEntry::gRefCnt as long as there's at least one
|
||||
// nsXBLPrototypeBinding alive.
|
||||
|
||||
static void InitPool(int32_t aInitialSize)
|
||||
{
|
||||
if (++gRefCnt == 1) {
|
||||
kPool = new nsFixedSizeAllocator();
|
||||
if (kPool) {
|
||||
static const size_t kBucketSizes[] = {
|
||||
sizeof(nsXBLInsertionPointEntry)
|
||||
};
|
||||
kPool->Init("XBL Insertion Point Entries", kBucketSizes,
|
||||
ArrayLength(kBucketSizes), aInitialSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
static bool PoolInited()
|
||||
{
|
||||
return kPool != nullptr;
|
||||
}
|
||||
static void ReleasePool()
|
||||
{
|
||||
if (--gRefCnt == 0) {
|
||||
delete kPool;
|
||||
}
|
||||
}
|
||||
|
||||
static nsXBLInsertionPointEntry*
|
||||
Create(nsIContent* aParent) {
|
||||
void* place = kPool->Alloc(sizeof(nsXBLInsertionPointEntry));
|
||||
if (!place) {
|
||||
return nullptr;
|
||||
}
|
||||
++gRefCnt;
|
||||
return ::new (place) nsXBLInsertionPointEntry(aParent);
|
||||
}
|
||||
|
||||
static void
|
||||
Destroy(nsXBLInsertionPointEntry* aSelf) {
|
||||
aSelf->~nsXBLInsertionPointEntry();
|
||||
kPool->Free(aSelf, sizeof(*aSelf));
|
||||
nsXBLInsertionPointEntry::ReleasePool();
|
||||
}
|
||||
|
||||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(nsXBLInsertionPointEntry)
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIContent> mInsertionParent;
|
||||
nsCOMPtr<nsIContent> mDefaultContent;
|
||||
uint32_t mInsertionIndex;
|
||||
|
||||
nsXBLInsertionPointEntry(nsIContent* aParent)
|
||||
: mInsertionParent(aParent),
|
||||
mInsertionIndex(0) { }
|
||||
|
||||
private:
|
||||
// Hide so that only Create() and Destroy() can be used to
|
||||
// allocate and deallocate from the heap
|
||||
static void* operator new(size_t) CPP_THROW_NEW { return 0; }
|
||||
static void operator delete(void*, size_t) {}
|
||||
|
||||
static nsFixedSizeAllocator* kPool;
|
||||
static uint32_t gRefCnt;
|
||||
};
|
||||
|
||||
uint32_t nsXBLInsertionPointEntry::gRefCnt = 0;
|
||||
nsFixedSizeAllocator* nsXBLInsertionPointEntry::kPool;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXBLInsertionPointEntry)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mInsertionParent)
|
||||
if (tmp->mDefaultContent) {
|
||||
@ -248,29 +169,13 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsXBLInsertionPointEntry, Release)
|
||||
|
||||
// =============================================================================
|
||||
|
||||
// Static initialization
|
||||
uint32_t nsXBLPrototypeBinding::gRefCnt = 0;
|
||||
|
||||
nsFixedSizeAllocator* nsXBLPrototypeBinding::kAttrPool;
|
||||
|
||||
static const int32_t kNumElements = 128;
|
||||
|
||||
static const size_t kAttrBucketSizes[] = {
|
||||
sizeof(nsXBLAttributeEntry)
|
||||
};
|
||||
|
||||
static const int32_t kAttrNumBuckets = sizeof(kAttrBucketSizes)/sizeof(size_t);
|
||||
static const int32_t kAttrInitialSize = sizeof(nsXBLAttributeEntry) * kNumElements;
|
||||
|
||||
static const int32_t kInsInitialSize = sizeof(nsXBLInsertionPointEntry) * kNumElements;
|
||||
|
||||
// Implementation /////////////////////////////////////////////////////////////////
|
||||
|
||||
// Constructors/Destructors
|
||||
nsXBLPrototypeBinding::nsXBLPrototypeBinding()
|
||||
: mImplementation(nullptr),
|
||||
mBaseBinding(nullptr),
|
||||
mInheritStyle(true),
|
||||
mInheritStyle(true),
|
||||
mCheckedBaseProto(false),
|
||||
mKeyHandlersRegistered(false),
|
||||
mChromeOnlyContent(false),
|
||||
@ -281,15 +186,6 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding()
|
||||
mBaseNameSpaceID(kNameSpaceID_None)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsXBLPrototypeBinding);
|
||||
gRefCnt++;
|
||||
|
||||
if (gRefCnt == 1) {
|
||||
kAttrPool = new nsFixedSizeAllocator();
|
||||
if (kAttrPool) {
|
||||
kAttrPool->Init("XBL Attribute Entries", kAttrBucketSizes, kAttrNumBuckets, kAttrInitialSize);
|
||||
}
|
||||
nsXBLInsertionPointEntry::InitPool(kInsInitialSize);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -298,10 +194,6 @@ nsXBLPrototypeBinding::Init(const nsACString& aID,
|
||||
nsIContent* aElement,
|
||||
bool aFirstBinding)
|
||||
{
|
||||
if (!kAttrPool || !nsXBLInsertionPointEntry::PoolInited()) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult rv = aInfo->DocumentURI()->Clone(getter_AddRefs(mBindingURI));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -403,11 +295,6 @@ nsXBLPrototypeBinding::~nsXBLPrototypeBinding(void)
|
||||
delete mInsertionPointTable;
|
||||
delete mInterfaceTable;
|
||||
delete mImplementation;
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
delete kAttrPool;
|
||||
nsXBLInsertionPointEntry::ReleasePool();
|
||||
}
|
||||
MOZ_COUNT_DTOR(nsXBLPrototypeBinding);
|
||||
}
|
||||
|
||||
@ -1071,7 +958,7 @@ nsXBLPrototypeBinding::GetStyleSheets()
|
||||
static bool
|
||||
DeleteAttributeEntry(nsHashKey* aKey, void* aData, void* aClosure)
|
||||
{
|
||||
nsXBLAttributeEntry::Destroy(static_cast<nsXBLAttributeEntry*>(aData));
|
||||
delete static_cast<nsXBLAttributeEntry*>(aData);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1106,9 +993,9 @@ nsXBLPrototypeBinding::AddToAttributeTable(int32_t aSourceNamespaceID, nsIAtom*
|
||||
nullptr, 4);
|
||||
mAttributeTable->Put(&nskey, attributesNS);
|
||||
}
|
||||
|
||||
|
||||
nsXBLAttributeEntry* xblAttr =
|
||||
nsXBLAttributeEntry::Create(aSourceTag, aDestTag, aDestNamespaceID, aContent);
|
||||
new nsXBLAttributeEntry(aSourceTag, aDestTag, aDestNamespaceID, aContent);
|
||||
|
||||
nsISupportsKey key(aSourceTag);
|
||||
nsXBLAttributeEntry* entry = static_cast<nsXBLAttributeEntry*>
|
||||
@ -1230,10 +1117,10 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
|
||||
int32_t i;
|
||||
for (i = 0; i < count; i++) {
|
||||
nsIContent* child = childrenElements[i];
|
||||
nsCOMPtr<nsIContent> parent = child->GetParent();
|
||||
nsCOMPtr<nsIContent> parent = child->GetParent();
|
||||
|
||||
// Create an XBL insertion point entry.
|
||||
nsXBLInsertionPointEntry* xblIns = nsXBLInsertionPointEntry::Create(parent);
|
||||
nsXBLInsertionPointEntry* xblIns = new nsXBLInsertionPointEntry(parent);
|
||||
|
||||
nsAutoString includes;
|
||||
child->GetAttr(kNameSpaceID_None, nsGkAtoms::includes, includes);
|
||||
@ -1892,7 +1779,7 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
|
||||
namespaceID, nsIDOMNode::ATTRIBUTE_NODE);
|
||||
attrs[i].mName.SetTo(ni);
|
||||
}
|
||||
|
||||
|
||||
rv = prototype->SetAttrAt(i, val, documentURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -1962,7 +1849,7 @@ nsXBLPrototypeBinding::ReadContentNode(nsIObjectInputStream* aStream,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
while (insertionPointIndex != XBLBinding_Serialize_NoMoreInsertionPoints) {
|
||||
nsRefPtr<nsXBLInsertionPointEntry> xblIns =
|
||||
nsXBLInsertionPointEntry::Create(content);
|
||||
new nsXBLInsertionPointEntry(content);
|
||||
xblIns->SetInsertionIndex(insertionPointIndex);
|
||||
|
||||
// If the insertion point has default content, read it.
|
||||
|
@ -23,7 +23,6 @@ class nsIAtom;
|
||||
class nsIDocument;
|
||||
class nsIScriptContext;
|
||||
class nsSupportsHashtable;
|
||||
class nsFixedSizeAllocator;
|
||||
class nsXBLProtoImplField;
|
||||
class nsXBLBinding;
|
||||
class nsCSSStyleSheet;
|
||||
@ -284,11 +283,6 @@ public:
|
||||
void UnlinkJSObjects();
|
||||
void Trace(TraceCallback aCallback, void *aClosure) const;
|
||||
|
||||
// Static members
|
||||
static uint32_t gRefCnt;
|
||||
|
||||
static nsFixedSizeAllocator* kAttrPool;
|
||||
|
||||
// Internal member functions.
|
||||
// XXXbz GetImmediateChild needs to be public to be called by SetAttrs,
|
||||
// InstantiateInsertionPoints, etc; those should probably be a class static
|
||||
|
@ -1,5 +0,0 @@
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
@ -1,5 +0,0 @@
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
@ -1,5 +0,0 @@
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
@ -1,5 +0,0 @@
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
@ -2882,37 +2882,29 @@ nsDOMClassInfo::Init()
|
||||
DOM_CLASSINFO_MAP_END
|
||||
#endif
|
||||
|
||||
MOZ_STATIC_ASSERT(MOZ_ARRAY_LENGTH(sClassInfoData) == eDOMClassInfoIDCount,
|
||||
"The number of items in sClassInfoData doesn't match the "
|
||||
"number of nsIDOMClassInfo ID's, this is bad! Fix it!");
|
||||
|
||||
#ifdef DEBUG
|
||||
{
|
||||
uint32_t i = ArrayLength(sClassInfoData);
|
||||
|
||||
if (i != eDOMClassInfoIDCount) {
|
||||
MOZ_NOT_REACHED("The number of items in sClassInfoData doesn't match the "
|
||||
"number of nsIDOMClassInfo ID's, this is bad! Fix it!");
|
||||
|
||||
for (size_t i = 0; i < eDOMClassInfoIDCount; i++) {
|
||||
if (!sClassInfoData[i].u.mConstructorFptr ||
|
||||
sClassInfoData[i].mDebugID != i) {
|
||||
MOZ_NOT_REACHED("Class info data out of sync, you forgot to update "
|
||||
"nsDOMClassInfo.h and nsDOMClassInfo.cpp! Fix this, "
|
||||
"mozilla will not work without this fixed!");
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
for (i = 0; i < eDOMClassInfoIDCount; i++) {
|
||||
if (!sClassInfoData[i].u.mConstructorFptr ||
|
||||
sClassInfoData[i].mDebugID != i) {
|
||||
MOZ_NOT_REACHED("Class info data out of sync, you forgot to update "
|
||||
"nsDOMClassInfo.h and nsDOMClassInfo.cpp! Fix this, "
|
||||
"mozilla will not work without this fixed!");
|
||||
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < eDOMClassInfoIDCount; i++) {
|
||||
if (!sClassInfoData[i].mInterfaces) {
|
||||
MOZ_NOT_REACHED("Class info data without an interface list! Fix this, "
|
||||
"mozilla will not work without this fixed!");
|
||||
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < eDOMClassInfoIDCount; i++) {
|
||||
if (!sClassInfoData[i].mInterfaces) {
|
||||
MOZ_NOT_REACHED("Class info data without an interface list! Fix this, "
|
||||
"mozilla will not work without this fixed!");
|
||||
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize static JSString's
|
||||
|
@ -439,6 +439,11 @@ DOMInterfaces = {
|
||||
'nativeType' : 'mozilla::dom::HTMLSharedListElement'
|
||||
},
|
||||
|
||||
'IDBVersionChangeEvent': {
|
||||
'nativeType': 'mozilla::dom::indexedDB::IDBVersionChangeEvent',
|
||||
'headerFile': 'IDBEvents.h',
|
||||
},
|
||||
|
||||
'IID': [
|
||||
{
|
||||
'nativeType': 'nsIJSID',
|
||||
|
@ -84,6 +84,7 @@ LOCAL_INCLUDES += -I$(topsrcdir)/js/xpconnect/src \
|
||||
-I$(topsrcdir)/media/webrtc/signaling/src/peerconnection \
|
||||
-I$(topsrcdir)/dom/base \
|
||||
-I$(topsrcdir)/dom/battery \
|
||||
-I$(topsrcdir)/dom/indexedDB \
|
||||
-I$(topsrcdir)/content/xslt/src/base \
|
||||
-I$(topsrcdir)/content/xslt/src/xpath \
|
||||
-I$(topsrcdir)/content/xml/content/src \
|
||||
@ -98,8 +99,8 @@ endif
|
||||
|
||||
# XXXkhuey this is a terrible hack to avoid blowing out the command line
|
||||
ifneq (,$(filter-out all chrome default export realchrome tools clean clobber clobber_all distclean realclean,$(MAKECMDGOALS)))
|
||||
$(shell echo "$(addsuffix .pp,$(binding_header_files))" > pp.list)
|
||||
$(shell echo "$(addsuffix .pp,$(binding_cpp_files))" >> pp.list)
|
||||
$(shell echo "$(addsuffix .pp,$(binding_header_files))" > hpp.list)
|
||||
$(shell echo "$(addsuffix .pp,$(binding_cpp_files))" > cpp.list)
|
||||
|
||||
# The script mddepend.pl checks the dependencies and writes to stdout
|
||||
# one rule to force out-of-date objects. For example,
|
||||
@ -107,8 +108,10 @@ $(shell echo "$(addsuffix .pp,$(binding_cpp_files))" >> pp.list)
|
||||
# The script has an advantage over including the *.pp files directly
|
||||
# because it handles the case when header files are removed from the build.
|
||||
# 'make' would complain that there is no way to build missing headers.
|
||||
ALL_PP_RESULTS = $(shell cat pp.list | $(PERL) $(BUILD_TOOLS)/mddepend.pl)
|
||||
$(eval $(ALL_PP_RESULTS))
|
||||
HPP_PP_RESULTS = $(shell cat hpp.list | $(PERL) $(BUILD_TOOLS)/mddepend.pl)
|
||||
$(eval $(HPP_PP_RESULTS))
|
||||
CPP_PP_RESULTS = $(shell cat cpp.list | $(PERL) $(BUILD_TOOLS)/mddepend.pl)
|
||||
$(eval $(CPP_PP_RESULTS))
|
||||
|
||||
endif
|
||||
|
||||
|
@ -85,6 +85,7 @@ BluetoothUnixSocketConnector::SetUp(int aFd)
|
||||
lm |= mEncrypt ? L2CAP_LM_ENCRYPT : 0;
|
||||
break;
|
||||
case BluetoothSocketType::SCO:
|
||||
break;
|
||||
default:
|
||||
MOZ_NOT_REACHED("Unknown socket type!");
|
||||
}
|
||||
|
@ -4,3 +4,18 @@ browser = false
|
||||
qemu = true
|
||||
|
||||
[test_stk_proactive_command.js]
|
||||
[test_stk_refresh.js]
|
||||
[test_stk_poll_off.js]
|
||||
[test_stk_setup_event_list.js]
|
||||
[test_stk_setup_call.js]
|
||||
[test_stk_send_ss.js]
|
||||
[test_stk_send_ussd.js]
|
||||
[test_stk_send_sms.js]
|
||||
[test_stk_send_dtmf.js]
|
||||
[test_stk_launch_browser.js]
|
||||
[test_stk_display_text.js]
|
||||
[test_stk_get_inkey.js]
|
||||
[test_stk_get_input.js]
|
||||
[test_stk_select_item.js]
|
||||
[test_stk_setup_menu.js]
|
||||
[test_stk_setup_idle_mode_text.js]
|
||||
|
118
dom/icc/tests/marionette/test_stk_display_text.js
Normal file
118
dom/icc/tests/marionette/test_stk_display_text.js
Normal file
@ -0,0 +1,118 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testDisplayText(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_DISPLAY_TEXT, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (expect.userClear) {
|
||||
is(command.options.userClear, expect.userClear, expect.name);
|
||||
}
|
||||
if (expect.isHighPriority) {
|
||||
is(command.options.isHighPriority, expect.isHighPriority, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d01a8103012180820281028d0f04546f6f6c6b697420546573742031",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_1",
|
||||
commandQualifier: 0x80,
|
||||
text: "Toolkit Test 1",
|
||||
userClear: true}},
|
||||
{command: "d01a8103012181820281028d0f04546f6f6c6b697420546573742032",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_2",
|
||||
commandQualifier: 0x81,
|
||||
text: "Toolkit Test 2",
|
||||
isHighPriority: true,
|
||||
userClear: true}},
|
||||
{command: "d0198103012180820281028d0e00d4f79bbd4ed341d4f29c0e9a01",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_3",
|
||||
commandQualifier: 0x80,
|
||||
text: "Toolkit Test 3",
|
||||
userClear: true}},
|
||||
{command: "d01a8103012100820281028d0f04546f6f6c6b697420546573742034",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
text: "Toolkit Test 4"}},
|
||||
{command: "d081ad8103012180820281028d81a1045468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920612074657874206d6573736167652e20497420616c6c6f7773207468652053494d20746f20646566696e6520746865207072696f72697479206f662074686174206d6573736167652c20616e6420746865207465787420737472696e6720666f726d61742e2054776f207479706573206f66207072696f",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_5",
|
||||
commandQualifier: 0x80,
|
||||
text: "This command instructs the ME to display a text message. It allows the SIM to define the priority of that message, and the text string format. Two types of prio",
|
||||
userClear: true}},
|
||||
{command: "d01a8103012180820281028d0f043c474f2d4241434b57415244533e",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_6",
|
||||
commandQualifier: 0x80,
|
||||
text: "<GO-BACKWARDS>",
|
||||
userClear: true}},
|
||||
{command: "d0248103012180820281028d1908041704140420041004120421042204120423041904220415",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_7",
|
||||
commandQualifier: 0x80,
|
||||
text: "ЗДРАВСТВУЙТЕ",
|
||||
userClear: true}},
|
||||
{command: "d0108103012180820281028d05084f60597d",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_8",
|
||||
commandQualifier: 0x80,
|
||||
text: "你好",
|
||||
userClear: true}},
|
||||
{command: "d0128103012180820281028d07080038003030eb",
|
||||
func: testDisplayText,
|
||||
expect: {name: "display_text_cmd_9",
|
||||
commandQualifier: 0x80,
|
||||
text: "80ル",
|
||||
userClear: true}},
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
138
dom/icc/tests/marionette/test_stk_get_inkey.js
Normal file
138
dom/icc/tests/marionette/test_stk_get_inkey.js
Normal file
@ -0,0 +1,138 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testGetInKey(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_GET_INKEY, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
if (command.options.isAlphabet) {
|
||||
is(command.options.isAlphabet, expect.isAlphabet, expect.name);
|
||||
}
|
||||
if (command.options.isUCS2) {
|
||||
is(command.options.isUCS2, expect.isUCS2, expect.name);
|
||||
}
|
||||
if (command.options.isYesNoRequested) {
|
||||
is(command.options.isYesNoRequested, expect.isYesNoRequested, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d0158103012200820281828d0a04456e74657220222b22",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
text: "Enter \"+\""}},
|
||||
{command: "d0148103012200820281828d09004537bd2c07896022",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
text: "Enter \"0\""}},
|
||||
{command: "d01a8103012200820281828d0f043c474f2d4241434b57415244533e",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
text: "<GO-BACKWARDS>"}},
|
||||
{command: "d0138103012200820281828d08043c41424f52543e",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
text: "<ABORT>"}},
|
||||
{command: "d0158103012201820281828d0a04456e74657220227122",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_5",
|
||||
commandQualifier: 0x01,
|
||||
text: "Enter \"q\"",
|
||||
isAlphabet: true}},
|
||||
{command: "d081ad8103012201820281828d81a104456e746572202278222e205468697320636f6d6d616e6420696e7374727563747320746865204d4520746f20646973706c617920746578742c20616e6420746f2065787065637420746865207573657220746f20656e74657220612073696e676c65206368617261637465722e20416e7920726573706f6e736520656e7465726564206279207468652075736572207368616c6c206265207061737365642074",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_6",
|
||||
commandQualifier: 0x01,
|
||||
text: "Enter \"x\". This command instructs the ME to display text, and to expect the user to enter a single character. Any response entered by the user shall be passed t",
|
||||
isAlphabet: true}},
|
||||
{command: "d0168103012200820281828d0b043c54494d452d4f55543e",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
text: "<TIME-OUT>"}},
|
||||
{command: "d0248103012200820281828d1908041704140420041004120421042204120423041904220415",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d081998103012200820281828d818d080417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419042204150417041404200410041204210422041204230419",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ"}},
|
||||
{command: "d0118103012203820281828d0604456e746572",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_10",
|
||||
commandQualifier: 0x03,
|
||||
text: "Enter",
|
||||
isAlphabet: true,
|
||||
isUCS2: true}},
|
||||
{command: "d0158103012204820281828d0a04456e74657220594553",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_11",
|
||||
commandQualifier: 0x04,
|
||||
text: "Enter YES",
|
||||
isYesNoRequested: true}},
|
||||
{command: "d0148103012204820281828d0904456e746572204e4f",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_12",
|
||||
commandQualifier: 0x04,
|
||||
text: "Enter NO",
|
||||
isYesNoRequested: true}},
|
||||
{command: "d0198103012200820281828d0a043c4e4f2d49434f4e3e1e020001",
|
||||
func: testGetInKey,
|
||||
expect: {name: "get_inkey_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
text: "<NO-ICON>"}},
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
212
dom/icc/tests/marionette/test_stk_get_input.js
Normal file
212
dom/icc/tests/marionette/test_stk_get_input.js
Normal file
@ -0,0 +1,212 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testGetInput(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_GET_INPUT, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
is(command.options.minLength, expect.minLength, expect.name);
|
||||
is(command.options.maxLength, expect.maxLength, expect.name);
|
||||
if (command.options.defaultText) {
|
||||
is(command.options.defaultText, expect.defaultText, expect.name);
|
||||
}
|
||||
if (command.options.isAlphabet) {
|
||||
is(command.options.isAlphabet, expect.isAlphabet, expect.name);
|
||||
}
|
||||
if (command.options.isUCS2) {
|
||||
is(command.options.isUCS2, expect.isUCS2, expect.name);
|
||||
}
|
||||
if (command.options.isPacked) {
|
||||
is(command.options.isPacked, expect.isPacked, expect.name);
|
||||
}
|
||||
if (command.options.hideInput) {
|
||||
is(command.options.hideInput, expect.hideInput, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d01b8103012300820281828d0c04456e74657220313233343591020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
text: "Enter 12345",
|
||||
minLength: 5,
|
||||
maxLength: 5}},
|
||||
{command: "d01a8103012308820281828d0b004537bd2c07d96eaad10a91020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_2",
|
||||
commandQualifier: 0x08,
|
||||
text: "Enter 67*#+",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isPacked: true}},
|
||||
{command: "d01b8103012301820281828d0c04456e74657220416243644591020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_3",
|
||||
commandQualifier: 0x01,
|
||||
text: "Enter AbCdE",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isAlphabet: true}},
|
||||
{command: "d0278103012304820281828d180450617373776f726420313c53454e443e3233343536373891020408",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_4",
|
||||
commandQualifier: 0x04,
|
||||
text: "Password 1<SEND>2345678",
|
||||
minLength: 4,
|
||||
maxLength: 8,
|
||||
hideInput: true}},
|
||||
{command: "d0248103012300820281828d1504456e74657220312e2e392c302e2e392c3028312991020114",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
text: "Enter 1..9,0..9,0(1)",
|
||||
minLength: 1,
|
||||
maxLength: 20}},
|
||||
{command: "d01e8103012300820281828d0f043c474f2d4241434b57415244533e91020008",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
text: "<GO-BACKWARDS>",
|
||||
minLength: 0,
|
||||
maxLength: 8}},
|
||||
{command: "d0178103012300820281828d08043c41424f52543e91020008",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
text: "<ABORT>",
|
||||
minLength: 0,
|
||||
maxLength: 8}},
|
||||
{command: "d081b18103012300820281828d81a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a303030303030303030302323239102a0a0",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
text: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###",
|
||||
minLength: 160,
|
||||
maxLength: 160}},
|
||||
{command: "d0168103012300820281828d07043c53454e443e91020001",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
text: "<SEND>",
|
||||
minLength: 0,
|
||||
maxLength: 1}},
|
||||
{command: "d01a8103012300820281828d0b043c54494d452d4f55543e9102000a",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
text: "<TIME-OUT>",
|
||||
minLength: 0,
|
||||
maxLength: 10}},
|
||||
{command: "d0288103012301820281828d190804170414042004100412042104220412042304190422041591020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_11",
|
||||
commandQualifier: 0x01,
|
||||
text: "ЗДРАВСТВУЙТЕ",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isAlphabet: true}},
|
||||
{command: "d0819d8103012301820281828d818d08041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041904220415041704140420041004120421042204120423041991020505",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_12",
|
||||
commandQualifier: 0x01,
|
||||
text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙ",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
isAlphabet: true}},
|
||||
{command: "d01b8103012303820281828d0c04456e7465722048656c6c6f91020c0c",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_13",
|
||||
commandQualifier: 0x03,
|
||||
text: "Enter Hello",
|
||||
minLength: 12,
|
||||
maxLength: 12,
|
||||
isAlphabet: true,
|
||||
isUCS2: true}},
|
||||
{command: "d01b8103012303820281828d0c04456e7465722048656c6c6f910205ff",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_14",
|
||||
commandQualifier: 0x03,
|
||||
text: "Enter Hello",
|
||||
minLength: 5,
|
||||
maxLength: 0xFF,
|
||||
isAlphabet: true,
|
||||
isUCS2: true}},
|
||||
{command: "d0238103012300820281828d0c04456e746572203132333435910205051706043132333435",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
text: "Enter 12345",
|
||||
minLength: 5,
|
||||
maxLength: 5,
|
||||
defaultText: "12345"}},
|
||||
{command: "d081ba8103012300820281828d0704456e7465723a9102a0a01781a1042a2a2a313131313131313131312323232a2a2a323232323232323232322323232a2a2a333333333333333333332323232a2a2a343434343434343434342323232a2a2a353535353535353535352323232a2a2a363636363636363636362323232a2a2a373737373737373737372323232a2a2a383838383838383838382323232a2a2a393939393939393939392323232a2a2a30303030303030303030232323",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
text: "Enter:",
|
||||
minLength: 160,
|
||||
maxLength: 160,
|
||||
defaultText: "***1111111111###***2222222222###***3333333333###***4444444444###***5555555555###***6666666666###***7777777777###***8888888888###***9999999999###***0000000000###"}},
|
||||
{command: "d01d8103012300820281828d0a043c4e4f2d49434f4e3e9102000a1e020001",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
text: "<NO-ICON>",
|
||||
minLength: 0,
|
||||
maxLength: 10}},
|
||||
{command: "d0208103012300820281828d0d043c42415349432d49434f4e3e9102000a1e020101",
|
||||
func: testGetInput,
|
||||
expect: {name: "get_input_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
text: "<BASIC-ICON>",
|
||||
minLength: 0,
|
||||
maxLength: 10}},
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
289
dom/icc/tests/marionette/test_stk_launch_browser.js
Normal file
289
dom/icc/tests/marionette/test_stk_launch_browser.js
Normal file
@ -0,0 +1,289 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testLaunchBrowser(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_LAUNCH_BROWSER, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.url, expect.url, expect.name);
|
||||
if (command.options.confirmMessage) {
|
||||
is(command.options.confirmMessage, expect.text, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d0188103011500820281823100050b44656661756c742055524c",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL"}},
|
||||
{command: "d01f8103011500820281823112687474703a2f2f7878782e7979792e7a7a7a0500",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
url: "http://xxx.yyy.zzz",
|
||||
text: ""}},
|
||||
{command: "d00e8103011500820281823001003100",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: ""}},
|
||||
{command: "d02081030115008202818231003201030d10046162632e6465662e6768692e6a6b6c",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: ""}},
|
||||
{command: "d0188103011502820281823100050b44656661756c742055524c",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_5",
|
||||
commandQualifier: 0x02,
|
||||
url: "",
|
||||
text: "Default URL"}},
|
||||
{command: "d0188103011503820281823100050b44656661756c742055524c",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_6",
|
||||
commandQualifier: 0x03,
|
||||
url: "",
|
||||
text: "Default URL"}},
|
||||
{command: "d00b8103011500820281823100",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: ""}},
|
||||
{command: "d0268103011502820281823100051980041704140420041004120421042204120423041904220415",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_8",
|
||||
commandQualifier: 0x02,
|
||||
url: "",
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d021810301150282028182310005104e6f742073656c66206578706c616e2e1e020101",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_9",
|
||||
commandQualifier: 0x02,
|
||||
url: "",
|
||||
text: "Not self explan."}},
|
||||
{command: "d01d8103011502820281823100050c53656c66206578706c616e2e1e020001",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_10",
|
||||
commandQualifier: 0x02,
|
||||
url: "",
|
||||
text: "Self explan."}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d01b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d02b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d04b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 3"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d08b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 3"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d10b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 3"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d20b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 3"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d40b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 3"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d80b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2032d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2033",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 3"}},
|
||||
{command: "d0208103011500820281823100050d44656661756c742055524c2031d004000d00b4",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 1"}},
|
||||
{command: "d01a8103011500820281823100050d44656661756c742055524c2032",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
url: "",
|
||||
text: "Default URL 2"}},
|
||||
{command: "d01281030115028202818231000505804f60597d",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_37",
|
||||
commandQualifier: 0x02,
|
||||
url: "",
|
||||
text: "你好"}},
|
||||
{command: "d010810301150282028182310005038030eb",
|
||||
func: testLaunchBrowser,
|
||||
expect: {name: "launch_browser_cmd_38",
|
||||
commandQualifier: 0x02,
|
||||
url: "",
|
||||
text: "ル"}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
61
dom/icc/tests/marionette/test_stk_poll_off.js
Normal file
61
dom/icc/tests/marionette/test_stk_poll_off.js
Normal file
@ -0,0 +1,61 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testPollOff(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_POLL_OFF, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d009810301040082028182",
|
||||
func: testPollOff,
|
||||
expect: {name: "pull_off_cmd_1",
|
||||
commandQualifier: 0x00}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
65
dom/icc/tests/marionette/test_stk_refresh.js
Normal file
65
dom/icc/tests/marionette/test_stk_refresh.js
Normal file
@ -0,0 +1,65 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testRefresh(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_REFRESH, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d0108103010101820281829205013f002fe2",
|
||||
func: testRefresh,
|
||||
expect: {name: "refresh_cmd_1",
|
||||
commandQualifier: 0x01}},
|
||||
{command: "d009810301010482028182",
|
||||
func: testRefresh,
|
||||
expect: {name: "refresh_cmd_2",
|
||||
commandQualifier: 0x04}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
350
dom/icc/tests/marionette/test_stk_select_item.js
Normal file
350
dom/icc/tests/marionette/test_stk_select_item.js
Normal file
@ -0,0 +1,350 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSelectItem(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SELECT_ITEM, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.title, expect.title, expect.name);
|
||||
for (let index in command.options.items) {
|
||||
is(command.options.items[index].identifier, expect.items[index].identifier, expect.name);
|
||||
is(command.options.items[index].text, expect.items[index].text, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d03d810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
{command: "d081fc810301240082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
title: "LargeMenu1",
|
||||
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
|
||||
{command: "d081fb810301240082028182850a4c617267654d656e75328f1eff43616c6c20466f7277617264696e6720556e636f6e646974696f6e616c8f1dfe43616c6c20466f7277617264696e67204f6e205573657220427573798f1cfd43616c6c20466f7277617264696e67204f6e204e6f205265706c798f26fc43616c6c20466f7277617264696e67204f6e2055736572204e6f7420526561636861626c658f1efb42617272696e67204f6620416c6c204f7574676f696e672043616c6c738f2cfa42617272696e67204f6620416c6c204f7574676f696e6720496e7465726e6174696f6e616c2043616c6c738f11f9434c492050726573656e746174696f6e",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
title: "LargeMenu2",
|
||||
items: [{identifier: 255, text: "Call Forwarding Unconditional"}, {identifier: 254, text: "Call Forwarding On User Busy"}, {identifier: 253, text: "Call Forwarding On No Reply"}, {identifier: 252, text: "Call Forwarding On User Not Reachable"}, {identifier: 251, text: "Barring Of All Outgoing Calls"}, {identifier: 250, text: "Barring Of All Outgoing International Calls"}, {identifier: 249, text: "CLI Presentation"}]}},
|
||||
{command: "d022810301240082028182850b53656c656374204974656d8f04114f6e658f041254776f",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
title: "Select Item",
|
||||
items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
|
||||
{command: "d081fd8103012400820281828581ed5468652053494d207368616c6c20737570706c79206120736574206f66206974656d732066726f6d207768696368207468652075736572206d61792063686f6f7365206f6e652e2045616368206974656d20636f6d70726973657320612073686f7274206964656e74696669657220287573656420746f20696e646963617465207468652073656c656374696f6e2920616e642061207465787420737472696e672e204f7074696f6e616c6c79207468652053494d206d617920696e636c75646520616e20616c706861206964656e7469666965722e2054686520616c706861206964656e74696669657220698f020159",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
title: "The SIM shall supply a set of items from which the user may choose one. Each item comprises a short identifier (used to indicate the selection) and a text string. Optionally the SIM may include an alpha identifier. The alpha identifier i",
|
||||
items: [{identifier: 1, text: "Y"}]}},
|
||||
{command: "d081f3810301240082028182850a304c617267654d656e758f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
title: "0LargeMenu",
|
||||
items: [{identifier: 255, text: "1 Call Forward Unconditional"}, {identifier: 254, text: "2 Call Forward On User Busy"}, {identifier: 253, text: "3 Call Forward On No Reply"}, {identifier: 252, text: "4 Call Forward On User Not Reachable"}, {identifier: 251, text: "5 Barring Of All Outgoing Calls"}, {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"}, {identifier: 249, text: "7 CLI Presentation"}]}},
|
||||
{command: "d039810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20331803131026",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d037810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033900102",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301248082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_9",
|
||||
commandQualifier: 0x80,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401050505",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d03e810301240082028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301240382028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_12",
|
||||
commandQualifier: 0x03,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301240182028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_13",
|
||||
commandQualifier: 0x01,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d02b810301240482028182850e546f6f6c6b69742053656c6563748f07014974656d20318f07024974656d2032",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_14",
|
||||
commandQualifier: 0x04,
|
||||
title: "Toolkit Select",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d030810301240082028182850a3c54494d452d4f55543e8f07014974656d20318f07024974656d20328f07034974656d2033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
title: "<TIME-OUT>",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001001b4d108000601b4000601b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001002b4d108000602b4000602b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001004b4d108000604b4000604b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001008b4d108000608b4000608b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001010b4d108000610b4000610b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001020b4d108000620b4000620b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001040b4d108000640b4000640b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001080b4d108000680b4000680b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_37",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_38",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420338f07014974656d20358f07024974656d2036",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_39",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 3",
|
||||
items: [{identifier: 1, text: "Item 5"}, {identifier: 2, text: "Item 6"}]}},
|
||||
{command: "d03d8103012400820281828510546f6f6c6b69742053656c65637420318f07014974656d20318f07024974656d2032d004001000b4d108000600b4000600b4",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_40",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d02d8103012400820281828510546f6f6c6b69742053656c65637420328f07014974656d20338f07024974656d2034",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_41",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Select 2",
|
||||
items: [{identifier: 1, text: "Item 3"}, {identifier: 2, text: "Item 4"}]}},
|
||||
{command: "d07e8103012400820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c03800417041404200410041204210422041204230419042204150033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_42",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
|
||||
{command: "d053810301240082028182850f810c089794a09092a1a292a399a2958f1101810d089794a09092a1a292a399a295318f1102810d089794a09092a1a292a399a295328f1103810d089794a09092a1a292a399a29533",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_43",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
|
||||
{command: "d0578103012400820281828510820c04108784908082919282938992858f1201820d0410878490808291928293899285318f1202820d0410878490808291928293899285328f1203820d041087849080829192829389928533",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_44",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
|
||||
{command: "d03e810301240082028182850b805de551777bb1900962e98f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_45",
|
||||
commandQualifier: 0x00,
|
||||
title: "工具箱选择",
|
||||
items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
|
||||
{command: "d0388103012400820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb0033",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_46",
|
||||
commandQualifier: 0x00,
|
||||
title: "80ル0",
|
||||
items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}]}},
|
||||
{command: "d03081030124008202818285078104613831eb308f08018104613831eb318f08028104613831eb328f08038104613831eb33",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_47",
|
||||
commandQualifier: 0x00,
|
||||
title: "81ル0",
|
||||
items: [{identifier: 1, text: "81ル1"}, {identifier: 2, text: "81ル2"}, {identifier: 3, text: "81ル3"}]}},
|
||||
{command: "d0348103012400820281828508820430a03832cb308f0901820430a03832cb318f0902820430a03832cb328f0903820430a03832cb33",
|
||||
func: testSelectItem,
|
||||
expect: {name: "select_item_cmd_48",
|
||||
commandQualifier: 0x00,
|
||||
title: "82ル0",
|
||||
items: [{identifier: 1, text: "82ル1"}, {identifier: 2, text: "82ル2"}, {identifier: 3, text: "82ル3"}]}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
230
dom/icc/tests/marionette/test_stk_send_dtmf.js
Normal file
230
dom/icc/tests/marionette/test_stk_send_dtmf.js
Normal file
@ -0,0 +1,230 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSendDTMF(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_DTMF, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d01b810301140082028183850953656e642044544d46ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF"}},
|
||||
{command: "d0138103011400820281838500ac06c1cccccccc2c",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
text: ""}},
|
||||
{command: "d01d810301140082028183850a42617369632049636f6eac02c1f29e020001",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
text: "Basic Icon"}},
|
||||
{command: "d01b810301140082028183850953656e642044544d46ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF"}},
|
||||
{command: "d01c810301140082028183850953656e642044544d46ac02c1f29e020101",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF"}},
|
||||
{command: "d028810301140082028183851980041704140420041004120421042204120423041904220415ac02c1f2",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462032ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b01b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462032ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d00400b002b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462032ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b04b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 3"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b08b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 3"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b10b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 3"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b20b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 3"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b40b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 3"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b80b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462032ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462033ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 3"}},
|
||||
{command: "d023810301140082028183850b53656e642044544d462031ac052143658709d004000b00b4",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 1"}},
|
||||
{command: "d01d810301140082028183850b53656e642044544d462032ac052143658709",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
text: "Send DTMF 2"}},
|
||||
{command: "d0148103011400820281838505804f60597dac02c1f2",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
text: "你好"}},
|
||||
{command: "d01281030114008202818385038030ebac02c1f2",
|
||||
func: testSendDTMF,
|
||||
expect: {name: "send_dtmf_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
text: "ル"}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
280
dom/icc/tests/marionette/test_stk_send_sms.js
Normal file
280
dom/icc/tests/marionette/test_stk_send_sms.js
Normal file
@ -0,0 +1,280 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSendSMS(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_SMS, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d037810301130082028183850753656e6420534d86099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
title: "Send SM"}},
|
||||
{command: "d032810301130182028183850753656e6420534d86099111223344556677f88b130100099110325476f840f40753656e6420534d",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_2",
|
||||
commandQualifier: 0x01,
|
||||
title: "Send SM"}},
|
||||
{command: "d03d810301130082028183850d53686f7274204d65737361676586099111223344556677f88b180100099110325476f840f00d53f45b4e0735cbf379f85c06",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
title: "Short Message"}},
|
||||
{command: "d081fd810301130182028183853854686520616464726573732064617461206f626a65637420686f6c6473207468652052501144657374696e6174696f6e114164647265737386099111223344556677f88b81ac0100099110325476f840f4a054776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e7370",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_4",
|
||||
commandQualifier: 0x01,
|
||||
title: "The address data object holds the RP_Destination_Address"}},
|
||||
{command: "d081e9810301130082028183853854686520616464726573732064617461206f626a65637420686f6c6473207468652052502044657374696e6174696f6e204164647265737386099111223344556677f88b81980100099110325476f840f0a0d4fb1b44cfc3cb7350585e0691cbe6b4bb4cd6815aa020688e7ecbe9a076793e0f9fcb20fa1b242e83e665371d447f83e8e832c85da6dfdff23528ed0685dda06973da9a5685cd2415d42ecfe7e17399057acb41613768da9cb686cf6633e82482dae5f93c7c2eb3407774595e06d1d165507d5e9683c8617a18340ebb41e232081e9ecfcb64105d1e76cfe1",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
title: "The address data object holds the RP Destination Address"}},
|
||||
{command: "d081fd8103011300820281838581e654776f2074797065732061726520646566696e65643a202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954206d6573736167652c206f7220616e20534d532d434f4d4d414e44206d6573736167652c20776865726520746865207573657220646174612063616e20626520706173736564207472616e73706172656e746c793b202d20412073686f7274206d65737361676520746f2062652073656e7420746f20746865206e6574776f726b20696e20616e20534d532d5355424d4954208b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
title: "Two types are defined: - A short message to be sent to the network in an SMS-SUBMIT message, or an SMS-COMMAND message, where the user data can be passed transparently; - A short message to be sent to the network in an SMS-SUBMIT "}},
|
||||
{command: "d030810301130082028183850086099111223344556677f88b180100099110325476f840f40c54657374204d657373616765",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
title: ""}},
|
||||
{command: "d05581030113008202818385198004170414042004100412042104220412042304190422041586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d04b810301130082028183850f810c089794a09092a1a292a399a29586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d04c8103011300820281838510820c041087849080829192829389928586099111223344556677f88b240100099110325476f8400818041704140420041004120421042204120423041904220415",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d03b81030113008202818385074e4f2049434f4e86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167659e020001",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
title: "NO ICON"}},
|
||||
{command: "d03b810301130082028183850753656e6420534d86099111223344556677f88b180100099110325476f840f40c54657374204d6573736167651e020101",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
title: "Send SM"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520328b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001001b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520328b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001002b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520328b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001004b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001008b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001010b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001020b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001040b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001080b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520328b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520338b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d02c8103011300820281838510546578742041747472696275746520318b09010002911040f00120d004001000b4",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0268103011300820281838510546578742041747472696275746520328b09010002911040f00120",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_37",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02d8103011300820281838505804e2d4e0086099111223344556677f88b100100099110325476f84008044e2d4e00",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_38",
|
||||
commandQualifier: 0x00,
|
||||
title: "中一"}},
|
||||
{command: "d02d810301130082028183850581029cad8086099111223344556677f88b100100099110325476f84008044e2d4e00",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_39",
|
||||
commandQualifier: 0x00,
|
||||
title: "中一"}},
|
||||
{command: "d02e810301130082028183850682024e00ad8086099111223344556677f88b100100099110325476f84008044e2d4e00",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_40",
|
||||
commandQualifier: 0x00,
|
||||
title: "中一"}},
|
||||
{command: "d0358103011300820281838509800038003030eb003086099111223344556677f88b140100099110325476f84008080038003030eb0031",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_41",
|
||||
commandQualifier: 0x00,
|
||||
title: "80ル0"}},
|
||||
{command: "d03381030113008202818385078104613831eb3186099111223344556677f88b140100099110325476f84008080038003030eb0032",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_42",
|
||||
commandQualifier: 0x00,
|
||||
title: "81ル1"}},
|
||||
{command: "d0348103011300820281838508820430a03832cb3286099111223344556677f88b140100099110325476f84008080038003030eb0033",
|
||||
func: testSendSMS,
|
||||
expect: {name: "send_sms_cmd_43",
|
||||
commandQualifier: 0x00,
|
||||
title: "82ル2"}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
240
dom/icc/tests/marionette/test_stk_send_ss.js
Normal file
240
dom/icc/tests/marionette/test_stk_send_ss.js
Normal file
@ -0,0 +1,240 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSendSS(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_SS, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d029810301110082028183850c43616c6c20466f7277617264891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
title: "Call Forward"}},
|
||||
{command: "d02d810301110082028183850c43616c6c20466f7277617264891491aa120a21436587092143658709214365a711fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
title: "Call Forward"}},
|
||||
{command: "d081fd8103011100820281838581eb4576656e20696620746865204669786564204469616c6c696e67204e756d626572207365727669636520697320656e61626c65642c2074686520737570706c656d656e74617279207365727669636520636f6e74726f6c20737472696e6720696e636c7564656420696e207468652053454e442053532070726f61637469766520636f6d6d616e64207368616c6c206e6f7420626520636865636b656420616761696e73742074686f7365206f66207468652046444e206c6973742e2055706f6e20726563656976696e67207468697320636f6d6d616e642c20746865204d45207368616c6c20646563698904ffba13fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
title: "Even if the Fixed Dialling Number service is enabled, the supplementary service control string included in the SEND SS proactive command shall not be checked against those of the FDN list. Upon receiving this command, the ME shall deci"}},
|
||||
{command: "d01d8103011100820281838500891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
title: ""}},
|
||||
{command: "d02b810301110082028183850a42617369632049636f6e891091aa120a214365870921436587a901fb9e020001",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon"}},
|
||||
{command: "d02c810301110082028183850b436f6c6f75722049636f6e891091aa120a214365870921436587a901fb9e020002",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
title: "Colour Icon"}},
|
||||
{command: "d02b810301110082028183850a42617369632049636f6e891091aa120a214365870921436587a901fb9e020101",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon"}},
|
||||
{command: "d036810301110082028183851980041704140420041004120421042204120423041904220415891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001001b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001002b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001004b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001008b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001010b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001020b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001040b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001080b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652033891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d033810301110082028183851054657874204174747269627574652031891091aa120a214365870921436587a901fbd004001000b4",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d02d810301110082028183851054657874204174747269627574652032891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0228103011100820281838505804f60597d891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
title: "你好"}},
|
||||
{command: "d02081030111008202818385038030eb891091aa120a214365870921436587a901fb",
|
||||
func: testSendSS,
|
||||
expect: {name: "send_ss_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
title: "ル"}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
245
dom/icc/tests/marionette/test_stk_send_ussd.js
Normal file
245
dom/icc/tests/marionette/test_stk_send_ussd.js
Normal file
@ -0,0 +1,245 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSendUSSD(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SEND_USSD, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.text) {
|
||||
is(command.options.text, expect.title, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d050810301120082028183850a372d62697420555353448a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
title: "7-bit USSD"}},
|
||||
{command: "d058810301120082028183850a382d62697420555353448a41444142434445464748494a4b4c4d4e4f505152535455565758595a2d6162636465666768696a6b6c6d6e6f707172737475767778797a2d31323334353637383930",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
title: "8-bit USSD"}},
|
||||
{command: "d02f81030112008202818385095543533220555353448a1948041704140420041004120421042204120423041904220415",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
title: "UCS2 USSD"}},
|
||||
{command: "d081fd8103011200820281838581b66f6e636520612052454c4541534520434f4d504c455445206d65737361676520636f6e7461696e696e672074686520555353442052657475726e20526573756c74206d657373616765206e6f7420636f6e7461696e696e6720616e206572726f7220686173206265656e2072656365697665642066726f6d20746865206e6574776f726b2c20746865204d45207368616c6c20696e666f726d207468652053494d20746861742074686520636f6d6d616e64206861738a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
title: "once a RELEASE COMPLETE message containing the USSD Return Result message not containing an error has been received from the network, the ME shall inform the SIM that the command has"}},
|
||||
{command: "d04681030112008202818385008a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
title: ""}},
|
||||
{command: "d054810301120082028183850a42617369632049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020001",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon"}},
|
||||
{command: "d054810301120082028183850a436f6c6f722049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020002",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
title: "Color Icon"}},
|
||||
{command: "d054810301120082028183850a42617369632049636f6e8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e5609e020101",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
title: "Basic Icon"}},
|
||||
{command: "d05f8103011200820281838519800417041404200410041204210422041204230419042204158a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001001b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001002b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001004b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001008b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001010b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001020b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001040b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001080b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520338a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 3"}},
|
||||
{command: "d05c8103011200820281838510546578742041747472696275746520318a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560d004001000b4",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 1"}},
|
||||
{command: "d0568103011200820281838510546578742041747472696275746520328a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
title: "Text Attribute 2"}},
|
||||
{command: "d04b8103011200820281838505804f60597d8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
title: "你好"}},
|
||||
{command: "d04981030112008202818385038030eb8a39f041e19058341e9149e592d9743ea151e9945ab55eb1596d2b2c1e93cbe6333aad5eb3dbee373c2e9fd3ebf63b3eaf6fc564335acd76c3e560",
|
||||
func: testSendUSSD,
|
||||
expect: {name: "send_ussd_cmd_37",
|
||||
commandQualifier: 0x00,
|
||||
title: "ル"}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
284
dom/icc/tests/marionette/test_stk_setup_call.js
Normal file
284
dom/icc/tests/marionette/test_stk_setup_call.js
Normal file
@ -0,0 +1,284 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSetupCall(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_CALL, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
if (command.options.confirmMessage) {
|
||||
is(command.options.confirmMessage, expect.text, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d01e81030110008202818385084e6f7420627573798609911032042143651c2c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
text: "Not busy"}},
|
||||
{command: "d01d81030110028202818385074f6e20686f6c648609911032042143651c2c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_2",
|
||||
commandQualifier: 0x02,
|
||||
text: "On hold"}},
|
||||
{command: "d020810301100482028183850a446973636f6e6e6563748609911032042143651c2c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_3",
|
||||
commandQualifier: 0x04,
|
||||
text: "Disconnect"}},
|
||||
{command: "d02b81030110008202818385114361706162696c69747920636f6e6669678609911032042143651c2c870201a0",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
text: "Capability config"}},
|
||||
{command: "d01c81030110018202818386119110325476981032547698103254769810",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_5",
|
||||
commandQualifier: 0x01}},
|
||||
{command: "d081fd8103011001820281838581ed54687265652074797065732061726520646566696e65643a202d2073657420757020612063616c6c2c20627574206f6e6c79206966206e6f742063757272656e746c792062757379206f6e20616e6f746865722063616c6c3b202d2073657420757020612063616c6c2c2070757474696e6720616c6c206f746865722063616c6c732028696620616e7929206f6e20686f6c643b202d2073657420757020612063616c6c2c20646973636f6e6e656374696e6720616c6c206f746865722063616c6c732028696620616e79292066697273742e20466f722065616368206f662074686573652074797065732c2086029110",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_6",
|
||||
commandQualifier: 0x01,
|
||||
text: "Three types are defined: - set up a call, but only if not currently busy on another call; - set up a call, putting all other calls (if any) on hold; - set up a call, disconnecting all other calls (if any) first. For each of these types, "}},
|
||||
{command: "d02b810301100082028183850c43616c6c65642070617274798609911032042143651c2c880780509595959595",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
text: "Called party"}},
|
||||
{command: "d02281030110018202818385084475726174696f6e8609911032042143651c2c8402010a",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_8",
|
||||
commandQualifier: 0x01,
|
||||
text: "Duration"}},
|
||||
{command: "d028810301100082028183850c434f4e4649524d4154494f4e8609911032042143651c2c850443414c4c",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION"}},
|
||||
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e312e318609911032042143651c2c9e020101",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
text: "Set up call Icon 3.1.1"}},
|
||||
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e322e318609911032042143651c2c9e020001",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
text: "Set up call Icon 3.2.1"}},
|
||||
{command: "d03081030110008202818385165365742075702063616c6c2049636f6e20332e332e318609911032042143651c2c9e020102",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
text: "Set up call Icon 3.3.1"}},
|
||||
{command: "d04c81030110008202818385165365742075702063616c6c2049636f6e20332e342e318609911032042143651c2c9e02000185165365742075702063616c6c2049636f6e20332e342e329e020001",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
text: "Set up call Icon 3.4.1"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e01b4d004000601b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e02b4d004000602b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e04b4d004000604b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 3"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e08b4d004000608b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 3"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e10b4d004000610b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 3"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e20b4d004000620b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 3"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e40b4d004000640b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 3"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e80b4d004000680b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032d004000e00b4d004000600b4",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_36",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20338609911032042143651c2c850643414c4c2033",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_37",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 3"}},
|
||||
{command: "d038810301100082028183850e434f4e4649524d4154494f4e20318609911032042143651c2c850643414c4c2031d004000e00b4d0040006004b",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_38",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 1"}},
|
||||
{command: "d02c810301100082028183850e434f4e4649524d4154494f4e20328609911032042143651c2c850643414c4c2032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_39",
|
||||
commandQualifier: 0x00,
|
||||
text: "CONFIRMATION 2"}},
|
||||
{command: "d02d810301100082028183851980041704140420041004120421042204120423041904220415860791103204214365",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_40",
|
||||
commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d04c810301100082028183851b800417041404200410041204210422041204230419042204150031860791103204214365851b800417041404200410041204210422041204230419042204150032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_41",
|
||||
commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ1"}},
|
||||
{command: "d0198103011000820281838505804e0d5fd9860791103204214365",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_42",
|
||||
commandQualifier: 0x00,
|
||||
text: "不忙"}},
|
||||
{command: "d022810301100082028183850580786e5b9a860791103204214365850780625375358bdd",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_43",
|
||||
commandQualifier: 0x00,
|
||||
text: "确定"}},
|
||||
{command: "d01781030110008202818385038030eb860791103204214365",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_44",
|
||||
commandQualifier: 0x00,
|
||||
text: "ル"}},
|
||||
{command: "d02081030110008202818385058030eb003186079110320421436585058030eb0032",
|
||||
func: testSetupCall,
|
||||
expect: {name: "setup_call_cmd_45",
|
||||
commandQualifier: 0x00,
|
||||
text: "ル1"}},
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
90
dom/icc/tests/marionette/test_stk_setup_event_list.js
Normal file
90
dom/icc/tests/marionette/test_stk_setup_event_list.js
Normal file
@ -0,0 +1,90 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSetupEventList(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_EVENT_LIST, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
for (let index in command.options.eventList) {
|
||||
is(command.options.eventList[index], expect.eventList[index], expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d00c810301050082028182990104",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
eventList: [4]}},
|
||||
{command: "d00d81030105008202818299020507",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
eventList: [5, 7]}},
|
||||
{command: "d00c810301050082028182990107",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
eventList: [7]}},
|
||||
{command: "d00c810301050082028182990107",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
eventList: [7]}},
|
||||
{command: "d00b8103010500820281829900",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
eventList: null}},
|
||||
{command: "d00c810301050082028182990107",
|
||||
func: testSetupEventList,
|
||||
expect: {name: "setup_event_list_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
eventList: [7]}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
233
dom/icc/tests/marionette/test_stk_setup_idle_mode_text.js
Normal file
233
dom/icc/tests/marionette/test_stk_setup_idle_mode_text.js
Normal file
@ -0,0 +1,233 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSetupIdleModeText(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_IDLE_MODE_TEXT, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.text, expect.text, expect.name);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d01a8103012800820281828d0f0449646c65204d6f64652054657874",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text"}},
|
||||
{command: "d0188103012800820281828d0d04546f6f6c6b69742054657374",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
text: "Toolkit Test"}},
|
||||
{command: "d081fd8103012800820281828d81f100547419344d3641737498cd06cdeb70383b0f0a83e8653c1d34a7cbd3ee330b7447a7c768d01c1d66b341e232889c9ec3d9e17c990c12e741747419d42c82c27350d80d4a93d96550fb4d2e83e8653c1d943683e8e832a85904a5e7a0b0985d06d1df20f21b94a6bba8e832082e2fcfcb6e7a989e7ebb41737a9e5d06a5e72076d94c0785e7a0b01b946ec3d9e576d94d0fd3d36f37885c1ea7e7e9b71b447f83e8e832a85904b5c3eeba393ca6d7e565b90b444597416932bb0c6abfc96510bd8ca783e6e8309b0d129741e4f41cce0ee7cb6450da0d0a83da61b7bb2c07d1d1613aa8ec9ed7e5e539888e0ed341ee32",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
text: "The SIM shall supply a text string, which shall be displayed by the ME as an idle mode text if the ME is able to do it.The presentation style is left as an implementation decision to the ME manufacturer. The idle mode text shall be displayed in a manner that ensures that ne"}},
|
||||
{command: "d0198103012800820281828d0a0449646c6520746578749e020001",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle text"}},
|
||||
{command: "d0198103012800820281828d0a0449646c6520746578749e020101",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle text"}},
|
||||
{command: "d0198103012800820281828d0a0449646c6520746578749e020002",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_6",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle text"}},
|
||||
{command: "d0248103012800820281828d1908041704140420041004120421042204120423041904220415",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
text: "ЗДРАВСТВУЙТЕ"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001001b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_10",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001002b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001004b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001008b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001010b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001020b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001040b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001080b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742032d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742033",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 3"}},
|
||||
{command: "d0228103012800820281828d110449646c65204d6f646520546578742031d004001000b4",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_32",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 1"}},
|
||||
{command: "d01c8103012800820281828d110449646c65204d6f646520546578742032",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_33",
|
||||
commandQualifier: 0x00,
|
||||
text: "Idle Mode Text 2"}},
|
||||
{command: "d0108103012800820281828d05084f60597d",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_34",
|
||||
commandQualifier: 0x00,
|
||||
text: "你好"}},
|
||||
{command: "d0148103012800820281828d09080038003030eb0030",
|
||||
func: testSetupIdleModeText,
|
||||
expect: {name: "setup_idle_mode_text_cmd_35",
|
||||
commandQualifier: 0x00,
|
||||
text: "80ル0"}},
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
248
dom/icc/tests/marionette/test_stk_setup_menu.js
Normal file
248
dom/icc/tests/marionette/test_stk_setup_menu.js
Normal file
@ -0,0 +1,248 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
MARIONETTE_TIMEOUT = 30000;
|
||||
|
||||
SpecialPowers.addPermission("mobileconnection", true, document);
|
||||
|
||||
let icc = navigator.mozMobileConnection.icc;
|
||||
ok(icc instanceof MozIccManager, "icc is instanceof " + icc.constructor);
|
||||
|
||||
function testSetupMenu(command, expect) {
|
||||
log("STK CMD " + JSON.stringify(command));
|
||||
is(command.typeOfCommand, icc.STK_CMD_SET_UP_MENU, expect.name);
|
||||
is(command.commandQualifier, expect.commandQualifier, expect.name);
|
||||
is(command.options.title, expect.title, expect.name);
|
||||
for (let index in command.options.items) {
|
||||
is(command.options.items[index].identifier, expect.items[index].identifier, expect.name);
|
||||
is(command.options.items[index].text, expect.items[index].text, expect.name);
|
||||
}
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
let tests = [
|
||||
{command: "d03b810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_1",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
{command: "d023810301250082028182850c546f6f6c6b6974204d656e758f04114f6e658f041254776f",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_2",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 17, text: "One"}, {identifier: 18, text: "Two"}]}},
|
||||
{command: "d081fc810301250082028182850a4c617267654d656e75318f05505a65726f8f044f4f6e658f044e54776f8f064d54687265658f054c466f75728f054b466976658f044a5369788f0649536576656e8f064845696768748f05474e696e658f0646416c7068618f0645427261766f8f0844436861726c69658f064344656c74618f05424563686f8f0941466f782d74726f748f0640426c61636b8f063f42726f776e8f043e5265648f073d4f72616e67658f073c59656c6c6f778f063b477265656e8f053a426c75658f073956696f6c65748f0538477265798f063757686974658f06366d696c6c698f06356d6963726f8f05346e616e6f8f05337069636f",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_3",
|
||||
commandQualifier: 0x00,
|
||||
title: "LargeMenu1",
|
||||
items: [{identifier: 80, text: "Zero"}, {identifier: 79, text: "One"}, {identifier: 78, text: "Two"}, {identifier: 77, text: "Three"}, {identifier: 76, text: "Four"}, {identifier: 75, text: "Five"}, {identifier: 74, text: "Six"}, {identifier: 73, text: "Seven"}, {identifier: 72, text: "Eight"}, {identifier: 71, text: "Nine"}, {identifier: 70, text: "Alpha"}, {identifier: 69, text: "Bravo"}, {identifier: 68, text: "Charlie"}, {identifier: 67, text: "Delta"}, {identifier: 66, text: "Echo"}, {identifier: 65, text: "Fox-trot"}, {identifier: 64, text: "Black"}, {identifier: 63, text: "Brown"}, {identifier: 62, text: "Red"}, {identifier: 61, text: "Orange"}, {identifier: 60, text: "Yellow"}, {identifier: 59, text: "Green"}, {identifier: 58, text: "Blue"}, {identifier: 57, text: "Violet"}, {identifier: 56, text: "Grey"}, {identifier: 55, text: "White"}, {identifier: 54, text: "milli"}, {identifier: 53, text: "micro"}, {identifier: 52, text: "nano"}, {identifier: 51, text: "pico"}]}},
|
||||
{command: "d081f3810301250082028182850a4c617267654d656e75328f1dff312043616c6c20466f727761726420556e636f6e646974696f6e616c8f1cfe322043616c6c20466f7277617264204f6e205573657220427573798f1bfd332043616c6c20466f7277617264204f6e204e6f205265706c798f25fc342043616c6c20466f7277617264204f6e2055736572204e6f7420526561636861626c658f20fb352042617272696e67204f6620416c6c204f7574676f696e672043616c6c738f24fa362042617272696e67204f6620416c6c204f7574676f696e6720496e742043616c6c738f13f93720434c492050726573656e746174696f6e",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_4",
|
||||
commandQualifier: 0x00,
|
||||
title: "LargeMenu2",
|
||||
items: [{identifier: 255, text: "1 Call Forward Unconditional"}, {identifier: 254, text: "2 Call Forward On User Busy"}, {identifier: 253, text: "3 Call Forward On No Reply"}, {identifier: 252, text: "4 Call Forward On User Not Reachable"}, {identifier: 251, text: "5 Barring Of All Outgoing Calls"}, {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"}, {identifier: 249, text: "7 CLI Presentation"}]}},
|
||||
{command: "d081fc8103012500820281828581ec5468652053494d207368616c6c20737570706c79206120736574206f66206d656e75206974656d732c207768696368207368616c6c20626520696e7465677261746564207769746820746865206d656e752073797374656d20286f72206f74686572204d4d4920666163696c6974792920696e206f7264657220746f206769766520746865207573657220746865206f70706f7274756e69747920746f2063686f6f7365206f6e65206f66207468657365206d656e75206974656d7320617420686973206f776e2064697363726574696f6e2e2045616368206974656d20636f6d70726973657320612073688f020159",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_5",
|
||||
commandQualifier: 0x00,
|
||||
title: "The SIM shall supply a set of menu items, which shall be integrated with the menu system (or other MMI facility) in order to give the user the opportunity to choose one of these menu items at his own discretion. Each item comprises a sh",
|
||||
items: [{identifier: 1, text: "Y"}]}},
|
||||
{command: "d03b810301258082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_6",
|
||||
commandQualifier: 0x80,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
{command: "d041810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20338f07044974656d2034180413101526",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_7",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}, {identifier: 4, text: "Item 4"}]}},
|
||||
{command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0201019f0401050505",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_8",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d03c810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d20339e0200019f0400050505",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_9",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d029810301250182028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d2032",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_10",
|
||||
commandQualifier: 0x01,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e00b4d10c000600b4000600b4000600b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_11",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_12",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e01b4d10c000601b4000601b4000601b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_13",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_14",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e02b4d10c000602b4000602b4000602b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_15",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_16",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e04b4d10c000604b4000604b4000604b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_17",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520328f07044974656d20348f07054974656d20358f07064974656d2036d004000e00b4d10c000600b4000600b4000600b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_18",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 2",
|
||||
items: [{identifier: 4, text: "Item 4"}, {identifier: 5, text: "Item 5"}, {identifier: 6, text: "Item 6"}]}},
|
||||
{command: "d034810301250082028182850e546f6f6c6b6974204d656e7520338f07074974656d20378f07084974656d20388f07094974656d2039",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_19",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 3",
|
||||
items: [{identifier: 7, text: "Item 7"}, {identifier: 8, text: "Item 8"}, {identifier: 9, text: "Item 9"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e08b4d10c000608b4000608b4000608b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_20",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e10b4d10c000610b4000610b4000610b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_21",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e20b4d10c000620b4000620b4000620b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_22",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e40b4d10c000640b4000640b4000640b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_23",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d048810301250082028182850e546f6f6c6b6974204d656e7520318f07014974656d20318f07024974656d20328f07034974656d2033d004000e80b4d10c000680b4000680b4000680b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_24",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu 1",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d046810301250082028182850c546f6f6c6b6974204d656e758f07014974656d20318f07024974656d20328f07034974656d2033d004000c00b4d10c000600b4000600b4000600b4",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_25",
|
||||
commandQualifier: 0x00,
|
||||
title: "Toolkit Menu",
|
||||
items: [{identifier: 1, text: "Item 1"}, {identifier: 2, text: "Item 2"}, {identifier: 3, text: "Item 3"}]}},
|
||||
{command: "d0819c8103012500820281828519800417041404200410041204210422041204230419042204158f1c018004170414042004100412042104220412042304190422041500318f1c028004170414042004100412042104220412042304190422041500328f1c038004170414042004100412042104220412042304190422041500338f1c04800417041404200410041204210422041204230419042204150034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_26",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"}, {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"}, {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}, {identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
|
||||
{command: "d0608103012500820281828519800417041404200410041204210422041204230419042204158f1c118004170414042004100412042104220412042304190422041500358f1c12800417041404200410041204210422041204230419042204150036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_27",
|
||||
commandQualifier: 0x00,
|
||||
title: "ЗДРАВСТВУЙТЕ",
|
||||
items: [{identifier: 17, text: "ЗДРАВСТВУЙТЕ5"}, {identifier: 18, text: "ЗДРАВСТВУЙТЕ6"}]}},
|
||||
{command: "d03c8103012500820281828509805de551777bb153558f080180987976ee4e008f080280987976ee4e8c8f080380987976ee4e098f080480987976ee56db",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_28",
|
||||
commandQualifier: 0x00,
|
||||
title: "工具箱单",
|
||||
items: [{identifier: 1, text: "项目一"}, {identifier: 2, text: "项目二"}, {identifier: 3, text: "项目三"}, {identifier: 4, text: "项目四"}]}},
|
||||
{command: "d0208103012500820281828509805de551777bb153558f0411804e008f0412804e8c",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_29",
|
||||
commandQualifier: 0x00,
|
||||
title: "工具箱单",
|
||||
items: [{identifier: 17, text: "一"}, {identifier: 18, text: "二"}]}},
|
||||
{command: "d0448103012500820281828509800038003030eb00308f0a01800038003030eb00318f0a02800038003030eb00328f0a03800038003030eb00338f0a04800038003030eb0034",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_30",
|
||||
commandQualifier: 0x00,
|
||||
title: "80ル0",
|
||||
items: [{identifier: 1, text: "80ル1"}, {identifier: 2, text: "80ル2"}, {identifier: 3, text: "80ル3"}, {identifier: 4, text: "80ル4"}]}},
|
||||
{command: "d02c8103012500820281828509800038003030eb00308f0a11800038003030eb00358f0a12800038003030eb0036",
|
||||
func: testSetupMenu,
|
||||
expect: {name: "setup_menu_cmd_31",
|
||||
commandQualifier: 0x00,
|
||||
title: "80ル0",
|
||||
items: [{identifier: 17, text: "80ル5"}, {identifier: 18, text: "80ル6"}]}}
|
||||
];
|
||||
|
||||
let pendingEmulatorCmdCount = 0;
|
||||
function sendStkPduToEmulator(command, func, expect) {
|
||||
++pendingEmulatorCmdCount;
|
||||
|
||||
runEmulatorCmd(command, function (result) {
|
||||
--pendingEmulatorCmdCount;
|
||||
is(result[0], "OK");
|
||||
});
|
||||
|
||||
icc.onstkcommand = function (evt) {
|
||||
func(evt.command, expect);
|
||||
}
|
||||
}
|
||||
|
||||
function runNextTest() {
|
||||
let test = tests.pop();
|
||||
if (!test) {
|
||||
cleanUp();
|
||||
return;
|
||||
}
|
||||
|
||||
let command = "stk pdu " + test.command;
|
||||
sendStkPduToEmulator(command, test.func, test.expect)
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
if (pendingEmulatorCmdCount) {
|
||||
window.setTimeout(cleanUp, 100);
|
||||
return;
|
||||
}
|
||||
|
||||
SpecialPowers.removePermission("mobileconnection", document);
|
||||
finish();
|
||||
}
|
||||
|
||||
runNextTest();
|
@ -13,8 +13,9 @@
|
||||
#include "nsIRunnable.h"
|
||||
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
#include "mozilla/dom/Nullable.h"
|
||||
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
|
||||
#include "mozilla/dom/IDBVersionChangeEventBinding.h"
|
||||
|
||||
#define SUCCESS_EVT_STR "success"
|
||||
#define ERROR_EVT_STR "error"
|
||||
@ -50,6 +51,23 @@ public:
|
||||
NS_FORWARD_TO_NSDOMEVENT
|
||||
NS_DECL_NSIIDBVERSIONCHANGEEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return mozilla::dom::IDBVersionChangeEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
uint64_t OldVersion()
|
||||
{
|
||||
return mOldVersion;
|
||||
}
|
||||
|
||||
mozilla::dom::Nullable<uint64_t> GetNewVersion()
|
||||
{
|
||||
return mNewVersion
|
||||
? mozilla::dom::Nullable<uint64_t>(mNewVersion)
|
||||
: mozilla::dom::Nullable<uint64_t>();
|
||||
}
|
||||
|
||||
inline static already_AddRefed<nsDOMEvent>
|
||||
Create(mozilla::dom::EventTarget* aOwner,
|
||||
int64_t aOldVersion,
|
||||
@ -101,7 +119,10 @@ public:
|
||||
|
||||
protected:
|
||||
IDBVersionChangeEvent(mozilla::dom::EventTarget* aOwner)
|
||||
: nsDOMEvent(aOwner, nullptr, nullptr) { }
|
||||
: nsDOMEvent(aOwner, nullptr, nullptr)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
virtual ~IDBVersionChangeEvent() { }
|
||||
|
||||
static already_AddRefed<nsDOMEvent>
|
||||
|
@ -18,6 +18,7 @@ interface nsIDOMAttr;
|
||||
interface nsIDOMCDATASection;
|
||||
interface nsIDOMCharacterData;
|
||||
interface nsIDOMComment;
|
||||
interface nsIDOMDOMImplementation;
|
||||
interface nsIDOMDocument;
|
||||
interface nsIDOMDocumentFragment;
|
||||
interface nsIDOMDocumentType;
|
||||
|
@ -9,6 +9,7 @@ XPIDL_SOURCES += [
|
||||
'nsIDOMCharacterData.idl',
|
||||
'nsIDOMComment.idl',
|
||||
'nsIDOMDOMException.idl',
|
||||
'nsIDOMDOMImplementation.idl',
|
||||
'nsIDOMDOMStringList.idl',
|
||||
'nsIDOMDocument.idl',
|
||||
'nsIDOMDocumentFragment.idl',
|
||||
|
42
dom/interfaces/core/nsIDOMDOMImplementation.idl
Normal file
42
dom/interfaces/core/nsIDOMDOMImplementation.idl
Normal file
@ -0,0 +1,42 @@
|
||||
/* -*- 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 "domstubs.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMDOMImplementation interface provides a number of methods for
|
||||
* performing operations that are independent of any particular instance
|
||||
* of the document object model.
|
||||
*
|
||||
* For more information on this interface please see
|
||||
* http://www.w3.org/TR/DOM-Level-2-Core/
|
||||
*/
|
||||
|
||||
[uuid(03a6f574-99ec-42f8-9e6c-812a4a9bcbf7)]
|
||||
interface nsIDOMDOMImplementation : nsISupports
|
||||
{
|
||||
boolean hasFeature(in DOMString feature,
|
||||
in DOMString version);
|
||||
|
||||
nsIDOMDocumentType createDocumentType(in DOMString qualifiedName,
|
||||
in DOMString publicId,
|
||||
in DOMString systemId)
|
||||
raises(DOMException);
|
||||
|
||||
nsIDOMDocument createDocument(in DOMString namespaceURI,
|
||||
in DOMString qualifiedName,
|
||||
in nsIDOMDocumentType doctype)
|
||||
raises(DOMException);
|
||||
|
||||
/**
|
||||
* Returns an HTML document with a basic DOM already constructed and with an
|
||||
* appropriate title element.
|
||||
*
|
||||
* @param title the title of the Document
|
||||
* @see <http://www.whatwg.org/html/#creating-documents>
|
||||
*/
|
||||
nsIDOMDocument createHTMLDocument([Null(Stringify)]
|
||||
in DOMString title);
|
||||
};
|
@ -31,8 +31,7 @@ interface nsIDOMLocation;
|
||||
interface nsIDOMDocument : nsIDOMNode
|
||||
{
|
||||
readonly attribute nsIDOMDocumentType doctype;
|
||||
// DOMImplementation
|
||||
readonly attribute nsISupports implementation;
|
||||
readonly attribute nsIDOMDOMImplementation implementation;
|
||||
readonly attribute nsIDOMElement documentElement;
|
||||
nsIDOMElement createElement([Null(Stringify)] in DOMString tagName)
|
||||
raises(DOMException);
|
||||
|
@ -1,12 +1,7 @@
|
||||
# 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/.
|
||||
Yes = Allow
|
||||
No = Deny
|
||||
Titleline = Internet Security
|
||||
CheckMessage = Remember this decision
|
||||
EnableCapabilityQuery = A script from "%S" is requesting enhanced abilities that are UNSAFE and could be used to compromise your machine or data:\n\n%S\n\nAllow these abilities only if you trust this source to be free of viruses or malicious programs.
|
||||
EnableCapabilityDenied = A script from "%S" was denied %S privileges.
|
||||
CheckLoadURIError = Security Error: Content at %S may not load or link to %S.
|
||||
CheckSameOriginError = Security Error: Content at %S may not load data from %S.
|
||||
|
||||
@ -114,9 +109,4 @@ SetPropertyDeniedOriginsOnlySubject = Permission denied for <%S> to set property
|
||||
CallMethodDeniedOriginsOnlySubject = Permission denied for <%S> to call method %S.%S
|
||||
CreateWrapperDenied = Permission denied to create wrapper for object of class %S
|
||||
CreateWrapperDeniedForOrigin = Permission denied for <%2$S> to create wrapper for object of class %1$S
|
||||
ExtensionCapability = Unknown: %S
|
||||
ProtocolFlagError = Warning: Protocol handler for '%S' doesn't advertise a security policy. While loading of such protocols is allowed for now, this is deprecated. Please see the documentation in nsIProtocolHandler.idl.
|
||||
#
|
||||
# The following descriptions are shown in the EnableCapabilityQuery dialog
|
||||
#
|
||||
capdesc.UniversalXPConnect = Run or install software on your machine
|
||||
|
@ -18,11 +18,6 @@ MODULE_NAME = javascript__protocol
|
||||
GRE_MODULE = 1
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
XPIDLSRCS = \
|
||||
$(NULL)
|
||||
|
||||
|
||||
CPPSRCS = nsJSProtocolHandler.cpp
|
||||
|
||||
EXPORTS = $(srcdir)/nsJSProtocolHandler.h
|
||||
|
@ -28,6 +28,9 @@
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
// Write Ahead Log's maximum size is 512KB
|
||||
#define MAX_WAL_SIZE_BYTES 512 * 1024
|
||||
|
||||
namespace {
|
||||
|
||||
/**
|
||||
@ -107,7 +110,7 @@ nsDOMStoragePersistentDB::Flush()
|
||||
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_TIMER_FLUSH_MS> timer;
|
||||
|
||||
// Make the flushes atomic
|
||||
mozStorageTransaction transaction(mConnection, false);
|
||||
mozStorageTransaction transaction(mWriteConnection, false);
|
||||
|
||||
nsresult rv;
|
||||
for (uint32_t i = 0; i < mFlushStatements.Length(); ++i) {
|
||||
@ -178,8 +181,8 @@ nsReverseStringSQLFunction::OnFunctionCall(
|
||||
}
|
||||
|
||||
nsDOMStoragePersistentDB::nsDOMStoragePersistentDB()
|
||||
: mStatements(mConnection), mWasRemoveAllCalled(false),
|
||||
mIsRemoveAllPending(false), mIsFlushPending(false)
|
||||
: mReadStatements(mReadConnection), mWriteStatements(mWriteConnection),
|
||||
mWasRemoveAllCalled(false), mIsRemoveAllPending(false), mIsFlushPending(false)
|
||||
{
|
||||
mQuotaUseByUncached.Init(16);
|
||||
}
|
||||
@ -198,12 +201,12 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
|
||||
|
||||
service = do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = service->OpenUnsharedDatabase(storageFile, getter_AddRefs(mConnection));
|
||||
rv = service->OpenUnsharedDatabase(storageFile, getter_AddRefs(mWriteConnection));
|
||||
if (rv == NS_ERROR_FILE_CORRUPTED) {
|
||||
// delete the db and try opening again
|
||||
rv = storageFile->Remove(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = service->OpenUnsharedDatabase(storageFile, getter_AddRefs(mConnection));
|
||||
rv = service->OpenUnsharedDatabase(storageFile, getter_AddRefs(mWriteConnection));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -217,6 +220,8 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
|
||||
// Spawn helper thread
|
||||
rv = ::NS_NewNamedThread("DOM Storage", getter_AddRefs(mFlushThread));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = ConfigureWalBehavior();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
} else {
|
||||
// Shared-memory WAL might not be supported on this platform, so fall back
|
||||
// to truncate mode and reads+writes on the main thread.
|
||||
@ -224,10 +229,14 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
mozStorageTransaction transaction(mConnection, false);
|
||||
// Create a read-only clone
|
||||
(void)mWriteConnection->Clone(true, getter_AddRefs(mReadConnection));
|
||||
NS_ENSURE_TRUE(mReadConnection, NS_ERROR_FAILURE);
|
||||
|
||||
mozStorageTransaction transaction(mWriteConnection, false);
|
||||
|
||||
// Ensure Gecko 1.9.1 storage table
|
||||
rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
"CREATE TABLE IF NOT EXISTS webappsstore2 ("
|
||||
"scope TEXT, "
|
||||
"key TEXT, "
|
||||
@ -236,7 +245,7 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
|
||||
"owner TEXT)"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
|
||||
"CREATE UNIQUE INDEX IF NOT EXISTS scope_key_index"
|
||||
" ON webappsstore2(scope, key)"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -244,7 +253,7 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
|
||||
nsCOMPtr<mozIStorageFunction> function1(new nsReverseStringSQLFunction());
|
||||
NS_ENSURE_TRUE(function1, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
rv = mConnection->CreateFunction(NS_LITERAL_CSTRING("REVERSESTRING"), 1, function1);
|
||||
rv = mWriteConnection->CreateFunction(NS_LITERAL_CSTRING("REVERSESTRING"), 1, function1);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Check if there is storage of Gecko 1.9.0 and if so, upgrade that storage
|
||||
@ -252,19 +261,19 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
|
||||
// this newer table upgrade to priority potential duplicates from older
|
||||
// storage table.
|
||||
bool exists;
|
||||
rv = mConnection->TableExists(NS_LITERAL_CSTRING("webappsstore"),
|
||||
&exists);
|
||||
rv = mWriteConnection->TableExists(NS_LITERAL_CSTRING("webappsstore"),
|
||||
&exists);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (exists) {
|
||||
rv = mConnection->ExecuteSimpleSQL(
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(
|
||||
NS_LITERAL_CSTRING("INSERT OR IGNORE INTO "
|
||||
"webappsstore2(scope, key, value, secure, owner) "
|
||||
"SELECT REVERSESTRING(domain) || '.:', key, value, secure, owner "
|
||||
"FROM webappsstore"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mConnection->ExecuteSimpleSQL(
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(
|
||||
NS_LITERAL_CSTRING("DROP TABLE webappsstore"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -272,19 +281,19 @@ nsDOMStoragePersistentDB::Init(const nsString& aDatabaseName)
|
||||
// Check if there is storage of Gecko 1.8 and if so, upgrade that storage
|
||||
// to actual webappsstore2 table and drop the obsolete table. Potential
|
||||
// duplicates will be ignored.
|
||||
rv = mConnection->TableExists(NS_LITERAL_CSTRING("moz_webappsstore"),
|
||||
&exists);
|
||||
rv = mWriteConnection->TableExists(NS_LITERAL_CSTRING("moz_webappsstore"),
|
||||
&exists);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (exists) {
|
||||
rv = mConnection->ExecuteSimpleSQL(
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(
|
||||
NS_LITERAL_CSTRING("INSERT OR IGNORE INTO "
|
||||
"webappsstore2(scope, key, value, secure, owner) "
|
||||
"SELECT REVERSESTRING(domain) || '.:', key, value, secure, domain "
|
||||
"FROM moz_webappsstore"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mConnection->ExecuteSimpleSQL(
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(
|
||||
NS_LITERAL_CSTRING("DROP TABLE moz_webappsstore"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
@ -307,7 +316,7 @@ nsDOMStoragePersistentDB::SetJournalMode(bool aIsWal)
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
nsresult rv = mConnection->CreateStatement(stmtString, getter_AddRefs(stmt));
|
||||
nsresult rv = mWriteConnection->CreateStatement(stmtString, getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasResult = false;
|
||||
@ -328,6 +337,43 @@ nsDOMStoragePersistentDB::SetJournalMode(bool aIsWal)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsDOMStoragePersistentDB::ConfigureWalBehavior()
|
||||
{
|
||||
// Get the DB's page size
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
nsresult rv = mWriteConnection->CreateStatement(NS_LITERAL_CSTRING(
|
||||
MOZ_STORAGE_UNIQUIFY_QUERY_STR "PRAGMA page_size"
|
||||
), getter_AddRefs(stmt));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bool hasResult = false;
|
||||
rv = stmt->ExecuteStep(&hasResult);
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && hasResult, NS_ERROR_FAILURE);
|
||||
|
||||
int32_t pageSize = 0;
|
||||
rv = stmt->GetInt32(0, &pageSize);
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(rv) && pageSize > 0, NS_ERROR_UNEXPECTED);
|
||||
|
||||
// Set the threshold for auto-checkpointing the WAL.
|
||||
// We don't want giant logs slowing down reads & shutdown.
|
||||
int32_t thresholdInPages = static_cast<int32_t>(MAX_WAL_SIZE_BYTES / pageSize);
|
||||
nsAutoCString thresholdPragma("PRAGMA wal_autocheckpoint = ");
|
||||
thresholdPragma.AppendInt(thresholdInPages);
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(thresholdPragma);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Set the maximum WAL log size to reduce footprint on mobile (large empty
|
||||
// WAL files will be truncated)
|
||||
nsAutoCString journalSizePragma("PRAGMA journal_size_limit = ");
|
||||
// bug 600307: mak recommends setting this to 3 times the auto-checkpoint threshold
|
||||
journalSizePragma.AppendInt(MAX_WAL_SIZE_BYTES * 3);
|
||||
rv = mWriteConnection->ExecuteSimpleSQL(journalSizePragma);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsDOMStoragePersistentDB::Close()
|
||||
{
|
||||
@ -338,8 +384,10 @@ nsDOMStoragePersistentDB::Close()
|
||||
|
||||
mFlushStatements.Clear();
|
||||
mFlushStatementParams.Clear();
|
||||
mStatements.FinalizeStatements();
|
||||
mConnection->Close();
|
||||
mReadStatements.FinalizeStatements();
|
||||
mWriteStatements.FinalizeStatements();
|
||||
mReadConnection->Close();
|
||||
mWriteConnection->Close();
|
||||
|
||||
// The cache has already been force-flushed
|
||||
DOMStorageImpl::gStorageDB->StopCacheFlushTimer();
|
||||
@ -366,7 +414,7 @@ nsDOMStoragePersistentDB::FetchScope(DOMStorageImpl* aStorage,
|
||||
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_FETCH_DOMAIN_MS> timer;
|
||||
|
||||
// Get the keys for the requested scope
|
||||
nsCOMPtr<mozIStorageStatement> keysStmt = mStatements.GetCachedStatement(
|
||||
nsCOMPtr<mozIStorageStatement> keysStmt = mReadStatements.GetCachedStatement(
|
||||
"SELECT key, value, secure FROM webappsstore2"
|
||||
" WHERE scope = :scopeKey"
|
||||
);
|
||||
@ -442,7 +490,7 @@ nsDOMStoragePersistentDB::EnsureQuotaUsageLoaded(const nsACString& aQuotaKey)
|
||||
|
||||
// Fetch information about all the scopes belonging to this site
|
||||
nsCOMPtr<mozIStorageStatement> stmt;
|
||||
stmt = mStatements.GetCachedStatement(
|
||||
stmt = mReadStatements.GetCachedStatement(
|
||||
"SELECT scope, SUM(LENGTH(key) + LENGTH(value)) "
|
||||
"FROM ( "
|
||||
"SELECT scope, key, value FROM webappsstore2 "
|
||||
@ -613,21 +661,21 @@ nsDOMStoragePersistentDB::PrepareFlushStatements(const FlushData& aDirtyData)
|
||||
mFlushStatements.Clear();
|
||||
mFlushStatementParams.Clear();
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> removeAllStmt = mStatements.GetCachedStatement(
|
||||
nsCOMPtr<mozIStorageStatement> removeAllStmt = mWriteStatements.GetCachedStatement(
|
||||
NS_LITERAL_CSTRING("DELETE FROM webappsstore2"));
|
||||
NS_ENSURE_STATE(removeAllStmt);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> deleteScopeStmt = mStatements.GetCachedStatement(
|
||||
nsCOMPtr<mozIStorageStatement> deleteScopeStmt = mWriteStatements.GetCachedStatement(
|
||||
NS_LITERAL_CSTRING("DELETE FROM webappsstore2"
|
||||
" WHERE scope = :scope"));
|
||||
NS_ENSURE_STATE(deleteScopeStmt);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> deleteKeyStmt = mStatements.GetCachedStatement(
|
||||
nsCOMPtr<mozIStorageStatement> deleteKeyStmt = mWriteStatements.GetCachedStatement(
|
||||
NS_LITERAL_CSTRING("DELETE FROM webappsstore2"
|
||||
" WHERE scope = :scope AND key = :key"));
|
||||
NS_ENSURE_STATE(deleteKeyStmt);
|
||||
|
||||
nsCOMPtr<mozIStorageStatement> insertKeyStmt = mStatements.GetCachedStatement(
|
||||
nsCOMPtr<mozIStorageStatement> insertKeyStmt = mWriteStatements.GetCachedStatement(
|
||||
NS_LITERAL_CSTRING("INSERT OR REPLACE INTO webappsstore2 (scope, key, value, secure)"
|
||||
" VALUES (:scope, :key, :value, :secure)"));
|
||||
NS_ENSURE_STATE(insertKeyStmt);
|
||||
@ -957,7 +1005,7 @@ InvalidateMatchingQuotaEnum(const nsACString& aQuotaKey,
|
||||
nsresult
|
||||
nsDOMStoragePersistentDB::FetchMatchingScopeNames(const nsACString& aPattern)
|
||||
{
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mStatements.GetCachedStatement(
|
||||
nsCOMPtr<mozIStorageStatement> stmt = mReadStatements.GetCachedStatement(
|
||||
"SELECT DISTINCT(scope) FROM webappsstore2"
|
||||
" WHERE scope LIKE :scope"
|
||||
);
|
||||
|
@ -176,6 +176,12 @@ private:
|
||||
nsresult
|
||||
SetJournalMode(bool aIsWal);
|
||||
|
||||
/**
|
||||
* Sets the threshold for auto-checkpointing the WAL.
|
||||
*/
|
||||
nsresult
|
||||
ConfigureWalBehavior();
|
||||
|
||||
/**
|
||||
* Ensures that the scope's keys are cached.
|
||||
*/
|
||||
@ -235,8 +241,10 @@ private:
|
||||
*/
|
||||
nsTArray<nsCOMPtr<mozIStorageStatement> > mFlushStatements;
|
||||
nsTArray<nsCOMPtr<mozIStorageBindingParamsArray> > mFlushStatementParams;
|
||||
StatementCache mStatements;
|
||||
nsCOMPtr<mozIStorageConnection> mConnection;
|
||||
StatementCache mReadStatements;
|
||||
StatementCache mWriteStatements;
|
||||
nsCOMPtr<mozIStorageConnection> mReadConnection;
|
||||
nsCOMPtr<mozIStorageConnection> mWriteConnection;
|
||||
|
||||
/**
|
||||
* Cache state data
|
||||
|
@ -62,11 +62,11 @@ function test() {
|
||||
HTML_TAG("html", "Html")
|
||||
HTML_TAG("i", "Span")
|
||||
HTML_TAG("iframe", "IFrame")
|
||||
HTML_TAG("image", "Span")
|
||||
HTML_TAG("image", "")
|
||||
HTML_TAG("img", "Image")
|
||||
HTML_TAG("input", "Input")
|
||||
HTML_TAG("ins", "Mod")
|
||||
HTML_TAG("isindex", "Shared")
|
||||
HTML_TAG("isindex", "Unknown")
|
||||
HTML_TAG("kbd", "Span")
|
||||
HTML_TAG("keygen", "Span")
|
||||
HTML_TAG("label", "Label")
|
||||
@ -78,7 +78,7 @@ function test() {
|
||||
HTML_TAG("marquee", "Div")
|
||||
HTML_TAG("menu", "Shared")
|
||||
HTML_TAG("meta", "Meta")
|
||||
HTML_TAG("multicol", "Span")
|
||||
HTML_TAG("multicol", "Unknown")
|
||||
HTML_TAG("nobr", "Span")
|
||||
HTML_TAG("noembed", "Div")
|
||||
HTML_TAG("noframes", "Div")
|
||||
@ -97,7 +97,7 @@ function test() {
|
||||
HTML_TAG("script", "Script")
|
||||
HTML_TAG("select", "Select")
|
||||
HTML_TAG("small", "Span")
|
||||
HTML_TAG("spacer", "Shared")
|
||||
HTML_TAG("spacer", "Unknown")
|
||||
HTML_TAG("span", "Span")
|
||||
HTML_TAG("strike", "Span")
|
||||
HTML_TAG("strong", "Span")
|
||||
|
@ -41,7 +41,7 @@ HTML_TAG("b", "Span")
|
||||
HTML_TAG("base", "Shared")
|
||||
HTML_TAG("basefont", "Span")
|
||||
HTML_TAG("bdo", "Span")
|
||||
HTML_TAG("bgsound", "Span")
|
||||
HTML_TAG("bgsound", "Unknown")
|
||||
HTML_TAG("big", "Span")
|
||||
HTML_TAG("blink", "Span")
|
||||
HTML_TAG("blockquote", "Shared")
|
||||
@ -80,11 +80,11 @@ HTML_TAG("hr", "HR")
|
||||
HTML_TAG("html", "Html")
|
||||
HTML_TAG("i", "Span")
|
||||
HTML_TAG("iframe", "IFrame")
|
||||
HTML_TAG("image", "Span")
|
||||
HTML_TAG("image", "")
|
||||
HTML_TAG("img", "Image")
|
||||
HTML_TAG("input", "Input")
|
||||
HTML_TAG("ins", "Mod")
|
||||
HTML_TAG("isindex", "Shared")
|
||||
HTML_TAG("isindex", "Unknown")
|
||||
HTML_TAG("kbd", "Span")
|
||||
HTML_TAG("keygen", "Span")
|
||||
HTML_TAG("label", "Label")
|
||||
@ -96,7 +96,7 @@ HTML_TAG("map", "Map")
|
||||
HTML_TAG("marquee", "Div")
|
||||
HTML_TAG("menu", "Shared")
|
||||
HTML_TAG("meta", "Meta")
|
||||
HTML_TAG("multicol", "Span")
|
||||
HTML_TAG("multicol", "Unknown")
|
||||
HTML_TAG("nobr", "Span")
|
||||
HTML_TAG("noembed", "Div")
|
||||
HTML_TAG("noframes", "Div")
|
||||
@ -115,7 +115,7 @@ HTML_TAG("samp", "Span")
|
||||
HTML_TAG("script", "Script")
|
||||
HTML_TAG("select", "Select")
|
||||
HTML_TAG("small", "Span")
|
||||
HTML_TAG("spacer", "Shared")
|
||||
HTML_TAG("spacer", "Unknown")
|
||||
HTML_TAG("span", "Span")
|
||||
HTML_TAG("strike", "Span")
|
||||
HTML_TAG("strong", "Span")
|
||||
|
16
dom/webidl/IDBVersionChangeEvent.webidl
Normal file
16
dom/webidl/IDBVersionChangeEvent.webidl
Normal file
@ -0,0 +1,16 @@
|
||||
/* -*- 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/.
|
||||
*
|
||||
* IDBVersionChangeEvent is defined in:
|
||||
* https://dvcs.w3.org/hg/IndexedDB/raw-file/tip/Overview.html
|
||||
*
|
||||
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||
* liability, trademark and document use rules apply.
|
||||
*/
|
||||
|
||||
interface IDBVersionChangeEvent : Event {
|
||||
readonly attribute unsigned long long oldVersion;
|
||||
readonly attribute unsigned long long? newVersion;
|
||||
};
|
@ -116,6 +116,7 @@ webidl_files = \
|
||||
HTMLTimeElement.webidl \
|
||||
HTMLTitleElement.webidl \
|
||||
HTMLUListElement.webidl \
|
||||
IDBVersionChangeEvent.webidl \
|
||||
ImageData.webidl \
|
||||
LinkStyle.webidl \
|
||||
LocalMediaStream.webidl \
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsSandboxFlags.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "xpcpublic.h"
|
||||
@ -2444,6 +2445,18 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent,
|
||||
if (aParent) {
|
||||
aParent->AssertIsOnWorkerThread();
|
||||
|
||||
// If the parent is going away give up now.
|
||||
Status currentStatus;
|
||||
{
|
||||
MutexAutoLock lock(aParent->mMutex);
|
||||
currentStatus = aParent->mStatus;
|
||||
}
|
||||
|
||||
if (currentStatus > Running) {
|
||||
JS_ReportError(aCx, "Cannot create child workers from the close handler!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
parentContext = aCx;
|
||||
|
||||
// Domain is the only thing we can touch here. The rest will be handled by
|
||||
@ -2608,6 +2621,30 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent,
|
||||
rv =
|
||||
scriptloader::ChannelFromScriptURLWorkerThread(aCx, aParent, scriptURL,
|
||||
getter_AddRefs(channel));
|
||||
|
||||
// Now that we've spun the loop there's no guarantee that our parent is
|
||||
// still alive. We may have received control messages initiating shutdown.
|
||||
|
||||
Status currentStatus;
|
||||
{
|
||||
MutexAutoLock lock(aParent->mMutex);
|
||||
currentStatus = aParent->mStatus;
|
||||
}
|
||||
|
||||
if (currentStatus > Running) {
|
||||
nsCOMPtr<nsIThread> mainThread;
|
||||
NS_GetMainThread(getter_AddRefs(mainThread));
|
||||
if (!mainThread) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
nsIChannel* rawChannel;
|
||||
channel.forget(&rawChannel);
|
||||
// If this fails we accept the leak.
|
||||
NS_ProxyRelease(mainThread, rawChannel);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
rv =
|
||||
@ -3272,16 +3309,17 @@ WorkerPrivate::AddChildWorker(JSContext* aCx, ParentType* aChildWorker)
|
||||
{
|
||||
AssertIsOnWorkerThread();
|
||||
|
||||
Status currentStatus;
|
||||
#ifdef DEBUG
|
||||
{
|
||||
Status currentStatus;
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
currentStatus = mStatus;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentStatus > Running) {
|
||||
JS_ReportError(aCx, "Cannot create child workers from the close handler!");
|
||||
return false;
|
||||
MOZ_ASSERT(currentStatus == Running);
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(!mChildWorkers.Contains(aChildWorker),
|
||||
"Already know about this one!");
|
||||
|
@ -4,6 +4,13 @@
|
||||
*/
|
||||
onclose = function() {
|
||||
postMessage("closed");
|
||||
// Try to open a new worker.
|
||||
try {
|
||||
var worker = new Worker("close_worker.js");
|
||||
throw new Error("We shouldn't get here!");
|
||||
} catch (e) {
|
||||
// pass
|
||||
}
|
||||
};
|
||||
|
||||
setTimeout(function () {
|
||||
|
@ -1,5 +1,9 @@
|
||||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
msg = null;
|
||||
var errors = 6;
|
||||
var errors = 5;
|
||||
|
||||
onerror = function(event) {
|
||||
ok(true, msg);
|
||||
@ -35,7 +39,12 @@ worker.onmessage = function(event) {
|
||||
}
|
||||
|
||||
msg = "Loading data:something";
|
||||
worker = new Worker("data:application/javascript;base64,ZHVtcCgnaGVsbG8gd29ybGQnKQo=");
|
||||
worker = new Worker("javascript:dump(123);");
|
||||
try {
|
||||
worker = new Worker("data:application/javascript;base64,ZHVtcCgnaGVsbG8gd29ybGQnKQo=");
|
||||
ok(false, "Should have thrown!");
|
||||
} catch (e) {
|
||||
ok(true, "Threw as expected.");
|
||||
}
|
||||
|
||||
worker = new Worker("javascript:dump(123);");
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
@ -2201,8 +2201,8 @@ DrawTargetD2D::CreateBrushForPattern(const Pattern &aPattern, Float aAlpha)
|
||||
|
||||
// This will not be a complex radial gradient brush.
|
||||
mRT->CreateRadialGradientBrush(
|
||||
D2D1::RadialGradientBrushProperties(D2DPoint(pat->mCenter1),
|
||||
D2D1::Point2F(),
|
||||
D2D1::RadialGradientBrushProperties(D2DPoint(pat->mCenter2),
|
||||
D2DPoint(pat->mCenter1 - pat->mCenter2),
|
||||
pat->mRadius2, pat->mRadius2),
|
||||
D2D1::BrushProperties(aAlpha, D2DMatrix(pat->mMatrix)),
|
||||
stops->mStopCollection,
|
||||
|
@ -32,7 +32,8 @@ FrozenImage::DecrementAnimationConsumers()
|
||||
NS_IMETHODIMP
|
||||
FrozenImage::GetAnimated(bool* aAnimated)
|
||||
{
|
||||
nsresult rv = InnerImage()->GetAnimated(aAnimated);
|
||||
bool dummy;
|
||||
nsresult rv = InnerImage()->GetAnimated(&dummy);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aAnimated = false;
|
||||
}
|
||||
|
@ -135,7 +135,6 @@ struct RuntimeSizes
|
||||
size_t stack;
|
||||
size_t gcMarker;
|
||||
size_t mathCache;
|
||||
size_t scriptFilenames;
|
||||
size_t scriptData;
|
||||
size_t scriptSources;
|
||||
};
|
||||
|
@ -16,8 +16,8 @@
|
||||
|
||||
#include <limits> /* for std::numeric_limits */
|
||||
|
||||
#include "gc/Root.h"
|
||||
#include "js/Anchor.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "js/Utility.h"
|
||||
|
||||
namespace JS { class Value; }
|
||||
|
@ -176,16 +176,12 @@ INSTALLED_HEADERS = \
|
||||
# BEGIN exported headers that are only exported
|
||||
# because of inclusion by an INSTALLED_HEADER
|
||||
#
|
||||
EXPORTS_NAMESPACES += ds gc
|
||||
EXPORTS_NAMESPACES += ds
|
||||
|
||||
EXPORTS_ds = \
|
||||
BitArray.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS_gc = \
|
||||
Root.h \
|
||||
$(NULL)
|
||||
|
||||
######################################################
|
||||
# BEGIN include exported headers from the JS engine
|
||||
#
|
||||
@ -212,6 +208,7 @@ EXPORTS_js = \
|
||||
MemoryMetrics.h \
|
||||
PropertyKey.h \
|
||||
RequiredDefines.h \
|
||||
RootingAPI.h \
|
||||
TemplateLib.h \
|
||||
Utility.h \
|
||||
Value.h \
|
||||
@ -585,6 +582,14 @@ distclean clean::
|
||||
endif
|
||||
endif
|
||||
|
||||
# ICU headers need to be available whether we build with the complete
|
||||
# Internationalization API or not - ICU stubs rely on them.
|
||||
|
||||
LOCAL_INCLUDES += \
|
||||
-I$(topsrcdir)/../../intl/icu/source/common \
|
||||
-I$(topsrcdir)/../../intl/icu/source/i18n \
|
||||
$(NULL)
|
||||
|
||||
# The "find any vanilla new/new[] calls" script is tailored to Linux, so
|
||||
# only run it there. That should be enough to catch any such calls that
|
||||
# creep in.
|
||||
|
@ -43,9 +43,9 @@
|
||||
#include "jsfriendapi.h"
|
||||
#include "jsopcode.h"
|
||||
|
||||
#include "gc/Root.h"
|
||||
#include "methodjit/Logging.h"
|
||||
#include "ion/IonSpewer.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "methodjit/Logging.h"
|
||||
|
||||
#define PRETTY_PRINT_OFFSET(os) (((os)<0)?"-":""), (((os)<0)?-(os):(os))
|
||||
|
||||
|
@ -21,8 +21,378 @@
|
||||
|
||||
#include "jsobjinlines.h"
|
||||
|
||||
#include "unicode/utypes.h"
|
||||
|
||||
using namespace js;
|
||||
|
||||
|
||||
/******************** ICU stubs ********************/
|
||||
|
||||
#if !ENABLE_INTL_API
|
||||
|
||||
/*
|
||||
* When the Internationalization API isn't enabled, we also shouldn't link
|
||||
* against ICU. However, we still want to compile this code in order to prevent
|
||||
* bit rot. The following stub implementations for ICU functions make this
|
||||
* possible. The functions using them should never be called, so they assert
|
||||
* and return error codes. Signatures adapted from ICU header files locid.h,
|
||||
* numsys.h, ucal.h, ucol.h, udat.h, udatpg.h, uenum.h, unum.h; see the ICU
|
||||
* directory for license.
|
||||
*/
|
||||
|
||||
static int32_t
|
||||
u_strlen(const UChar *s)
|
||||
{
|
||||
MOZ_NOT_REACHED("u_strlen: Intl API disabled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct UEnumeration;
|
||||
|
||||
static int32_t
|
||||
uenum_count(UEnumeration *en, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("uenum_count: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
uenum_next(UEnumeration *en, int32_t *resultLength, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("uenum_next: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
uenum_close(UEnumeration *en)
|
||||
{
|
||||
MOZ_NOT_REACHED("uenum_close: Intl API disabled");
|
||||
}
|
||||
|
||||
struct UCollator;
|
||||
|
||||
enum UColAttribute {
|
||||
UCOL_ALTERNATE_HANDLING,
|
||||
UCOL_CASE_FIRST,
|
||||
UCOL_CASE_LEVEL,
|
||||
UCOL_NORMALIZATION_MODE,
|
||||
UCOL_STRENGTH,
|
||||
UCOL_NUMERIC_COLLATION,
|
||||
};
|
||||
|
||||
enum UColAttributeValue {
|
||||
UCOL_DEFAULT = -1,
|
||||
UCOL_PRIMARY = 0,
|
||||
UCOL_SECONDARY = 1,
|
||||
UCOL_TERTIARY = 2,
|
||||
UCOL_OFF = 16,
|
||||
UCOL_ON = 17,
|
||||
UCOL_SHIFTED = 20,
|
||||
UCOL_LOWER_FIRST = 24,
|
||||
UCOL_UPPER_FIRST = 25,
|
||||
};
|
||||
|
||||
enum UCollationResult {
|
||||
UCOL_EQUAL = 0,
|
||||
UCOL_GREATER = 1,
|
||||
UCOL_LESS = -1
|
||||
};
|
||||
|
||||
static int32_t
|
||||
ucol_countAvailable(void)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucol_countAvailable: Intl API disabled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
ucol_getAvailable(int32_t localeIndex)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucol_getAvailable: Intl API disabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static UCollator *
|
||||
ucol_open(const char *loc, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucol_open: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
ucol_setAttribute(UCollator *coll, UColAttribute attr, UColAttributeValue value, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucol_setAttribute: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
}
|
||||
|
||||
static UCollationResult
|
||||
ucol_strcoll(const UCollator *coll, const UChar *source, int32_t sourceLength,
|
||||
const UChar *target, int32_t targetLength)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucol_strcoll: Intl API disabled");
|
||||
return (UCollationResult) 0;
|
||||
}
|
||||
|
||||
static void
|
||||
ucol_close(UCollator *coll)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucol_close: Intl API disabled");
|
||||
}
|
||||
|
||||
static UEnumeration *
|
||||
ucol_getKeywordValuesForLocale(const char *key, const char *locale, UBool commonlyUsed,
|
||||
UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucol_getKeywordValuesForLocale: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct UParseError;
|
||||
struct UFieldPosition;
|
||||
typedef void *UNumberFormat;
|
||||
|
||||
enum UNumberFormatStyle {
|
||||
UNUM_DECIMAL = 1,
|
||||
UNUM_CURRENCY,
|
||||
UNUM_PERCENT,
|
||||
UNUM_CURRENCY_ISO,
|
||||
UNUM_CURRENCY_PLURAL,
|
||||
};
|
||||
|
||||
enum UNumberFormatAttribute {
|
||||
UNUM_GROUPING_USED,
|
||||
UNUM_MIN_INTEGER_DIGITS,
|
||||
UNUM_MAX_FRACTION_DIGITS,
|
||||
UNUM_MIN_FRACTION_DIGITS,
|
||||
UNUM_SIGNIFICANT_DIGITS_USED,
|
||||
UNUM_MIN_SIGNIFICANT_DIGITS,
|
||||
UNUM_MAX_SIGNIFICANT_DIGITS,
|
||||
};
|
||||
|
||||
enum UNumberFormatTextAttribute {
|
||||
UNUM_CURRENCY_CODE,
|
||||
};
|
||||
|
||||
static int32_t
|
||||
unum_countAvailable(void)
|
||||
{
|
||||
MOZ_NOT_REACHED("unum_countAvailable: Intl API disabled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
unum_getAvailable(int32_t localeIndex)
|
||||
{
|
||||
MOZ_NOT_REACHED("unum_getAvailable: Intl API disabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static UNumberFormat *
|
||||
unum_open(UNumberFormatStyle style, const UChar *pattern, int32_t patternLength,
|
||||
const char *locale, UParseError *parseErr, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("unum_open: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
unum_setAttribute(UNumberFormat *fmt, UNumberFormatAttribute attr, int32_t newValue)
|
||||
{
|
||||
MOZ_NOT_REACHED("unum_setAttribute: Intl API disabled");
|
||||
}
|
||||
|
||||
static int32_t
|
||||
unum_formatDouble(const UNumberFormat *fmt, double number, UChar *result,
|
||||
int32_t resultLength, UFieldPosition *pos, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("unum_formatDouble: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
unum_close(UNumberFormat *fmt)
|
||||
{
|
||||
MOZ_NOT_REACHED("unum_close: Intl API disabled");
|
||||
}
|
||||
|
||||
static void
|
||||
unum_setTextAttribute(UNumberFormat *fmt, UNumberFormatTextAttribute tag, const UChar *newValue,
|
||||
int32_t newValueLength, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("unum_setTextAttribute: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
}
|
||||
|
||||
class Locale {
|
||||
public:
|
||||
Locale(const char *language, const char *country = 0, const char *variant = 0,
|
||||
const char *keywordsAndValues = 0);
|
||||
};
|
||||
|
||||
Locale::Locale(const char *language, const char *country, const char *variant,
|
||||
const char *keywordsAndValues)
|
||||
{
|
||||
MOZ_NOT_REACHED("Locale::Locale: Intl API disabled");
|
||||
}
|
||||
|
||||
class NumberingSystem {
|
||||
public:
|
||||
static NumberingSystem *createInstance(const Locale &inLocale, UErrorCode &status);
|
||||
const char *getName();
|
||||
};
|
||||
|
||||
NumberingSystem *
|
||||
NumberingSystem::createInstance(const Locale &inLocale, UErrorCode &status)
|
||||
{
|
||||
MOZ_NOT_REACHED("NumberingSystem::createInstance: Intl API disabled");
|
||||
status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
NumberingSystem::getName()
|
||||
{
|
||||
MOZ_NOT_REACHED("NumberingSystem::getName: Intl API disabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef void *UCalendar;
|
||||
|
||||
enum UCalendarType {
|
||||
UCAL_TRADITIONAL,
|
||||
UCAL_DEFAULT = UCAL_TRADITIONAL,
|
||||
UCAL_GREGORIAN
|
||||
};
|
||||
|
||||
static UCalendar *
|
||||
ucal_open(const UChar *zoneID, int32_t len, const char *locale,
|
||||
UCalendarType type, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucal_open: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const char *
|
||||
ucal_getType(const UCalendar *cal, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucal_getType: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static UEnumeration *
|
||||
ucal_getKeywordValuesForLocale(const char *key, const char *locale,
|
||||
UBool commonlyUsed, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucal_getKeywordValuesForLocale: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
ucal_close(UCalendar *cal)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucal_close: Intl API disabled");
|
||||
}
|
||||
|
||||
typedef void *UDateTimePatternGenerator;
|
||||
|
||||
static UDateTimePatternGenerator *
|
||||
udatpg_open(const char *locale, UErrorCode *pErrorCode)
|
||||
{
|
||||
MOZ_NOT_REACHED("udatpg_open: Intl API disabled");
|
||||
*pErrorCode = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int32_t
|
||||
udatpg_getBestPattern(UDateTimePatternGenerator *dtpg, const UChar *skeleton,
|
||||
int32_t length, UChar *bestPattern, int32_t capacity,
|
||||
UErrorCode *pErrorCode)
|
||||
{
|
||||
MOZ_NOT_REACHED("udatpg_getBestPattern: Intl API disabled");
|
||||
*pErrorCode = U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
udatpg_close(UDateTimePatternGenerator *dtpg)
|
||||
{
|
||||
MOZ_NOT_REACHED("udatpg_close: Intl API disabled");
|
||||
}
|
||||
|
||||
typedef void *UCalendar;
|
||||
typedef void *UDateFormat;
|
||||
|
||||
enum UDateFormatStyle {
|
||||
UDAT_PATTERN = -2,
|
||||
UDAT_IGNORE = UDAT_PATTERN
|
||||
};
|
||||
|
||||
static int32_t
|
||||
udat_countAvailable(void)
|
||||
{
|
||||
MOZ_NOT_REACHED("udat_countAvailable: Intl API disabled");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *
|
||||
udat_getAvailable(int32_t localeIndex)
|
||||
{
|
||||
MOZ_NOT_REACHED("udat_getAvailable: Intl API disabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static UDateFormat *
|
||||
udat_open(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char *locale,
|
||||
const UChar *tzID, int32_t tzIDLength, const UChar *pattern,
|
||||
int32_t patternLength, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("udat_open: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static const UCalendar *
|
||||
udat_getCalendar(const UDateFormat *fmt)
|
||||
{
|
||||
MOZ_NOT_REACHED("udat_getCalendar: Intl API disabled");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
ucal_setGregorianChange(UCalendar *cal, UDate date, UErrorCode *pErrorCode)
|
||||
{
|
||||
MOZ_NOT_REACHED("ucal_setGregorianChange: Intl API disabled");
|
||||
*pErrorCode = U_UNSUPPORTED_ERROR;
|
||||
}
|
||||
|
||||
static int32_t
|
||||
udat_format(const UDateFormat *format, UDate dateToFormat, UChar *result,
|
||||
int32_t resultLength, UFieldPosition *position, UErrorCode *status)
|
||||
{
|
||||
MOZ_NOT_REACHED("udat_format: Intl API disabled");
|
||||
*status = U_UNSUPPORTED_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
udat_close(UDateFormat *format)
|
||||
{
|
||||
MOZ_NOT_REACHED("udat_close: Intl API disabled");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/******************** Common to Intl constructors ********************/
|
||||
|
||||
static bool
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef Intl_h___
|
||||
#define Intl_h___
|
||||
|
||||
#include "gc/Root.h"
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
struct JSContext;
|
||||
class JSObject;
|
||||
|
@ -229,8 +229,18 @@ class OrderedHashTable
|
||||
* The effect on live Ranges is the same as removing all entries; in
|
||||
* particular, those Ranges are still live and will see any entries added
|
||||
* after a successful clear().
|
||||
*
|
||||
* The DoNotCallDestructors specialization is for use during a GC when the
|
||||
* OrderedHashTable contains pointers to GC things in other arenas. Since
|
||||
* it is invalid to touch objects in other arenas during sweeping, we need
|
||||
* to not trigger destructors on the pointers contained in the table in
|
||||
* this case.
|
||||
*/
|
||||
bool clear() {
|
||||
enum CallDestructors {
|
||||
DoNotCallDtors = false,
|
||||
DoCallDtors = true
|
||||
};
|
||||
bool clear(CallDestructors callDestructors = DoCallDtors) {
|
||||
if (dataLength != 0) {
|
||||
Data **oldHashTable = hashTable;
|
||||
Data *oldData = data;
|
||||
@ -244,7 +254,9 @@ class OrderedHashTable
|
||||
}
|
||||
|
||||
alloc.free_(oldHashTable);
|
||||
freeData(oldData, oldDataLength);
|
||||
if (callDestructors)
|
||||
destroyData(oldData, oldDataLength);
|
||||
alloc.free_(oldData);
|
||||
for (Range *r = ranges; r; r = r->next)
|
||||
r->onClear();
|
||||
}
|
||||
@ -690,7 +702,8 @@ class OrderedHashMap
|
||||
Entry *get(const Key &key) { return impl.get(key); }
|
||||
bool put(const Key &key, const Value &value) { return impl.put(Entry(key, value)); }
|
||||
bool remove(const Key &key, bool *foundp) { return impl.remove(key, foundp); }
|
||||
bool clear() { return impl.clear(); }
|
||||
bool clear() { return impl.clear(Impl::DoCallDtors); }
|
||||
bool clearWithoutCallingDestructors() { return impl.clear(Impl::DoNotCallDtors); }
|
||||
};
|
||||
|
||||
template <class T, class OrderedHashPolicy, class AllocPolicy>
|
||||
@ -717,7 +730,8 @@ class OrderedHashSet
|
||||
Range all() { return impl.all(); }
|
||||
bool put(const T &value) { return impl.put(value); }
|
||||
bool remove(const T &value, bool *foundp) { return impl.remove(value, foundp); }
|
||||
bool clear() { return impl.clear(); }
|
||||
bool clear() { return impl.clear(Impl::DoCallDtors); }
|
||||
bool clearWithoutCallingDestructors() { return impl.clear(Impl::DoNotCallDtors); }
|
||||
};
|
||||
|
||||
} // namespace js
|
||||
@ -1059,8 +1073,10 @@ MapObject::mark(JSTracer *trc, RawObject obj)
|
||||
void
|
||||
MapObject::finalize(FreeOp *fop, RawObject obj)
|
||||
{
|
||||
if (ValueMap *map = obj->asMap().getData())
|
||||
if (ValueMap *map = obj->asMap().getData()) {
|
||||
map->clearWithoutCallingDestructors();
|
||||
fop->delete_(map);
|
||||
}
|
||||
}
|
||||
|
||||
JSBool
|
||||
@ -1511,8 +1527,10 @@ void
|
||||
SetObject::finalize(FreeOp *fop, RawObject obj)
|
||||
{
|
||||
SetObject *setobj = static_cast<SetObject *>(obj);
|
||||
if (ValueSet *set = setobj->getData())
|
||||
if (ValueSet *set = setobj->getData()) {
|
||||
set->clearWithoutCallingDestructors();
|
||||
fop->delete_(set);
|
||||
}
|
||||
}
|
||||
|
||||
JSBool
|
||||
|
@ -4322,6 +4322,15 @@ if test "$ACCESSIBILITY" -a "$MOZ_ENABLE_GTK2" ; then
|
||||
AC_DEFINE_UNQUOTED(ATK_REV_VERSION, $ATK_REV_VERSION)
|
||||
fi
|
||||
|
||||
|
||||
dnl ECMAScript Internationalization API Support (uses ICU)
|
||||
dnl ========================================================
|
||||
|
||||
dnl Source files that use ICU should have control over which parts of the ICU
|
||||
dnl namespace they want to use.
|
||||
AC_DEFINE(U_USING_ICU_NAMESPACE,0)
|
||||
|
||||
|
||||
dnl ========================================================
|
||||
dnl JavaScript shell
|
||||
dnl ========================================================
|
||||
|
@ -41,7 +41,7 @@ static bool
|
||||
SetSourceMap(JSContext *cx, TokenStream &tokenStream, ScriptSource *ss, RawScript script)
|
||||
{
|
||||
if (tokenStream.hasSourceMap()) {
|
||||
if (!ss->setSourceMap(cx, tokenStream.releaseSourceMap(), script->filename))
|
||||
if (!ss->setSourceMap(cx, tokenStream.releaseSourceMap(), script->filename()))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -105,6 +105,8 @@ frontend::CompileScript(JSContext *cx, HandleObject scopeChain,
|
||||
ScriptSource *ss = cx->new_<ScriptSource>();
|
||||
if (!ss)
|
||||
return NULL;
|
||||
if (options.filename && !ss->setFilename(cx, options.filename))
|
||||
return NULL;
|
||||
ScriptSourceHolder ssh(ss);
|
||||
SourceCompressionToken mysct(cx);
|
||||
SourceCompressionToken *sct = (extraSct) ? extraSct : &mysct;
|
||||
@ -324,6 +326,8 @@ frontend::CompileFunctionBody(JSContext *cx, HandleFunction fun, CompileOptions
|
||||
ScriptSource *ss = cx->new_<ScriptSource>();
|
||||
if (!ss)
|
||||
return false;
|
||||
if (options.filename && !ss->setFilename(cx, options.filename))
|
||||
return false;
|
||||
ScriptSourceHolder ssh(ss);
|
||||
SourceCompressionToken sct(cx);
|
||||
JS_ASSERT(options.sourcePolicy != CompileOptions::LAZY_SOURCE);
|
||||
|
@ -4367,6 +4367,7 @@ EmitFunc(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
|
||||
options.setPrincipals(parent->principals())
|
||||
.setOriginPrincipals(parent->originPrincipals)
|
||||
.setCompileAndGo(parent->compileAndGo)
|
||||
.setSelfHostingMode(parent->selfHosted)
|
||||
.setNoScriptRval(false)
|
||||
.setVersion(parent->getVersion())
|
||||
.setUserBit(parent->userBit);
|
||||
|
@ -695,19 +695,35 @@ CharsMatch(const jschar *p, const char *q) {
|
||||
}
|
||||
|
||||
bool
|
||||
TokenStream::getAtSourceMappingURL()
|
||||
TokenStream::getAtSourceMappingURL(bool isMultiline)
|
||||
{
|
||||
/* Match comments of the form "//@ sourceMappingURL=<url>" */
|
||||
|
||||
jschar peeked[19];
|
||||
/* Match comments of the form "//@ sourceMappingURL=<url>" or
|
||||
* "/\* //@ sourceMappingURL=<url> *\/"
|
||||
*
|
||||
* To avoid a crashing bug in IE, several JavaScript transpilers
|
||||
* wrap single line comments containing a source mapping URL
|
||||
* inside a multiline comment to avoid a crashing bug in IE. To
|
||||
* avoid potentially expensive lookahead and backtracking, we
|
||||
* only check for this case if we encounter an '@' character.
|
||||
*/
|
||||
jschar peeked[18];
|
||||
int32_t c;
|
||||
|
||||
if (peekChars(19, peeked) && CharsMatch(peeked, "@ sourceMappingURL=")) {
|
||||
skipChars(19);
|
||||
if (peekChars(18, peeked) && CharsMatch(peeked, " sourceMappingURL=")) {
|
||||
skipChars(18);
|
||||
tokenbuf.clear();
|
||||
|
||||
while ((c = peekChar()) && c != EOF && !IsSpaceOrBOM2(c)) {
|
||||
getChar();
|
||||
/*
|
||||
* Source mapping URLs can occur in both single- and multiline
|
||||
* comments. If we're currently inside a multiline comment, we also
|
||||
* need to recognize multiline comment terminators.
|
||||
*/
|
||||
if (isMultiline && c == '*' && peekChar() == '/') {
|
||||
ungetChar('*');
|
||||
break;
|
||||
}
|
||||
tokenbuf.append(c);
|
||||
}
|
||||
|
||||
@ -1424,7 +1440,7 @@ TokenStream::getTokenInternal()
|
||||
* Look for a single-line comment.
|
||||
*/
|
||||
if (matchChar('/')) {
|
||||
if (!getAtSourceMappingURL())
|
||||
if (matchChar('@') && !getAtSourceMappingURL(false))
|
||||
goto error;
|
||||
|
||||
skipline:
|
||||
@ -1450,7 +1466,8 @@ TokenStream::getTokenInternal()
|
||||
unsigned linenoBefore = lineno;
|
||||
while ((c = getChar()) != EOF &&
|
||||
!(c == '*' && matchChar('/'))) {
|
||||
/* Ignore all characters until comment close. */
|
||||
if (c == '@' && !getAtSourceMappingURL(true))
|
||||
goto error;
|
||||
}
|
||||
if (c == EOF) {
|
||||
reportError(JSMSG_UNTERMINATED_COMMENT);
|
||||
|
@ -767,7 +767,7 @@ class TokenStream
|
||||
bool matchUnicodeEscapeIdStart(int32_t *c);
|
||||
bool matchUnicodeEscapeIdent(int32_t *c);
|
||||
bool peekChars(int n, jschar *cp);
|
||||
bool getAtSourceMappingURL();
|
||||
bool getAtSourceMappingURL(bool isMultiline);
|
||||
|
||||
bool matchChar(int32_t expect) {
|
||||
int32_t c = getChar();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user