Merge mozilla-central to fx-team

This commit is contained in:
Carsten "Tomcat" Book 2015-02-25 12:13:16 +01:00
commit 3dc9ade060
174 changed files with 3061 additions and 1606 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="93f9ba577f68d772093987c2f1c0a4ae293e1802"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="c42985975f2bbc42859b9136ed348186d989b93d"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a1ddea3133e0807350326cee5dcf0d06fad00c08"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="93f9ba577f68d772093987c2f1c0a4ae293e1802"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="ef937d1aca7c4cf89ecb5cc43ae8c21c2000a9db">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="c42985975f2bbc42859b9136ed348186d989b93d"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a1ddea3133e0807350326cee5dcf0d06fad00c08"/>

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "f6bfd854fe4746f21bc006eac145365e85f98808",
"git_revision": "cc235a867161e0000ea55a4f009b3be19021f066",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "e6b6631570eae8356747b4d4f0e8c1257da9a195",
"revision": "6b12bdb3c5f22c6ec98bd43cdcae2d0a6d6a0d1e",
"repo_path": "integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="c42985975f2bbc42859b9136ed348186d989b93d"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="a1ddea3133e0807350326cee5dcf0d06fad00c08"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="52775e03a2d8532429dff579cb2cd56718e488c3">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="f6bfd854fe4746f21bc006eac145365e85f98808"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="cc235a867161e0000ea55a4f009b3be19021f066"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3905180d9e2dbe03d7ce3b3a6debe4d4adc938d1"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -148,6 +148,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
"resource:///modules/ReaderParent.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonWatcher",
"resource://gre/modules/AddonWatcher.jsm");
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
@ -587,6 +590,76 @@ BrowserGlue.prototype = {
this._distributionCustomizer.applyPrefDefaults();
},
_notifySlowAddon: function BG_notifySlowAddon(addonId) {
let addonCallback = function(addon) {
if (!addon) {
Cu.reportError("couldn't look up addon: " + addonId);
return;
}
let win = RecentWindow.getMostRecentBrowserWindow();
if (!win) {
return;
}
let brandBundle = win.document.getElementById("bundle_brand");
let brandShortName = brandBundle.getString("brandShortName");
let message = win.gNavigatorBundle.getFormattedString("addonwatch.slow", [addon.name, brandShortName]);
let notificationBox = win.document.getElementById("global-notificationbox");
let notificationId = 'addon-slow:' + addonId;
let notification = notificationBox.getNotificationWithValue(notificationId);
if(notification) {
notification.label = message;
} else {
let buttons = [
{
label: win.gNavigatorBundle.getFormattedString("addonwatch.disable.label", [addon.name]),
accessKey: win.gNavigatorBundle.getString("addonwatch.disable.accesskey"),
callback: function() {
addon.userDisabled = true;
if (addon.pendingOperations != addon.PENDING_NONE) {
let restartMessage = win.gNavigatorBundle.getFormattedString("addonwatch.restart.message", [addon.name, brandShortName]);
let restartButton = [
{
label: win.gNavigatorBundle.getFormattedString("addonwatch.restart.label", [brandShortName]),
accessKey: win.gNavigatorBundle.getString("addonwatch.restart.accesskey"),
callback: function() {
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
appStartup.quit(appStartup.eForceQuit | appStartup.eRestart);
}
}
];
const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
notificationBox.appendNotification(restartMessage, "restart-" + addonId, "",
priority, restartButton);
}
}
},
{
label: win.gNavigatorBundle.getString("addonwatch.ignoreSession.label"),
accessKey: win.gNavigatorBundle.getString("addonwatch.ignoreSession.accesskey"),
callback: function() {
AddonWatcher.ignoreAddonForSession(addonId);
}
},
{
label: win.gNavigatorBundle.getString("addonwatch.ignorePerm.label"),
accessKey: win.gNavigatorBundle.getString("addonwatch.ignorePerm.accesskey"),
callback: function() {
AddonWatcher.ignoreAddonPermanently(addonId);
}
},
];
const priority = notificationBox.PRIORITY_WARNING_MEDIUM;
notificationBox.appendNotification(message, notificationId, "",
priority, buttons);
}
};
AddonManager.getAddonByID(addonId, addonCallback);
},
// runs on startup, before the first command line handler is invoked
// (i.e. before the first window is opened)
_finalUIStartup: function BG__finalUIStartup() {
@ -642,6 +715,8 @@ BrowserGlue.prototype = {
#endif
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
AddonWatcher.init(this._notifySlowAddon);
},
_checkForOldBuildUpdates: function () {
@ -907,6 +982,7 @@ BrowserGlue.prototype = {
#endif
webrtcUI.uninit();
FormValidationHandler.uninit();
AddonWatcher.uninit();
},
_initServiceDiscovery: function () {

View File

@ -103,71 +103,45 @@ support-files =
[browser_dbg_aaa_run_first_leaktest.js]
skip-if = e10s && debug
[browser_dbg_addonactor.js]
skip-if = e10s && debug
[browser_dbg_addon-sources.js]
skip-if = e10s && debug
[browser_dbg_addon-modules.js]
skip-if = e10s # TODO
[browser_dbg_addon-modules-unpacked.js]
skip-if = e10s # TODO
[browser_dbg_addon-panels.js]
skip-if = e10s && debug
[browser_dbg_addon-console.js]
skip-if = e10s && debug || os == 'win' # bug 1005274
[browser_dbg_auto-pretty-print-01.js]
skip-if = e10s && debug
[browser_dbg_auto-pretty-print-02.js]
skip-if = e10s && debug
[browser_dbg_bfcache.js]
skip-if = e10s || true # bug 1113935
[browser_dbg_blackboxing-01.js]
skip-if = e10s && debug
[browser_dbg_blackboxing-02.js]
skip-if = e10s && debug
[browser_dbg_blackboxing-03.js]
skip-if = e10s && debug
[browser_dbg_blackboxing-04.js]
skip-if = e10s && debug
[browser_dbg_blackboxing-05.js]
skip-if = e10s && debug
[browser_dbg_blackboxing-06.js]
skip-if = e10s && debug
[browser_dbg_breadcrumbs-access.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-01.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-02.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-03.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-04.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-05.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-06.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-07.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-08.js]
skip-if = e10s && debug
[browser_dbg_break-on-dom-event-01.js]
skip-if = e10s || os == "mac" || e10s # Bug 895426
[browser_dbg_break-on-dom-event-02.js]
skip-if = e10s # TODO
[browser_dbg_breakpoints-actual-location.js]
skip-if = e10s && debug
[browser_dbg_breakpoints-actual-location2.js]
skip-if = e10s && debug
[browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js]
skip-if = e10s # Bug 1093535
[browser_dbg_breakpoints-button-01.js]
skip-if = e10s && debug
[browser_dbg_breakpoints-button-02.js]
skip-if = e10s && debug
[browser_dbg_breakpoints-contextmenu-add.js]
skip-if = e10s && debug
[browser_dbg_breakpoints-contextmenu.js]
skip-if = e10s && debug
[browser_dbg_breakpoints-disabled-reload.js]
skip-if = e10s # Bug 1093535
[browser_dbg_breakpoints-editor.js]

View File

@ -40,6 +40,17 @@ addonDownloadRestart=Restart Download;Restart Downloads
addonDownloadRestart.accessKey=R
addonDownloadCancelTooltip=Cancel
addonwatch.slow=%1$S might be making %2$S run slowly
addonwatch.disable.label=Disable %S
addonwatch.disable.accesskey=D
addonwatch.ignoreSession.label=Ignore for now
addonwatch.ignoreSession.accesskey=I
addonwatch.ignorePerm.label=Ignore permanently
addonwatch.ignorePerm.accesskey=p
addonwatch.restart.message=To disable %1$S you must restart %2$S
addonwatch.restart.label=Restart %S
addonwatch.restart.accesskey=R
# LOCALIZATION NOTE (addonsInstalled, addonsInstalledNeedsRestart):
# Semicolon-separated list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals

View File

@ -42,16 +42,11 @@ endif
endif
# Put a useful .gdbinit in the bin directory, to be picked up automatically
# by GDB when we debug executables there.
# NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir.
GDBINIT_FILES := $(topsrcdir)/.gdbinit
GDBINIT_OBJDIR_FILES = $(topsrcdir)/.gdbinit
GDBINIT_DEST = $(FINAL_TARGET)
# needs to be absolute to be distinct from $(topsrcdir)/.gdbinit
GDBINIT_OBJDIR_FILES = $(topsrcdir)/.gdbinit
GDBINIT_OBJDIR_DEST = $(abspath $(DEPTH))
INSTALL_TARGETS += GDBINIT GDBINIT_OBJDIR
INSTALL_TARGETS += GDBINIT_OBJDIR
# Put a .lldbinit in the bin directory and the objdir, to be picked up
# automatically by LLDB when we debug executables using either of those two
@ -66,13 +61,6 @@ LLDBINIT_FINAL_TARGET_FILES := $(DEPTH)/.lldbinit
LLDBINIT_FINAL_TARGET_DEST = $(FINAL_TARGET)
INSTALL_TARGETS += LLDBINIT_FINAL_TARGET
ifeq (1_1,$(MOZ_ASAN)_$(CLANG_CL))
# Install the clang-cl runtime library for ASAN next to the binaries we produce.
CLANG_RT_ASAN_FILES := $(MOZ_CLANG_RT_ASAN_LIB_PATH)
CLANG_RT_ASAN_DEST = $(FINAL_TARGET)
INSTALL_TARGETS += CLANG_RT_ASAN
endif
ifdef MOZTTDIR
# Install the Firefox OS fonts.
include $(MOZTTDIR)/fonts.mk
@ -81,6 +69,19 @@ MOZTT_FILES = $(patsubst external/moztt/%,$(MOZTTDIR)/%,$(filter external/moztt/
INSTALL_TARGETS += MOZTT
endif
ifdef MOZ_VALGRIND
_VALGRIND_DIR = $(DEPTH)/_valgrind
GARBAGE_DIRS += $(_VALGRIND_DIR)
_VALGRIND_FILES = \
$(topsrcdir)/build/valgrind/cross-architecture.sup \
$(topsrcdir)/build/valgrind/i386-redhat-linux-gnu.sup \
$(topsrcdir)/build/valgrind/x86_64-redhat-linux-gnu.sup \
$(NULL)
_VALGRIND_DEST = $(_VALGRIND_DIR)
INSTALL_TARGETS += _VALGRIND
endif
include $(topsrcdir)/config/rules.mk
TARGET_DEPTH = ..
@ -99,41 +100,6 @@ endif
libs:: automation.py
ifdef MOZ_VALGRIND
_VALGRIND_DIR = $(DEPTH)/_valgrind
GARBAGE_DIRS += $(_VALGRIND_DIR)
_VALGRIND_FILES = \
$(topsrcdir)/build/valgrind/cross-architecture.sup \
$(topsrcdir)/build/valgrind/i386-redhat-linux-gnu.sup \
$(topsrcdir)/build/valgrind/x86_64-redhat-linux-gnu.sup \
$(NULL)
libs:: $(_VALGRIND_FILES)
$(INSTALL) $^ $(_VALGRIND_DIR)
endif
ifneq (,$(ENABLE_TESTS)$(MOZ_DMD))
libs:: $(topsrcdir)/tools/rb/fix_stack_using_bpsyms.py
$(INSTALL) $< $(DIST)/bin
ifeq ($(OS_ARCH),Darwin)
libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py
$(INSTALL) $< $(DIST)/bin
endif
ifeq ($(OS_ARCH),Linux)
libs:: $(topsrcdir)/tools/rb/fix_linux_stack.py
$(INSTALL) $< $(DIST)/bin
endif
endif # ENABLE_TESTS or MOZ_DMD
ifdef ENABLE_TESTS
GARBAGE += $(srcdir)/automationutils.pyc
endif # ENABLE_TESTS
ifdef MOZ_DMD
libs:: $(topsrcdir)/memory/replace/dmd/dmd.py
$(INSTALL) $< $(DIST)/bin
endif

View File

@ -445,7 +445,7 @@ class ShutdownLeaks(object):
self.leakedWindows = {}
self.leakedDocShells = set()
self.currentTest = None
self.seenShutdown = False
self.seenShutdown = set()
def log(self, message):
if message['action'] == 'log':
@ -454,8 +454,9 @@ class ShutdownLeaks(object):
self._logWindow(line)
elif line[2:10] == "DOCSHELL":
self._logDocShell(line)
elif line.startswith("TEST-START | Shutdown"):
self.seenShutdown = True
elif line.startswith("Completed ShutdownLeaks collections in process"):
pid = int(line.split()[-1])
self.seenShutdown.add(pid)
elif message['action'] == 'test_start':
fileName = message['test'].replace("chrome://mochitests/content/browser/", "")
self.currentTest = {"fileName": fileName, "windows": set(), "docShells": set()}
@ -499,7 +500,7 @@ class ShutdownLeaks(object):
windows.add(key)
else:
windows.discard(key)
elif self.seenShutdown and not created:
elif int(pid) in self.seenShutdown and not created:
self.leakedWindows[key] = self._parseValue(line, "url")
def _logDocShell(self, line):
@ -520,7 +521,7 @@ class ShutdownLeaks(object):
docShells.add(key)
else:
docShells.discard(key)
elif self.seenShutdown and not created:
elif int(pid) in self.seenShutdown and not created:
self.leakedDocShells.add(key)
def _parseValue(self, line, name):

View File

@ -48,3 +48,22 @@ if CONFIG['MOZ_BUILD_APP'] == 'browser':
PYTHON_UNIT_TESTS += [
'compare-mozconfig/compare-mozconfigs-wrapper.py',
]
if CONFIG['ENABLE_TESTS'] or CONFIG['MOZ_DMD']:
tools_dir = TOPSRCDIR + '/tools/rb/'
FINAL_TARGET_FILES += [tools_dir + 'fix_stack_using_bpsyms.py']
if CONFIG['OS_ARCH'] == 'Darwin':
FINAL_TARGET_FILES += [tools_dir + 'fix_macosx_stack.py']
if CONFIG['OS_ARCH'] == 'Linux':
FINAL_TARGET_FILES += [tools_dir + 'fix_linux_stack.py']
if CONFIG['MOZ_DMD']:
FINAL_TARGET_FILES += [TOPSRCDIR + '/memory/replace/dmd/dmd.py']
# Put a useful .gdbinit in the bin directory, to be picked up automatically
# by GDB when we debug executables there.
FINAL_TARGET_FILES += [TOPSRCDIR + '/.gdbinit']
# Install the clang-cl runtime library for ASAN next to the binaries we produce.
if CONFIG['MOZ_ASAN'] and CONFIG['CLANG_CL']:
FINAL_TARGET_FILES += [CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']]

View File

@ -17,6 +17,7 @@ XPIDL_MODULE = 'caps'
EXPORTS += [
'nsJSPrincipals.h',
'nsNullPrincipal.h',
'nsNullPrincipalURI.h',
]
UNIFIED_SOURCES += [
@ -36,6 +37,8 @@ LOCAL_INCLUDES += [
'/js/xpconnect/src',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
FAIL_ON_WARNINGS = True

View File

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 sts=2 ts=2 et tw=80: */
/* 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/. */
@ -86,6 +87,24 @@ nsNullPrincipal::Init(uint32_t aAppId, bool aInMozBrowser)
mAppId = aAppId;
mInMozBrowser = aInMozBrowser;
nsCString str;
nsresult rv = GenerateNullPrincipalURI(str);
NS_ENSURE_SUCCESS(rv, rv);
mURI = new nsNullPrincipalURI(str);
return NS_OK;
}
void
nsNullPrincipal::GetScriptLocation(nsACString &aStr)
{
mURI->GetSpec(aStr);
}
nsresult
nsNullPrincipal::GenerateNullPrincipalURI(nsACString &aStr)
{
// FIXME: bug 327161 -- make sure the uuid generator is reseeding-resistant.
nsresult rv;
nsCOMPtr<nsIUUIDGenerator> uuidgen =
@ -104,28 +123,19 @@ nsNullPrincipal::Init(uint32_t aAppId, bool aInMozBrowser)
// Use an nsCString so we only do the allocation once here and then share
// with nsJSPrincipals
nsCString str;
str.SetCapacity(prefixLen + suffixLen);
aStr.SetCapacity(prefixLen + suffixLen);
str.Append(NS_NULLPRINCIPAL_PREFIX);
str.Append(chars);
aStr.Append(NS_NULLPRINCIPAL_PREFIX);
aStr.Append(chars);
if (str.Length() != prefixLen + suffixLen) {
if (aStr.Length() != prefixLen + suffixLen) {
NS_WARNING("Out of memory allocating null-principal URI");
return NS_ERROR_OUT_OF_MEMORY;
}
mURI = new nsNullPrincipalURI(str);
return NS_OK;
}
void
nsNullPrincipal::GetScriptLocation(nsACString &aStr)
{
mURI->GetSpec(aStr);
}
#ifdef DEBUG
void nsNullPrincipal::dumpImpl()
{

View File

@ -31,7 +31,7 @@ class nsNullPrincipal MOZ_FINAL : public nsJSPrincipals
{
public:
nsNullPrincipal();
// Our refcount is managed by nsJSPrincipals. Use this macro to avoid an
// extra refcount member.
@ -49,6 +49,8 @@ public:
virtual void GetScriptLocation(nsACString &aStr) MOZ_OVERRIDE;
static nsresult GenerateNullPrincipalURI(nsACString &aStr);
#ifdef DEBUG
virtual void dumpImpl() MOZ_OVERRIDE;
#endif

View File

@ -9,6 +9,8 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/ipc/URIParams.h"
#include "nsNetUtil.h"
#include "nsEscape.h"
#include "nsCRT.h"
@ -17,6 +19,12 @@
//// nsNullPrincipalURI
nsNullPrincipalURI::nsNullPrincipalURI(const nsCString &aSpec)
{
InitializeFromSpec(aSpec);
}
void
nsNullPrincipalURI::InitializeFromSpec(const nsCString &aSpec)
{
int32_t dividerPosition = aSpec.FindChar(':');
NS_ASSERTION(dividerPosition != -1, "Malformed URI!");
@ -44,6 +52,7 @@ NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI)
else
NS_INTERFACE_MAP_ENTRY(nsIURI)
NS_INTERFACE_MAP_ENTRY(nsISizeOf)
NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableURI)
NS_INTERFACE_MAP_END
////////////////////////////////////////////////////////////////////////////////
@ -272,6 +281,31 @@ nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs)
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
//// nsIIPCSerializableURI
void
nsNullPrincipalURI::Serialize(mozilla::ipc::URIParams &aParams)
{
aParams = mozilla::ipc::NullPrincipalURIParams();
}
bool
nsNullPrincipalURI::Deserialize(const mozilla::ipc::URIParams &aParams)
{
if (aParams.type() != mozilla::ipc::URIParams::TNullPrincipalURIParams) {
MOZ_ASSERT_UNREACHABLE("unexpected URIParams type");
return false;
}
nsCString str;
nsresult rv = nsNullPrincipal::GenerateNullPrincipalURI(str);
NS_ENSURE_SUCCESS(rv, false);
InitializeFromSpec(str);
return true;
}
////////////////////////////////////////////////////////////////////////////////
//// nsISizeOf

View File

@ -16,6 +16,7 @@
#include "nsAutoPtr.h"
#include "nsString.h"
#include "mozilla/Attributes.h"
#include "nsIIPCSerializableURI.h"
#include "mozilla/MemoryReporting.h"
// {51fcd543-3b52-41f7-b91b-6b54102236e6}
@ -25,10 +26,12 @@
class nsNullPrincipalURI MOZ_FINAL : public nsIURI
, public nsISizeOf
, public nsIIPCSerializableURI
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIURI
NS_DECL_NSIIPCSERIALIZABLEURI
// nsISizeOf
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE;
@ -36,9 +39,14 @@ public:
explicit nsNullPrincipalURI(const nsCString &aSpec);
// NB: This constructor exists only for deserialization.
nsNullPrincipalURI() { }
private:
~nsNullPrincipalURI() {}
void InitializeFromSpec(const nsCString &aSpec);
nsCString mScheme;
nsCString mPath;
};

View File

@ -13,13 +13,11 @@
# Valid fields for all descriptors:
# * nativeType - The native type (concrete class or XPCOM interface) that
# instances of this interface will unwrap to. If not
# specified, defaults to 'mozilla::dom::InterfaceName' for
# non-worker non-external-or-callback interfaces, to
# specified, defaults to 'nsIDOM' followed by the interface
# name for external interfaces,
# 'mozilla::dom::workers::InterfaceName' for worker
# non-external interfaces, to 'nsIDOM' followed by the
# interface name for non-worker external-or-callback
# interfaces, and to 'JSObject' for worker external-or-callback
# interfaces.
# non-callback interfaces, and 'mozilla::dom::InterfaceName'
# for everything else.
# * headerFile - The file in which the nativeType is declared (defaults
# to an educated guess).
# * concrete - Indicates whether there exist JS objects with this interface as
@ -31,6 +29,7 @@
# will not be made available on the main thread.
# * notflattened - The native type does not have nsIClassInfo, so when
# wrapping it the right IID needs to be passed in.
# Only relevant for callback interfaces.
# * register - True if this binding should be registered. Defaults to true.
# * binaryNames - Dict for mapping method and attribute names to different
# names when calling the native methods (defaults to an empty
@ -606,14 +605,10 @@ DOMInterfaces = {
'headerFile': 'IDBEvents.h',
},
'IID': [
{
'IID': {
'nativeType': 'nsIJSID',
'headerFile': 'xpcjsid.h',
},
{
'workers': True,
}],
'ImageCapture': {
'binaryNames': { 'videoStreamTrack': 'GetVideoStreamTrack' }
@ -623,14 +618,10 @@ DOMInterfaces = {
'wrapperCache': False,
},
'InputStream': [
{
'InputStream': {
'nativeType': 'nsIInputStream',
'notflattened': True
},
{
'workers': True,
}],
'InstallEvent': {
'headerFile': 'ServiceWorkerEvents.h',
@ -1484,16 +1475,10 @@ DOMInterfaces = {
},
},
'WindowProxy': [
{
'WindowProxy': {
'nativeType': 'nsIDOMWindow',
'concrete': False
},
{
# We need a worker descriptor for WindowProxy because EventTarget exists in
# workers. But it's an external interface, so it'll just map to JSObject*.
'workers': True
}],
'WindowRoot': {
'nativeType': 'nsWindowRoot'

View File

@ -381,7 +381,7 @@ class CGDOMJSClass(CGThing):
classFlags += "JSCLASS_DOM_GLOBAL | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(DOM_GLOBAL_SLOTS) | JSCLASS_IMPLEMENTS_BARRIERS"
traceHook = "JS_GlobalObjectTraceHook"
reservedSlots = "JSCLASS_GLOBAL_APPLICATION_SLOTS"
if not self.descriptor.workers:
if self.descriptor.interface.identifier.name == "Window":
classExtensionAndObjectOps = fill(
"""
{
@ -4635,10 +4635,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
descriptor = descriptorProvider.getDescriptor(
type.unroll().inner.identifier.name)
if descriptor.nativeType == 'JSObject':
# XXXbz Workers code does this sometimes
assert descriptor.workers
return handleJSObjectType(type, isMember, failureCode, exceptionCode, sourceDescription)
assert descriptor.nativeType != 'JSObject'
if descriptor.interface.isCallback():
name = descriptor.interface.identifier.name
@ -4715,9 +4712,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
exceptionCode,
isCallbackReturnValue,
firstCap(sourceDescription)))
elif descriptor.workers:
return handleJSObjectType(type, isMember, failureCode, exceptionCode, sourceDescription)
else:
# Worker descriptors can't end up here, because all of our
# "external" stuff is not exposed in workers.
assert not descriptor.workers
# Either external, or new-binding non-castable. We always have a
# holder for these, because we don't actually know whether we have
# to addref when unwrapping or not. So we just pass an

View File

@ -305,10 +305,8 @@ class Descriptor(DescriptorProvider):
# Read the desc, and fill in the relevant defaults.
ifaceName = self.interface.identifier.name
if self.interface.isExternal():
if self.workers:
nativeTypeDefault = "JSObject"
else:
nativeTypeDefault = "nsIDOM" + ifaceName
assert not self.workers
nativeTypeDefault = "nsIDOM" + ifaceName
elif self.interface.isCallback():
nativeTypeDefault = "mozilla::dom::" + ifaceName
else:

View File

@ -1852,6 +1852,12 @@ WebGLContext::TexImageFromVideoElement(const TexImageTarget texImageTarget,
return ok;
}
size_t mozilla::RoundUpToMultipleOf(size_t value, size_t multiple)
{
size_t overshoot = value + multiple - 1;
return overshoot - (overshoot % multiple);
}
////////////////////////////////////////////////////////////////////////////////
WebGLContext::ScopedMaskWorkaround::ScopedMaskWorkaround(WebGLContext& webgl)
@ -1875,6 +1881,7 @@ WebGLContext::ScopedMaskWorkaround::~ScopedMaskWorkaround()
mWebGL.mColorWriteMask[3]);
}
}
////////////////////////////////////////////////////////////////////////////////
// XPCOM goop

View File

@ -1092,9 +1092,7 @@ protected:
GLenum pname);
// Returns x rounded to the next highest multiple of y.
static CheckedUint32 RoundedToNextMultipleOf(CheckedUint32 x,
CheckedUint32 y)
{
static CheckedUint32 RoundedToNextMultipleOf(CheckedUint32 x, CheckedUint32 y) {
return ((x + y - 1) / y) * y;
}
@ -1693,6 +1691,8 @@ private:
WebGLContext* mWebGL;
};
size_t RoundUpToMultipleOf(size_t value, size_t multiple);
} // namespace mozilla
#endif

View File

@ -49,8 +49,8 @@ WebGLContext::Clear(GLbitfield mask)
mShouldPresent = true;
}
static GLclampf
GLClampFloat(GLclampf val)
static GLfloat
GLClampFloat(GLfloat val)
{
if (val < 0.0)
return 0.0;
@ -62,18 +62,28 @@ GLClampFloat(GLclampf val)
}
void
WebGLContext::ClearColor(GLclampf r, GLclampf g,
GLclampf b, GLclampf a)
WebGLContext::ClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
{
if (IsContextLost())
return;
MakeContextCurrent();
mColorClearValue[0] = GLClampFloat(r);
mColorClearValue[1] = GLClampFloat(g);
mColorClearValue[2] = GLClampFloat(b);
mColorClearValue[3] = GLClampFloat(a);
const bool supportsFloatColorBuffers = (IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_half_float) ||
IsExtensionEnabled(WebGLExtensionID::WEBGL_color_buffer_float));
if (!supportsFloatColorBuffers) {
r = GLClampFloat(r);
g = GLClampFloat(g);
b = GLClampFloat(b);
a = GLClampFloat(a);
}
gl->fClearColor(r, g, b, a);
mColorClearValue[0] = r;
mColorClearValue[1] = g;
mColorClearValue[2] = b;
mColorClearValue[3] = a;
}
void

View File

@ -1863,6 +1863,84 @@ SetFullAlpha(void* data, GLenum format, GLenum type, size_t width,
return false;
}
static void
ReadPixelsAndConvert(gl::GLContext* gl, GLint x, GLint y, GLsizei width, GLsizei height,
GLenum readFormat, GLenum readType, size_t pixelStorePackAlignment,
GLenum destFormat, GLenum destType, void* destBytes)
{
if (readFormat == destFormat && readType == destType) {
gl->fReadPixels(x, y, width, height, destFormat, destType, destBytes);
return;
}
if (readFormat == LOCAL_GL_RGBA &&
readType == LOCAL_GL_HALF_FLOAT &&
destFormat == LOCAL_GL_RGBA &&
destType == LOCAL_GL_FLOAT)
{
size_t readBytesPerPixel = sizeof(uint16_t) * 4;
size_t destBytesPerPixel = sizeof(float) * 4;
size_t readBytesPerRow = readBytesPerPixel * width;
size_t readStride = RoundUpToMultipleOf(readBytesPerRow, pixelStorePackAlignment);
size_t destStride = RoundUpToMultipleOf(destBytesPerPixel * width,
pixelStorePackAlignment);
size_t bytesNeeded = ((height - 1) * readStride) + readBytesPerRow;
UniquePtr<uint8_t[]> readBuffer(new uint8_t[bytesNeeded]);
gl->fReadPixels(x, y, width, height, readFormat, readType, readBuffer.get());
size_t channelsPerRow = width * 4;
for (size_t j = 0; j < (size_t)height; j++) {
uint16_t* src = (uint16_t*)(readBuffer.get()) + j*readStride;
float* dst = (float*)(destBytes) + j*destStride;
uint16_t* srcEnd = src + channelsPerRow;
while (src != srcEnd) {
*dst = unpackFromFloat16(*src);
++src;
++dst;
}
}
return;
}
MOZ_CRASH("bad format/type");
}
static bool
IsFormatAndTypeUnpackable(GLenum format, GLenum type)
{
switch (type) {
case LOCAL_GL_UNSIGNED_BYTE:
case LOCAL_GL_FLOAT:
case LOCAL_GL_HALF_FLOAT:
case LOCAL_GL_HALF_FLOAT_OES:
switch (format) {
case LOCAL_GL_ALPHA:
case LOCAL_GL_RGB:
case LOCAL_GL_RGBA:
return true;
default:
return false;
}
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
return format == LOCAL_GL_RGBA;
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
return format == LOCAL_GL_RGB;
default:
return false;
}
}
void
WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
GLsizei height, GLenum format,
@ -1883,59 +1961,61 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
if (pixels.IsNull())
return ErrorInvalidValue("readPixels: null destination buffer");
if (!IsFormatAndTypeUnpackable(format, type))
return ErrorInvalidEnum("readPixels: Bad format or type.");
const WebGLRectangleObject* framebufferRect = CurValidReadFBRectObject();
GLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0;
GLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0;
uint32_t channels = 0;
int channels = 0;
// Check the format param
switch (format) {
case LOCAL_GL_ALPHA:
channels = 1;
break;
case LOCAL_GL_RGB:
channels = 3;
break;
case LOCAL_GL_RGBA:
channels = 4;
break;
default:
return ErrorInvalidEnum("readPixels: Bad format");
case LOCAL_GL_ALPHA:
channels = 1;
break;
case LOCAL_GL_RGB:
channels = 3;
break;
case LOCAL_GL_RGBA:
channels = 4;
break;
default:
MOZ_CRASH("bad `format`");
}
uint32_t bytesPerPixel = 0;
int requiredDataType = 0;
// Check the type param
bool isReadTypeValid = false;
bool isReadTypeFloat = false;
int bytesPerPixel;
int requiredDataType;
switch (type) {
case LOCAL_GL_UNSIGNED_BYTE:
isReadTypeValid = true;
bytesPerPixel = 1*channels;
requiredDataType = js::Scalar::Uint8;
break;
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
isReadTypeValid = true;
bytesPerPixel = 2;
requiredDataType = js::Scalar::Uint16;
break;
case LOCAL_GL_FLOAT:
if (IsExtensionEnabled(WebGLExtensionID::WEBGL_color_buffer_float) ||
IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_half_float))
{
isReadTypeValid = true;
isReadTypeFloat = true;
bytesPerPixel = 4*channels;
requiredDataType = js::Scalar::Float32;
}
break;
case LOCAL_GL_UNSIGNED_BYTE:
bytesPerPixel = 1*channels;
requiredDataType = js::Scalar::Uint8;
break;
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
bytesPerPixel = 2;
requiredDataType = js::Scalar::Uint16;
break;
case LOCAL_GL_FLOAT:
bytesPerPixel = 4*channels;
requiredDataType = js::Scalar::Float32;
break;
case LOCAL_GL_HALF_FLOAT:
case LOCAL_GL_HALF_FLOAT_OES:
bytesPerPixel = 2*channels;
requiredDataType = js::Scalar::Uint16;
break;
default:
MOZ_CRASH("bad `type`");
}
if (!isReadTypeValid)
return ErrorInvalidEnum("readPixels: Bad type", type);
const ArrayBufferView& pixbuf = pixels.Value();
int dataType = JS_GetArrayBufferViewType(pixbuf.Obj());
@ -1988,43 +2068,38 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
isSourceTypeFloat = false;
}
if (isReadTypeFloat != isSourceTypeFloat)
return ErrorInvalidOperation("readPixels: Invalid type floatness");
// Check the format and type params to assure they are an acceptable pair (as per spec)
bool isFormatAndTypeValid = false;
const GLenum mainReadFormat = LOCAL_GL_RGBA;
const GLenum mainReadType = isSourceTypeFloat ? LOCAL_GL_FLOAT
: LOCAL_GL_UNSIGNED_BYTE;
GLenum auxReadFormat = mainReadFormat;
GLenum auxReadType = mainReadType;
// OpenGL ES 2.0 $4.3.1 - IMPLEMENTATION_COLOR_READ_{TYPE/FORMAT} is a valid
// combination for glReadPixels().
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
GLenum implType = 0;
GLenum implFormat = 0;
gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE,
reinterpret_cast<GLint*>(&implType));
gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT,
reinterpret_cast<GLint*>(&implFormat));
if (type == implType && format == implFormat) {
isFormatAndTypeValid = true;
}
reinterpret_cast<GLint*>(&auxReadFormat));
gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE,
reinterpret_cast<GLint*>(&auxReadType));
}
switch (format) {
case LOCAL_GL_RGBA: {
switch (type) {
case LOCAL_GL_UNSIGNED_BYTE:
case LOCAL_GL_FLOAT:
isFormatAndTypeValid = true;
break;
}
break;
}
}
if (!isFormatAndTypeValid) {
const bool mainMatches = (format == mainReadFormat && type == mainReadType);
const bool auxMatches = (format == auxReadFormat && type == auxReadType);
const bool isValid = mainMatches || auxMatches;
if (!isValid)
return ErrorInvalidOperation("readPixels: Invalid format/type pair");
GLenum readType = type;
if (gl->WorkAroundDriverBugs() && gl->IsANGLE()) {
if (type == LOCAL_GL_FLOAT &&
auxReadFormat == format &&
auxReadType == LOCAL_GL_HALF_FLOAT)
{
readType = auxReadType;
}
}
// Now that the errors are out of the way, on to actually reading
@ -2035,7 +2110,10 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
if (CanvasUtils::CheckSaneSubrectSize(x, y, width, height, framebufferWidth, framebufferHeight)) {
// the easy case: we're not reading out-of-range pixels
gl->fReadPixels(x, y, width, height, format, type, data);
// Effectively: gl->fReadPixels(x, y, width, height, format, type, dest);
ReadPixelsAndConvert(gl, x, y, width, height, format, readType,
mPixelStorePackAlignment, format, type, data);
} else {
// the rectangle doesn't fit entirely in the bound buffer. We then have to set to zero the part
// of the buffer that correspond to out-of-range pixels. We don't want to rely on system OpenGL
@ -2084,8 +2162,11 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width,
if (!subrect_data)
return ErrorOutOfMemory("readPixels: subrect_data");
gl->fReadPixels(subrect_x, subrect_y, subrect_width, subrect_height,
format, type, subrect_data.get());
// Effectively: gl->fReadPixels(subrect_x, subrect_y, subrect_width,
// subrect_height, format, type, subrect_data.get());
ReadPixelsAndConvert(gl, subrect_x, subrect_y, subrect_width, subrect_height,
format, readType, mPixelStorePackAlignment, format, type,
subrect_data.get());
// notice that this for loop terminates because we already checked that subrect_height is at most height
for (GLint y_inside_subrect = 0; y_inside_subrect < subrect_height; ++y_inside_subrect) {
@ -3597,7 +3678,7 @@ mozilla::GetWebGLTexelFormat(TexInternalFormat effectiveInternalFormat)
}
void
WebGLContext::BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) {
WebGLContext::BlendColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
if (IsContextLost())
return;
MakeContextCurrent();

View File

@ -266,6 +266,16 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
return JS::NumberValue(uint32_t(i));
}
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE: {
if (mBoundReadFramebuffer) {
FBStatus status = mBoundReadFramebuffer->CheckFramebufferStatus();
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
ErrorInvalidOperation("getParameter: Read framebuffer must be"
" complete before querying"
" IMPLEMENTATION_COLOR_READ_TYPE.");
return JS::NullValue();
}
}
GLint i = 0;
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
gl->fGetIntegerv(pname, &i);
@ -275,6 +285,16 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
return JS::NumberValue(uint32_t(i));
}
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT: {
if (mBoundReadFramebuffer) {
FBStatus status = mBoundReadFramebuffer->CheckFramebufferStatus();
if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) {
ErrorInvalidOperation("getParameter: Read framebuffer must be"
" complete before querying"
" IMPLEMENTATION_COLOR_READ_FORMAT.");
return JS::NullValue();
}
}
GLint i = 0;
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
gl->fGetIntegerv(pname, &i);

View File

@ -26,7 +26,8 @@ WebGLExtensionColorBufferHalfFloat::IsSupported(const WebGLContext* webgl)
gl::GLContext* gl = webgl->GL();
// ANGLE doesn't support ReadPixels from a RGBA16F with RGBA/FLOAT.
return gl->IsSupported(gl::GLFeature::renderbuffer_color_half_float);
return gl->IsSupported(gl::GLFeature::renderbuffer_color_half_float) ||
gl->IsANGLE();
}
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionColorBufferHalfFloat)

View File

@ -129,6 +129,7 @@ WebGLFramebuffer::Attachment::IsReadableFloat() const
MOZ_ASSERT(internalformat != LOCAL_GL_NONE);
TexType type = TypeFromInternalFormat(internalformat);
return type == LOCAL_GL_FLOAT ||
type == LOCAL_GL_HALF_FLOAT_OES ||
type == LOCAL_GL_HALF_FLOAT;
}
@ -803,6 +804,7 @@ WebGLFramebuffer::CheckFramebufferStatus() const
// Ok, attach our chosen flavor of {DEPTH, STENCIL, DEPTH_STENCIL}.
FinalizeAttachments();
// TODO: This should not be unconditionally GL_FRAMEBUFFER.
mStatus = mContext->gl->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER);
return mStatus;
}

View File

@ -105,7 +105,7 @@ unpackFromFloat16(uint16_t v)
uint16_t exp = (v >> 10) & 0x001F;
uint16_t mantissa = v & 0x03FF;
if (exp) {
if (!exp) {
// Handle denormalized numbers
// Adapted from: OpenGL ES 2.0 Programming Guide Appx.
// Converting Float to Half-Float

View File

@ -22,6 +22,8 @@ skip-if = android_version == '10' #Android 2.3 aws only; bug 1030942
[webgl-mochitest/test_texsubimage_float.html]
[webgl-mochitest/test_webgl_available.html]
skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
#[webgl-mochitest/test_webgl_color_buffer_float.html]
# We haven't cleaned up the Try results yet, but let's get this on the books first.
[webgl-mochitest/test_webgl_conformance.html]
skip-if = buildapp == 'mulet' || toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests
[webgl-mochitest/test_webgl_request_context.html]

View File

@ -0,0 +1,486 @@
<html>
<head>
<meta charset='UTF-8'>
<script src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' href='/tests/SimpleTest/test.css'>
</head>
<body>
<script id='vs' type='x-shader/x-vertex'>
attribute vec2 aVertCoord;
void main(void) {
gl_Position = vec4(aVertCoord, 0.0, 1.0);
}
</script>
<script id='fs' type='x-shader/x-fragment'>
precision mediump float; // 💩
uniform vec4 uFragColor;
void main(void) {
gl_FragColor = uFragColor;
}
</script>
<canvas id='c' width='200' height='200'></canvas>
<script>
function GetGLSLByElemId(elemId) {
var elem = document.getElementById(elemId);
if (!elem)
throw 'Bad `elemId`: ' + elemId;
return elem.innerHTML.trim();
}
function ProgramByElemIds(gl, vsId, fsId) {
var vs = gl.createShader(gl.VERTEX_SHADER);
gl.shaderSource(vs, GetGLSLByElemId(vsId));
gl.compileShader(vs);
var fs = gl.createShader(gl.FRAGMENT_SHADER);
gl.shaderSource(fs, GetGLSLByElemId(fsId));
gl.compileShader(fs);
var prog = gl.createProgram();
gl.attachShader(prog, vs);
gl.attachShader(prog, fs);
gl.linkProgram(prog);
var success = gl.getProgramParameter(prog, gl.LINK_STATUS);
if (success)
return prog;
console.log('Error linking program for \'' + vsId + '\' and \'' + fsId + '\'.');
console.log('\nLink log: ' + gl.getProgramInfoLog(prog));
console.log('\nVert shader log: ' + gl.getShaderInfoLog(vs));
console.log('\nFrag shader log: ' + gl.getShaderInfoLog(fs));
return null;
}
var RGBA = 0x1908;
var UNSIGNED_BYTE = 0x1401;
var FLOAT = 0x1406;
var HALF_FLOAT_OES = 0x8D61;
var HALF_FLOAT = 0x140B;
var RGBA4 = 0x8056;
var RGBA8 = 0x8058;
var RGBA32F = 0x8814;
var RGBA16F = 0x881A;
function EnumName(val) {
switch (val) {
case RGBA:
return 'RGBA';
case UNSIGNED_BYTE:
return 'UNSIGNED_BYTE';
case FLOAT:
return 'FLOAT';
case HALF_FLOAT_OES:
return 'HALF_FLOAT_OES';
case HALF_FLOAT:
return 'HALF_FLOAT';
case RGBA4:
return 'RGBA4';
case RGBA32F:
return 'RGBA32F';
default:
throw 'Unknown enum: 0x' + val.toString(16);
}
}
var gl;
function RGBAToString(arr) {
return '[' + arr[0].toPrecision(4) + ', ' +
arr[1].toPrecision(4) + ', ' +
arr[2].toPrecision(4) + ', ' +
arr[3].toPrecision(4) + ']';
}
function TestScreenColor(gl, isFBFloat, r, g, b, a) {
var readType = isFBFloat ? FLOAT : UNSIGNED_BYTE;
var arr;
switch (readType) {
case gl.UNSIGNED_BYTE:
arr = new Uint8Array(4);
break;
case gl.FLOAT:
arr = new Float32Array(4);
break;
default:
throw 'Bad `readType`.';
}
gl.readPixels(0, 0, 1, 1, gl.RGBA, readType, arr);
var err = gl.getError();
ok(err == 0, 'Should be no errors.');
if (err)
return;
var floatArr;
switch (readType) {
case gl.UNSIGNED_BYTE:
floatArr = new Float32Array(4);
floatArr[0] = arr[0] / 255.0;
floatArr[1] = arr[1] / 255.0;
floatArr[2] = arr[2] / 255.0;
floatArr[3] = arr[3] / 255.0;
break;
case gl.FLOAT:
floatArr = arr;
break;
default:
throw 'Bad `readType`.';
}
var testText = RGBAToString(floatArr);
var refText = RGBAToString([r, g, b, a]);
var eps = 1.0 / 255.0;
var isSame = (Math.abs(floatArr[0] - r) < eps &&
Math.abs(floatArr[1] - g) < eps &&
Math.abs(floatArr[2] - b) < eps &&
Math.abs(floatArr[3] - a) < eps);
ok(isSame, 'Should be ' + refText + ', was ' + testText + ',');
}
function TestReadFormat(gl, isFBFloat, format, type) {
var err = gl.getError();
if (err) {
ok(false, 'Should be no error at start of TestReadFormat(). (0x' + err.toString(16) + ')');
return;
}
var implFormat = gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_FORMAT);
var implType = gl.getParameter(gl.IMPLEMENTATION_COLOR_READ_TYPE);
var err = gl.getError();
if (err) {
ok(false, 'Should be no error at start2 of TestReadFormat(). (0x' + err.toString(16) + ')');
return;
}
var defaultReadType = isFBFloat ? FLOAT : UNSIGNED_BYTE;
var formatOk = (format == gl.RGBA &&
type == defaultReadType);
if (format == implFormat &&
type == implType)
{
formatOk = true;
}
var w = 1;
var h = 1;
var channels = 4;
var arrSize = w * h * channels;
var arr;
switch (type) {
case UNSIGNED_BYTE:
arr = new Uint8Array(arrSize);
break;
case FLOAT:
arr = new Float32Array(arrSize);
break;
case HALF_FLOAT_OES:
case HALF_FLOAT:
arr = new Uint16Array(arrSize);
break;
default:
throw 'Bad `type`: 0x' + type.toString(16);
}
gl.readPixels(0, 0, 1, 1, format, type, arr);
var wasOk = gl.getError() == 0;
var text = 'Should ' + (formatOk ? '' : 'not ') + 'allow reading with ' +
EnumName(format) + '/' + EnumName(type) + '.'
ok(wasOk == formatOk, text);
}
function TestError(gl, expectedErr, descText) {
var err = gl.getError();
while (gl.getError()) {}
ok(err == expectedErr,
descText + ': Error should be 0x' + expectedErr.toString(16) + ', was 0x' +
err.toString(16) + '.');
return err;
}
function AttachRBToCurFB(gl, sizedFormat) {
var isSupported;
switch (sizedFormat) {
case RGBA4:
isSupported = true;
break;
case RGBA16F:
isSupported = !!gl.getExtension('EXT_color_buffer_half_float');
break;
case RGBA32F:
isSupported = !!gl.getExtension('WEBGL_color_buffer_float');
break;
default:
throw 'Bad `sizedFormat`.';
}
var rb = gl.createRenderbuffer();
gl.bindRenderbuffer(gl.RENDERBUFFER, rb);
gl.renderbufferStorage(gl.RENDERBUFFER, sizedFormat, 1, 1);
var correctError = isSupported ? 0 : gl.INVALID_ENUM;
var err = TestError(gl, correctError, 'RB specification with supported format');
if (err)
return false;
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rb);
var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
var isComplete = (status == gl.FRAMEBUFFER_COMPLETE);
ok(isComplete, 'Framebuffer should be complete after RB attachment.');
return isComplete;
}
function AttachTexToCurFB(gl, sizedFormat) {
var canCreate;
var isAttachGuaranteed;
var format;
var type;
switch (sizedFormat) {
case RGBA8:
canCreate = true;
isAttachGuaranteed = true;
format = RGBA;
type = UNSIGNED_BYTE;
break;
case RGBA16F:
canCreate = !!gl.getExtension('OES_texture_half_float');
isAttachGuaranteed = !!gl.getExtension('EXT_color_buffer_half_float');
format = RGBA;
type = HALF_FLOAT_OES;
break;
case RGBA32F:
canCreate = !!gl.getExtension('OES_texture_float');
isAttachGuaranteed = !!gl.getExtension('WEBGL_color_buffer_float');
format = RGBA;
type = FLOAT;
break;
default:
throw 'Bad `sizedFormat`.';
}
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
gl.texImage2D(gl.TEXTURE_2D, 0, format, 1, 1, 0, format, type, null);
var correctError = canCreate ? 0 : gl.INVALID_ENUM;
var err = TestError(gl, correctError, 'Tex specification with supported format');
if (err)
return false;
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);
var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);
var isComplete = (status == gl.FRAMEBUFFER_COMPLETE);
if (!isAttachGuaranteed && !isComplete)
todo(false, 'Framebuffer needn\'t be complete after tex attachment.');
else
ok(isComplete, 'Framebuffer should be complete after tex attachment.');
return isComplete;
}
function IsFormatFloat(sizedFormat) {
switch (sizedFormat) {
case RGBA4:
case RGBA8:
return false;
case RGBA16F:
case RGBA32F:
return true;
default:
throw 'Bad `sizedFormat`.';
}
}
function TestType(gl, prog, isTex, sizedFormat) {
TestError(gl, 0, 'At start of TestRB()');
var isAttached = isTex ? AttachTexToCurFB(gl, sizedFormat)
: AttachRBToCurFB(gl, sizedFormat);
if (!isAttached)
return;
var isFormatFloat = IsFormatFloat(sizedFormat);
TestReadFormat(gl, isFormatFloat, gl.RGBA, gl.UNSIGNED_BYTE);
TestReadFormat(gl, isFormatFloat, gl.RGBA, gl.FLOAT);
TestReadFormat(gl, isFormatFloat, gl.RGBA, HALF_FLOAT);
TestReadFormat(gl, isFormatFloat, gl.RGBA, HALF_FLOAT_OES);
//////////////////////////////////////
ok(true, 'Drawing:');
gl.clearColor(0.0, 1.5, 0.5, 1.0);
gl.clear(gl.COLOR_BUFFER_BIT);
if (isFormatFloat)
TestScreenColor(gl, isFormatFloat, 0, 1.5, 0.5, 1);
else
TestScreenColor(gl, isFormatFloat, 0, 1, 0.5, 1);
////////
ok(true, 'Clearing:');
gl.uniform4f(prog.uFragColor, 0, 0.5, 1.5, 1);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
if (isFormatFloat)
TestScreenColor(gl, isFormatFloat, 0, 0.5, 1.5, 1);
else
TestScreenColor(gl, isFormatFloat, 0, 0.5, 1.0, 1);
////////
ok(true, 'Blending:');
gl.enable(gl.BLEND);
gl.blendFunc(gl.CONSTANT_COLOR, gl.ZERO);
gl.blendColor(0, 10, 0.1, 1);
gl.uniform4f(prog.uFragColor, 0, 0.5, 15.0, 1);
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
if (isFormatFloat)
TestScreenColor(gl, isFormatFloat, 0, 5.0, 1.5, 1);
else
TestScreenColor(gl, isFormatFloat, 0, 0.5, 0.1, 1);
gl.disable(gl.BLEND);
//////////////////////////////////////
}
// Give ourselves a scope to return early from:
(function() {
var canvas = document.getElementById('c');
var attribs = {
antialias: false,
depth: false,
};
gl = canvas.getContext('experimental-webgl', attribs);
if (!gl) {
todo(false, 'WebGL is unavailable.');
return;
}
var cbf = gl.getExtension('WEBGL_color_buffer_float');
var cbhf = gl.getExtension('EXT_color_buffer_half_float');
//////////////////////////////////////
gl.viewport(0, 0, 1, 1);
var prog = ProgramByElemIds(gl, 'vs', 'fs');
ok(prog, 'Program should link.');
if (!prog)
return;
prog.aVertCoord = gl.getAttribLocation(prog, 'aVertCoord');
prog.uFragColor = gl.getUniformLocation(prog, 'uFragColor');
gl.useProgram(prog);
var arr = new Float32Array([
-1, -1,
1, -1,
-1, 1,
1, 1,
]);
var vb = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vb);
gl.bufferData(gl.ARRAY_BUFFER, arr, gl.STATIC_DRAW);
gl.enableVertexAttribArray(0);
gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
//////////////////////////////////////
var fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
error = gl.getError();
ok(error == 0, 'Should be no errors after setup. (0x' + error.toString(16) + ')');
//////////////////////////////////////
ok(true, '---------------------------------------------------------------------------');
ok(true, 'RGBA8 texture');
TestType(gl, prog, true, RGBA8);
ok(true, '---------------------------------------------------------------------------');
ok(true, 'RGBA16F texture');
TestType(gl, prog, true, RGBA16F);
ok(true, '---------------------------------------------------------------------------');
ok(true, 'RGBA32F texture');
TestType(gl, prog, true, RGBA32F);
////////
ok(true, '---------------------------------------------------------------------------');
ok(true, 'RGBA4 renderbuffer');
TestType(gl, prog, false, RGBA4);
ok(true, '---------------------------------------------------------------------------');
ok(true, 'RGBA16F renderbuffer');
TestType(gl, prog, false, RGBA16F);
ok(true, '---------------------------------------------------------------------------');
ok(true, 'RGBA32F renderbuffer');
TestType(gl, prog, false, RGBA32F);
ok(true, '---------------------------------------------------------------------------');
//////////////////////////////////////
error = gl.getError();
ok(error == 0, 'Should be no errors after test.');
ok(true, 'TEST COMPLETE');
})();
</script>
</body>
</html>

View File

@ -4,6 +4,8 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
[test_blob_sliced_from_parent_process.html]
# This test is only supposed to run in the main process.
skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s
[test_cpow_cookies.html]
skip-if = buildapp == 'b2g' || buildapp == 'mulet'
[test_NuwaProcessCreation.html]
skip-if = toolkit != 'gonk'
[test_NuwaProcessDeadlock.html]

View File

@ -0,0 +1,89 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for recursive CPOW-getting-cookie bug</title>
<script type="application/javascript"
src="/tests/SimpleTest/SimpleTest.js">
</script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript;version=1.8">
"use strict";
SimpleTest.waitForExplicitFinish();
const childFrameURL =
"data:text/html,<!DOCTYPE HTML><html><body></body></html>";
function childFrameScript() {
"use strict";
const Ci = Components.interfaces;
function test1(message) {
// NB: This is a no-op because we're a data: document with a null
// principal.
content.document.cookie = "a=b";
message.target.sendAsyncMessage("testCPOWCookies:test1Finished", { pass: true });
}
addMessageListener("testCPOWCookies:test1", function(message) {
test1(message);
});
}
let test;
function* testStructure(mm) {
let lastResult;
function testDone(msg) {
test.next(msg.data);
}
mm.addMessageListener("testCPOWCookies:test1Finished", testDone);
mm.sendAsyncMessage("testCPOWCookies:test1", {});
lastResult = yield;
ok(lastResult.pass, "got the right answer and didn't crash");
SimpleTest.finish();
}
function runTests() {
info("Browser prefs set.");
let iframe = document.createElement("iframe");
SpecialPowers.wrap(iframe).mozbrowser = true;
iframe.id = "iframe";
iframe.src = childFrameURL;
iframe.addEventListener("mozbrowserloadend", function() {
info("Got iframe load event.");
let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
mm.loadFrameScript("data:,(" + encodeURI(childFrameScript.toString()) + ")();",
false);
test = testStructure(mm);
test.next();
});
document.body.appendChild(iframe);
}
addEventListener("load", function() {
info("Got load event.");
SpecialPowers.addPermission("browser", true, document);
SpecialPowers.pushPrefEnv({
"set": [
["dom.ipc.browser_frames.oop_by_default", true],
["dom.mozBrowserFramesEnabled", true],
["browser.pagethumbnails.capturing_disabled", true]
]
}, runTests);
});
</script>
</body>
</html>

View File

@ -191,36 +191,3 @@ function newIncomingParcel(fakeParcelSize, response, request, data) {
return bytes;
}
/**
* Test whether specified function throws exception with expected
* result.
*
* @param func
* Function to be tested.
* @param message
* Message of expected exception. <code>null</code> for no throws.
* @param stack
* Optional stack object to be printed. <code>null</code> for
* Components#stack#caller.
*/
function do_check_throws(func, message, stack)
{
if (!stack)
stack = Components.stack.caller;
try {
func();
} catch (exc) {
if (exc.message === message) {
return;
}
do_throw("expecting exception '" + message
+ "', caught '" + exc.message + "'", stack);
}
if (message) {
do_throw("expecting exception '" + message + "', none thrown", stack);
}
}

View File

@ -18,16 +18,16 @@ add_test(function test_change_call_barring_password() {
function do_test(facility, pin, newPin) {
buf.sendParcel = function fakeSendParcel () {
// Request Type.
do_check_eq(this.readInt32(), REQUEST_CHANGE_BARRING_PASSWORD);
equal(this.readInt32(), REQUEST_CHANGE_BARRING_PASSWORD);
// Token : we don't care.
this.readInt32();
let parcel = this.readStringList();
do_check_eq(parcel.length, 3);
do_check_eq(parcel[0], facility);
do_check_eq(parcel[1], pin);
do_check_eq(parcel[2], newPin);
equal(parcel.length, 3);
equal(parcel[0], facility);
equal(parcel[1], pin);
equal(parcel[2], newPin);
};
let options = {facility: facility, pin: pin, newPin: newPin};
@ -43,9 +43,9 @@ add_test(function test_check_change_call_barring_password_result() {
let barringPasswordOptions;
let worker = newWorker({
postMessage: function(message) {
do_check_eq(barringPasswordOptions.pin, PIN);
do_check_eq(barringPasswordOptions.newPin, NEW_PIN);
do_check_eq(message.errorMsg, GECKO_ERROR_SUCCESS);
equal(barringPasswordOptions.pin, PIN);
equal(barringPasswordOptions.newPin, NEW_PIN);
equal(message.errorMsg, GECKO_ERROR_SUCCESS);
}
});

View File

@ -50,10 +50,12 @@ function add_test_incoming_parcel(parcel, handler) {
add_test_incoming_parcel(null,
function test_normal_parcel_handling() {
let self = this;
do_check_throws(function normal_handler() {
try {
// reads exactly the same size, should not throw anything.
self.context.Buf.readInt32();
});
} catch (e) {
ok(false, "Got exception: " + e);
}
}
);
@ -61,10 +63,12 @@ add_test_incoming_parcel(null,
add_test_incoming_parcel(null,
function test_parcel_under_read() {
let self = this;
do_check_throws(function under_read_handler() {
try {
// reads less than parcel size, should not throw.
self.context.Buf.readUint16();
});
} catch (e) {
ok(false, "Got exception: " + e);
}
}
);
@ -78,7 +82,7 @@ add_test_incoming_parcel(null,
buf.readUint8();
}
do_check_throws(function over_read_handler() {
throws(function over_read_handler() {
// reads more than parcel size, should throw an error.
buf.readUint8();
},"Trying to read data beyond the parcel end!");
@ -133,14 +137,14 @@ add_test(function test_incoming_parcel_buffer_overwritten() {
let p1 = pA.subarray(0, pA.length - 1);
worker.onRILMessage(0, p1);
// The parcel should not have been processed.
do_check_eq(buf.readAvailable, 0);
equal(buf.readAvailable, 0);
// buf.currentParcelSize should have been set because incoming data has more
// than 4 octets.
do_check_eq(buf.currentParcelSize, pA_parcelSize);
equal(buf.currentParcelSize, pA_parcelSize);
// buf.readIncoming should contains remaining unconsumed octets count.
do_check_eq(buf.readIncoming, p1.length - buf.PARCEL_SIZE_SIZE);
equal(buf.readIncoming, p1.length - buf.PARCEL_SIZE_SIZE);
// buf.incomingWriteIndex should be ready to accept the last octet.
do_check_eq(buf.incomingWriteIndex, p1.length);
equal(buf.incomingWriteIndex, p1.length);
// Second, send the last octet of pA and whole pB. The Buf should now expand
// to cover both pA & pB.
@ -149,13 +153,13 @@ add_test(function test_incoming_parcel_buffer_overwritten() {
p2.set(pB, 1);
worker.onRILMessage(0, p2);
// The parcels should have been both consumed.
do_check_eq(buf.readAvailable, 0);
equal(buf.readAvailable, 0);
// No parcel data remains.
do_check_eq(buf.currentParcelSize, 0);
equal(buf.currentParcelSize, 0);
// No parcel data remains.
do_check_eq(buf.readIncoming, 0);
equal(buf.readIncoming, 0);
// The Buf should now expand to cover both pA & pB.
do_check_eq(buf.incomingWriteIndex, pA.length + pB.length);
equal(buf.incomingWriteIndex, pA.length + pB.length);
// end of incoming parcel's trip, let's do next test.
run_next_test();
@ -167,15 +171,15 @@ add_test_incoming_parcel(null,
let buf = this.context.Buf;
let u8array = buf.readUint8Array(1);
do_check_eq(u8array instanceof Uint8Array, true);
do_check_eq(u8array.length, 1);
do_check_eq(buf.readAvailable, 3);
equal(u8array instanceof Uint8Array, true);
equal(u8array.length, 1);
equal(buf.readAvailable, 3);
u8array = buf.readUint8Array(2);
do_check_eq(u8array.length, 2);
do_check_eq(buf.readAvailable, 1);
equal(u8array.length, 2);
equal(buf.readAvailable, 1);
do_check_throws(function over_read_handler() {
throws(function over_read_handler() {
// reads more than parcel size, should throw an error.
u8array = buf.readUint8Array(2);
}, "Trying to read data beyond the parcel end!");

View File

@ -59,7 +59,7 @@ add_test(function test_display() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].display, "Test Info");
equal(records[0].display, "Test Info");
run_next_test();
});
@ -79,7 +79,7 @@ add_test(function test_extended_display() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].display, "Test Extended Info");
equal(records[0].display, "Test Extended Info");
run_next_test();
});
@ -102,8 +102,8 @@ add_test(function test_mixed() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].display, "Test Info 1");
do_check_eq(records[1].display, "Test Info 2");
equal(records[0].display, "Test Info 1");
equal(records[1].display, "Test Info 2");
run_next_test();
});
@ -126,8 +126,8 @@ add_test(function test_multiple() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].display, "Test Info 1");
do_check_eq(records[1].display, "Test Info 2");
equal(records[0].display, "Test Info 1");
equal(records[1].display, "Test Info 2");
run_next_test();
});
@ -147,9 +147,9 @@ add_test(function test_signal() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].signal.type, 0x00);
do_check_eq(records[0].signal.alertPitch, 0x01);
do_check_eq(records[0].signal.signal, 0x03);
equal(records[0].signal.type, 0x00);
equal(records[0].signal.alertPitch, 0x01);
equal(records[0].signal.signal, 0x03);
run_next_test();
});
@ -169,7 +169,7 @@ add_test(function test_signal_not_present() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records.length, 0);
equal(records.length, 0);
run_next_test();
});
@ -189,10 +189,10 @@ add_test(function test_line_control() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].lineControl.polarityIncluded, 1);
do_check_eq(records[0].lineControl.toggle, 0);
do_check_eq(records[0].lineControl.reverse, 1);
do_check_eq(records[0].lineControl.powerDenial, 255);
equal(records[0].lineControl.polarityIncluded, 1);
equal(records[0].lineControl.toggle, 0);
equal(records[0].lineControl.reverse, 1);
equal(records[0].lineControl.powerDenial, 255);
run_next_test();
});
@ -209,7 +209,7 @@ add_test(function test_clir() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].clirCause, 1);
equal(records[0].clirCause, 1);
run_next_test();
});
@ -227,8 +227,8 @@ add_test(function test_clir() {
let helper = context.CdmaPDUHelper;
let records = helper.decodeInformationRecord();
do_check_eq(records[0].audioControl.upLink, 1);
do_check_eq(records[0].audioControl.downLink, 255);
equal(records[0].audioControl.upLink, 1);
equal(records[0].audioControl.downLink, 255);
run_next_test();
});

View File

@ -34,15 +34,15 @@ function hexStringToParcelByteArrayData(hexString) {
add_test(function test_ril_consts_cellbroadcast_misc() {
// Must be 16 for indexing.
do_check_eq(CB_DCS_LANG_GROUP_1.length, 16);
do_check_eq(CB_DCS_LANG_GROUP_2.length, 16);
equal(CB_DCS_LANG_GROUP_1.length, 16);
equal(CB_DCS_LANG_GROUP_2.length, 16);
// Array length must be even.
do_check_eq(CB_NON_MMI_SETTABLE_RANGES.length & 0x01, 0);
equal(CB_NON_MMI_SETTABLE_RANGES.length & 0x01, 0);
for (let i = 0; i < CB_NON_MMI_SETTABLE_RANGES.length;) {
let from = CB_NON_MMI_SETTABLE_RANGES[i++];
let to = CB_NON_MMI_SETTABLE_RANGES[i++];
do_check_eq(from < to, true);
equal(from < to, true);
}
run_next_test();
@ -67,11 +67,11 @@ add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() {
let msg = {};
context.GsmPDUHelper.readCbDataCodingScheme(msg);
do_check_eq(msg.dcs, dcs);
do_check_eq(msg.encoding, encoding);
do_check_eq(msg.language, language);
do_check_eq(msg.hasLanguageIndicator, hasLanguageIndicator);
do_check_eq(msg.messageClass, messageClass);
equal(msg.dcs, dcs);
equal(msg.encoding, encoding);
equal(msg.language, language);
equal(msg.hasLanguageIndicator, hasLanguageIndicator);
equal(msg.messageClass, messageClass);
}
function test_dcs_throws(dcs) {
@ -79,7 +79,7 @@ add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() {
return dcs;
};
do_check_throws(function() {
throws(function() {
context.GsmPDUHelper.readCbDataCodingScheme({});
}, "Unsupported CBS data coding scheme: " + dcs);
}
@ -189,15 +189,15 @@ add_test(function test_ril_worker_GsmPDUHelper_readGsmCbData() {
};
context.GsmPDUHelper.readGsmCbData(msg, options[3].length);
do_check_eq(msg.body, expected[0]);
do_check_eq(msg.data == null, expected[1] == null);
equal(msg.body, expected[0]);
equal(msg.data == null, expected[1] == null);
if (expected[1] != null) {
do_check_eq(msg.data.length, expected[1].length);
equal(msg.data.length, expected[1].length);
for (let i = 0; i < expected[1].length; i++) {
do_check_eq(msg.data[i], expected[1][i]);
equal(msg.data[i], expected[1][i]);
}
}
do_check_eq(msg.language, expected[2]);
equal(msg.language, expected[2]);
}
// We're testing Cell Broadcast message body with all zeros octet stream. As
@ -249,7 +249,7 @@ add_test(function test_ril_worker__checkCellBroadcastMMISettable() {
let ril = context.RIL;
function test(from, to, expected) {
do_check_eq(expected, ril._checkCellBroadcastMMISettable(from, to));
equal(expected, ril._checkCellBroadcastMMISettable(from, to));
}
test(-2, -1, false);
@ -301,7 +301,7 @@ add_test(function test_ril_worker__mergeCellBroadcastConfigs() {
function test(olist, from, to, expected) {
let result = ril._mergeCellBroadcastConfigs(olist, from, to);
do_check_eq(JSON.stringify(expected), JSON.stringify(result));
equal(JSON.stringify(expected), JSON.stringify(result));
}
test(null, 0, 1, [0, 1]);
@ -488,8 +488,8 @@ add_test(function test_GsmPDUHelper_readUmtsCbMessage_MultiParts() {
hexStringToParcelByteArrayData(pdu)));
let postedMessage = workerHelper.postedMessage;
do_check_eq("cellbroadcast-received", postedMessage.rilMessageType);
do_check_eq(postedMessage.fullBody.length,
equal("cellbroadcast-received", postedMessage.rilMessageType);
equal(postedMessage.fullBody.length,
aNumOfPages * CB_MAX_CONTENT_PER_PAGE_7BIT);
}
@ -534,11 +534,11 @@ add_test(function test_GsmPDUHelper_readUmtsCbMessage_Binary() {
hexStringToParcelByteArrayData(pdu)));
let postedMessage = workerHelper.postedMessage;
do_check_eq("cellbroadcast-received", postedMessage.rilMessageType);
do_check_eq(postedMessage.fullData.length,
equal("cellbroadcast-received", postedMessage.rilMessageType);
equal(postedMessage.fullData.length,
aNumOfPages * CB_UMTS_MESSAGE_PAGE_SIZE);
for (let i = 0; i < postedMessage.fullData.length; i++) {
do_check_eq(postedMessage.fullData[i], 255);
equal(postedMessage.fullData[i], 255);
}
}

View File

@ -36,8 +36,8 @@ add_test(function test_ril_worker_cellbroadcast_activate() {
setup(isCdma);
context.RIL.setCellBroadcastDisabled({disabled: true});
// Makesure that request parcel is sent out.
do_check_neq(parcelTypes.indexOf(expectedRequest), -1);
do_check_eq(context.RIL.cellBroadcastDisabled, true);
notEqual(parcelTypes.indexOf(expectedRequest), -1);
equal(context.RIL.cellBroadcastDisabled, true);
}
test(false, REQUEST_GSM_SMS_BROADCAST_ACTIVATION);
@ -81,14 +81,14 @@ add_test(function test_ril_worker_cellbroadcast_config() {
found = true;
// Check parcel. Data start from 4th word (32bit)
do_check_eq(u32Parcel.slice(3).toString(), expected);
equal(u32Parcel.slice(3).toString(), expected);
};
context.RIL._isCdma = isCdma;
context.RIL.setSmsBroadcastConfig(configs);
// Makesure that request parcel is sent out.
do_check_true(found);
ok(found);
}
// (GSM) RIL writes the following data to outgoing parcel:
@ -121,7 +121,7 @@ add_test(function test_ril_worker_cellbroadcast_merge_config() {
context.RIL._isCdma = isCdma;
context.RIL.cellBroadcastConfigs = configs;
context.RIL._mergeAllCellBroadcastConfigs();
do_check_eq(context.RIL.mergedCellBroadcastConfig.toString(), expected);
equal(context.RIL.mergedCellBroadcastConfig.toString(), expected);
}
let configs = {
@ -155,8 +155,8 @@ add_test(function test_ril_worker_cellbroadcast_set_search_list() {
let options = { searchList: aSearchList };
context.RIL.setCellBroadcastSearchList(options);
// Enforce the MMI result to string for comparison.
do_check_eq("" + context.RIL.cellBroadcastConfigs.MMI, aExpected);
do_check_eq(options.success, true);
equal("" + context.RIL.cellBroadcastConfigs.MMI, aExpected);
equal(options.success, true);
}
let searchListStr = "1,2,3,4";

View File

@ -23,7 +23,7 @@ function toaFromString(number) {
add_test(function test_toaFromString_empty() {
let retval = toaFromString("");
do_check_eq(retval, TOA_UNKNOWN);
equal(retval, TOA_UNKNOWN);
run_next_test();
});
@ -31,7 +31,7 @@ add_test(function test_toaFromString_empty() {
add_test(function test_toaFromString_undefined() {
let retval = toaFromString();
do_check_eq(retval, TOA_UNKNOWN);
equal(retval, TOA_UNKNOWN);
run_next_test();
});
@ -39,7 +39,7 @@ add_test(function test_toaFromString_undefined() {
add_test(function test_toaFromString_unknown() {
let retval = toaFromString("666222333");
do_check_eq(retval, TOA_UNKNOWN);
equal(retval, TOA_UNKNOWN);
run_next_test();
});
@ -47,7 +47,7 @@ add_test(function test_toaFromString_unknown() {
add_test(function test_toaFromString_international() {
let retval = toaFromString("+34666222333");
do_check_eq(retval, TOA_INTERNATIONAL);
equal(retval, TOA_INTERNATIONAL);
run_next_test();
});
@ -73,8 +73,8 @@ add_test(function test_setCallForward_unconditional() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
});
@ -122,13 +122,13 @@ add_test(function test_queryCallForwardStatus_unconditional() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
do_check_true(Array.isArray(postedMessage.rules));
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
ok(Array.isArray(postedMessage.rules));
do_print(postedMessage.rules.length);
do_check_eq(postedMessage.rules.length, 1);
do_check_true(postedMessage.rules[0].active);
do_check_eq(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL);
do_check_eq(postedMessage.rules[0].number, "+34666222333");
equal(postedMessage.rules.length, 1);
ok(postedMessage.rules[0].active);
equal(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL);
equal(postedMessage.rules[0].number, "+34666222333");
run_next_test();
});

View File

@ -30,9 +30,9 @@ add_test(function test_queryCLIP_provisioned() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
do_check_eq(postedMessage.provisioned, 1);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
equal(postedMessage.provisioned, 1);
run_next_test();
});
@ -59,7 +59,7 @@ add_test(function test_getCLIP_error_generic_failure_invalid_length() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, "GenericFailure");
do_check_false(postedMessage.success);
equal(postedMessage.errorMsg, "GenericFailure");
ok(!postedMessage.success);
run_next_test();
});

View File

@ -34,8 +34,8 @@ add_test(function test_setCLIR_success() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
run_next_test();
});
@ -58,8 +58,8 @@ add_test(function test_setCLIR_generic_failure() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, "GenericFailure");
do_check_false(postedMessage.success);
equal(postedMessage.errorMsg, "GenericFailure");
ok(!postedMessage.success);
run_next_test();
});
@ -90,10 +90,10 @@ add_test(function test_getCLIR_n0_m1() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
do_check_eq(postedMessage.n, 0);
do_check_eq(postedMessage.m, 1);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
equal(postedMessage.n, 0);
equal(postedMessage.m, 1);
run_next_test();
});
@ -123,7 +123,7 @@ add_test(function test_getCLIR_error_generic_failure_invalid_length() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, "GenericFailure");
do_check_false(postedMessage.success);
equal(postedMessage.errorMsg, "GenericFailure");
ok(!postedMessage.success);
run_next_test();
});

View File

@ -24,8 +24,8 @@ add_test(function test_setCallWaiting_success() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
run_next_test();
});
@ -47,8 +47,8 @@ add_test(function test_setCallWaiting_generic_failure() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, "GenericFailure");
do_check_false(postedMessage.success);
equal(postedMessage.errorMsg, "GenericFailure");
ok(!postedMessage.success);
run_next_test();
});
@ -77,10 +77,10 @@ add_test(function test_queryCallWaiting_success_enabled_true() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
do_check_eq(postedMessage.length, 1);
do_check_true(postedMessage.enabled);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
equal(postedMessage.length, 1);
ok(postedMessage.enabled);
run_next_test();
});
@ -108,9 +108,9 @@ add_test(function test_queryCallWaiting_success_enabled_false() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
do_check_eq(postedMessage.length, 1);
do_check_false(postedMessage.enabled);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
equal(postedMessage.length, 1);
ok(!postedMessage.enabled);
run_next_test();
});

View File

@ -17,17 +17,17 @@ const TIMEOUT_VALUE = 300000; // 5 mins.
function setTimeout(callback, timeoutMs) {
timeoutCallback = callback;
timeoutDelayMs = timeoutMs;
do_check_eq(timeoutMs, TIMEOUT_VALUE);
equal(timeoutMs, TIMEOUT_VALUE);
return TIMER_ID;
}
function clearTimeout(timeoutId) {
do_check_eq(timeoutId, TIMER_ID);
equal(timeoutId, TIMER_ID);
timeoutCallback = null;
}
function fireTimeout() {
do_check_neq(timeoutCallback, null);
notEqual(timeoutCallback, null);
if (timeoutCallback) {
timeoutCallback();
timeoutCallback = null;
@ -45,15 +45,15 @@ add_test(function test_enter_emergencyCbMode() {
let postedMessage = workerHelper.postedMessage;
// Should store the mode.
do_check_eq(context.RIL._isInEmergencyCbMode, true);
equal(context.RIL._isInEmergencyCbMode, true);
// Should notify change.
do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange");
do_check_eq(postedMessage.active, true);
do_check_eq(postedMessage.timeoutMs, TIMEOUT_VALUE);
equal(postedMessage.rilMessageType, "emergencyCbModeChange");
equal(postedMessage.active, true);
equal(postedMessage.timeoutMs, TIMEOUT_VALUE);
// Should start timer.
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
}
run_next_test();
@ -69,14 +69,14 @@ add_test(function test_exit_emergencyCbMode() {
let postedMessage = workerHelper.postedMessage;
// Should store the mode.
do_check_eq(context.RIL._isInEmergencyCbMode, false);
equal(context.RIL._isInEmergencyCbMode, false);
// Should notify change.
do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange");
do_check_eq(postedMessage.active, false);
equal(postedMessage.rilMessageType, "emergencyCbModeChange");
equal(postedMessage.active, false);
// Should clear timer.
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
equal(context.RIL._exitEmergencyCbModeTimeoutID, null);
run_next_test();
});
@ -87,8 +87,8 @@ add_test(function test_request_exit_emergencyCbMode_when_timeout() {
let context = worker.ContextPool._contexts[0];
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
do_check_eq(context.RIL._isInEmergencyCbMode, true);
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
equal(context.RIL._isInEmergencyCbMode, true);
equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
let parcelTypes = [];
context.Buf.newParcel = function(type, options) {
@ -99,10 +99,10 @@ add_test(function test_request_exit_emergencyCbMode_when_timeout() {
fireTimeout();
// Should clear timeout event.
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
equal(context.RIL._exitEmergencyCbModeTimeoutID, null);
// Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE.
do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
notEqual(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
run_next_test();
});
@ -113,8 +113,8 @@ add_test(function test_request_exit_emergencyCbMode_when_dial() {
let context = worker.ContextPool._contexts[0];
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
do_check_eq(context.RIL._isInEmergencyCbMode, true);
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
equal(context.RIL._isInEmergencyCbMode, true);
equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
let parcelTypes = [];
context.Buf.newParcel = function(type, options) {
@ -127,10 +127,10 @@ add_test(function test_request_exit_emergencyCbMode_when_dial() {
isDialEmergency: false});
// Should clear timeout event.
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
equal(context.RIL._exitEmergencyCbModeTimeoutID, null);
// Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE.
do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
notEqual(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
run_next_test();
});
@ -141,8 +141,8 @@ add_test(function test_request_exit_emergencyCbMode_explicitly() {
let context = worker.ContextPool._contexts[0];
context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE]();
do_check_eq(context.RIL._isInEmergencyCbMode, true);
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
equal(context.RIL._isInEmergencyCbMode, true);
equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID);
let parcelTypes = [];
context.Buf.newParcel = function(type, options) {
@ -157,13 +157,13 @@ add_test(function test_request_exit_emergencyCbMode_explicitly() {
let postedMessage = workerHelper.postedMessage;
// Should clear timeout event.
do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null);
equal(context.RIL._exitEmergencyCbModeTimeoutID, null);
// Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE.
do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
notEqual(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1);
// Send back the response.
do_check_eq(postedMessage.rilMessageType, "exitEmergencyCbMode");
equal(postedMessage.rilMessageType, "exitEmergencyCbMode");
run_next_test();
});

View File

@ -35,13 +35,13 @@ add_test(function test_fcp_template_for_transparent_structure() {
let berTlv = berHelper.decode(tag_test.length);
let iter = Iterator(berTlv.value);
let tlv = berHelper.searchForNextTag(BER_FCP_FILE_DESCRIPTOR_TAG, iter);
do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_TRANSPARENT]);
equal(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_TRANSPARENT]);
tlv = berHelper.searchForNextTag(BER_FCP_FILE_IDENTIFIER_TAG, iter);
do_check_eq(tlv.value.fileId, 0x2FE2);
equal(tlv.value.fileId, 0x2FE2);
tlv = berHelper.searchForNextTag(BER_FCP_FILE_SIZE_DATA_TAG, iter);
do_check_eq(tlv.value.fileSizeData, 0x0A);
equal(tlv.value.fileSizeData, 0x0A);
run_next_test();
});
@ -73,15 +73,15 @@ add_test(function test_fcp_template_for_linear_fixed_structure() {
let berTlv = berHelper.decode(tag_test.length);
let iter = Iterator(berTlv.value);
let tlv = berHelper.searchForNextTag(BER_FCP_FILE_DESCRIPTOR_TAG, iter);
do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_LINEAR_FIXED]);
do_check_eq(tlv.value.recordLength, 0x1A);
do_check_eq(tlv.value.numOfRecords, 0x01);
equal(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_LINEAR_FIXED]);
equal(tlv.value.recordLength, 0x1A);
equal(tlv.value.numOfRecords, 0x01);
tlv = berHelper.searchForNextTag(BER_FCP_FILE_IDENTIFIER_TAG, iter);
do_check_eq(tlv.value.fileId, 0x6F40);
equal(tlv.value.fileId, 0x6F40);
tlv = berHelper.searchForNextTag(BER_FCP_FILE_SIZE_DATA_TAG, iter);
do_check_eq(tlv.value.fileSizeData, 0x1A);
equal(tlv.value.fileSizeData, 0x1A);
run_next_test();
});

View File

@ -25,19 +25,19 @@ add_test(function test_icc_get_card_lock_enabled() {
buf.sendParcel = function fakeSendParcel() {
// Request Type.
do_check_eq(this.readInt32(), REQUEST_QUERY_FACILITY_LOCK)
equal(this.readInt32(), REQUEST_QUERY_FACILITY_LOCK)
// Token : we don't care.
this.readInt32();
// Data
let parcel = this.readStringList();
do_check_eq(parcel.length, ril.v5Legacy ? 3 : 4);
do_check_eq(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]);
do_check_eq(parcel[1], "");
do_check_eq(parcel[2], serviceClass.toString());
equal(parcel.length, ril.v5Legacy ? 3 : 4);
equal(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]);
equal(parcel[1], "");
equal(parcel[2], serviceClass.toString());
if (!ril.v5Legacy) {
do_check_eq(parcel[3], ril.aid);
equal(parcel[3], ril.aid);
}
};
@ -64,16 +64,16 @@ add_test(function test_path_id_for_spid_and_spn() {
// Test SIM
RIL.appType = CARD_APPTYPE_SIM;
do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI),
equal(ICCFileHelper.getEFPath(ICC_EF_SPDI),
EF_PATH_MF_SIM + EF_PATH_DF_GSM);
do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPN),
equal(ICCFileHelper.getEFPath(ICC_EF_SPN),
EF_PATH_MF_SIM + EF_PATH_DF_GSM);
// Test USIM
RIL.appType = CARD_APPTYPE_USIM;
do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI),
equal(ICCFileHelper.getEFPath(ICC_EF_SPDI),
EF_PATH_MF_SIM + EF_PATH_ADF_USIM);
do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI),
equal(ICCFileHelper.getEFPath(ICC_EF_SPDI),
EF_PATH_MF_SIM + EF_PATH_ADF_USIM);
run_next_test();
});
@ -96,20 +96,20 @@ add_test(function test_icc_set_card_lock_enabled() {
buf.sendParcel = function fakeSendParcel() {
// Request Type.
do_check_eq(this.readInt32(), REQUEST_SET_FACILITY_LOCK);
equal(this.readInt32(), REQUEST_SET_FACILITY_LOCK);
// Token : we don't care
this.readInt32();
// Data
let parcel = this.readStringList();
do_check_eq(parcel.length, ril.v5Legacy ? 4 : 5);
do_check_eq(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]);
do_check_eq(parcel[1], aEnabled ? "1" : "0");
do_check_eq(parcel[2], aPassword);
do_check_eq(parcel[3], serviceClass.toString());
equal(parcel.length, ril.v5Legacy ? 4 : 5);
equal(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]);
equal(parcel[1], aEnabled ? "1" : "0");
equal(parcel[2], aPassword);
equal(parcel[3], serviceClass.toString());
if (!ril.v5Legacy) {
do_check_eq(parcel[4], ril.aid);
equal(parcel[4], ril.aid);
}
};
@ -144,18 +144,18 @@ add_test(function test_icc_change_card_lock_password() {
buf.sendParcel = function fakeSendParcel() {
// Request Type.
do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
equal(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
// Token : we don't care
this.readInt32();
// Data
let parcel = this.readStringList();
do_check_eq(parcel.length, ril.v5Legacy ? 2 : 3);
do_check_eq(parcel[0], aPassword);
do_check_eq(parcel[1], aNewPassword);
equal(parcel.length, ril.v5Legacy ? 2 : 3);
equal(parcel[0], aPassword);
equal(parcel[1], aNewPassword);
if (!ril.v5Legacy) {
do_check_eq(parcel[2], ril.aid);
equal(parcel[2], ril.aid);
}
};
@ -189,17 +189,17 @@ add_test(function test_icc_unlock_card_lock_pin() {
buf.sendParcel = function fakeSendParcel() {
// Request Type.
do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
equal(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
// Token : we don't care
this.readInt32();
// Data
let parcel = this.readStringList();
do_check_eq(parcel.length, ril.v5Legacy ? 1 : 2);
do_check_eq(parcel[0], aPassword);
equal(parcel.length, ril.v5Legacy ? 1 : 2);
equal(parcel[0], aPassword);
if (!ril.v5Legacy) {
do_check_eq(parcel[1], ril.aid);
equal(parcel[1], ril.aid);
}
};
@ -233,18 +233,18 @@ add_test(function test_icc_unlock_card_lock_puk() {
buf.sendParcel = function fakeSendParcel() {
// Request Type.
do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
equal(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]);
// Token : we don't care
this.readInt32();
// Data
let parcel = this.readStringList();
do_check_eq(parcel.length, ril.v5Legacy ? 2 : 3);
do_check_eq(parcel[0], aPassword);
do_check_eq(parcel[1], aNewPin);
equal(parcel.length, ril.v5Legacy ? 2 : 3);
equal(parcel[0], aPassword);
equal(parcel[1], aNewPin);
if (!ril.v5Legacy) {
do_check_eq(parcel[2], ril.aid);
equal(parcel[2], ril.aid);
}
};
@ -273,15 +273,15 @@ add_test(function test_icc_unlock_card_lock_depersonalization() {
function do_test(aPassword) {
buf.sendParcel = function fakeSendParcel() {
// Request Type.
do_check_eq(this.readInt32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE);
equal(this.readInt32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE);
// Token : we don't care
this.readInt32();
// Data
let parcel = this.readStringList();
do_check_eq(parcel.length, 1);
do_check_eq(parcel[0], aPassword);
equal(parcel.length, 1);
equal(parcel[0], aPassword);
};
ril.iccUnlockCardLock({

View File

@ -28,7 +28,7 @@ add_test(function test_personalization_state() {
ril._isCdma = isCdma;
ril._processICCStatus(iccStatus);
do_check_eq(ril.cardState, geckoCardState);
equal(ril.cardState, geckoCardState);
}
// Test GSM personalization state.
@ -117,7 +117,7 @@ add_test(function test_card_app_state() {
};
ril._processICCStatus(iccStatus);
do_check_eq(ril.cardState, geckoCardState);
equal(ril.cardState, geckoCardState);
}
testCardAppState(CARD_APPSTATE_ILLEGAL,
@ -159,7 +159,7 @@ add_test(function test_icc_permanent_blocked() {
};
ril._processICCStatus(iccStatus);
do_check_eq(ril.cardState, Ci.nsIIccProvider.CARD_STATE_PERMANENT_BLOCKED);
equal(ril.cardState, Ci.nsIIccProvider.CARD_STATE_PERMANENT_BLOCKED);
}
testPermanentBlocked(1,
@ -202,9 +202,9 @@ add_test(function test_icc_without_app_index() {
ril._processICCStatus(iccStatus);
// Should read icc id event if the app index is -1.
do_check_eq(ril.iccInfo.iccid, ICCID);
equal(ril.iccInfo.iccid, ICCID);
// cardState is "unknown" if the app index is -1.
do_check_eq(ril.cardState, GECKO_CARDSTATE_UNKNOWN);
equal(ril.cardState, GECKO_CARDSTATE_UNKNOWN);
run_next_test();
});

View File

@ -21,13 +21,13 @@ add_test(function test_write_timestamp() {
helper.writeTimestamp(dateInput);
dateOutput.setTime(helper.readTimestamp());
do_check_eq(dateInput.getFullYear(), dateOutput.getFullYear());
do_check_eq(dateInput.getMonth(), dateOutput.getMonth());
do_check_eq(dateInput.getDate(), dateOutput.getDate());
do_check_eq(dateInput.getHours(), dateOutput.getHours());
do_check_eq(dateInput.getMinutes(), dateOutput.getMinutes());
do_check_eq(dateInput.getSeconds(), dateOutput.getSeconds());
do_check_eq(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset());
equal(dateInput.getFullYear(), dateOutput.getFullYear());
equal(dateInput.getMonth(), dateOutput.getMonth());
equal(dateInput.getDate(), dateOutput.getDate());
equal(dateInput.getHours(), dateOutput.getHours());
equal(dateInput.getMinutes(), dateOutput.getMinutes());
equal(dateInput.getSeconds(), dateOutput.getSeconds());
equal(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset());
// 2034-01-23 12:34:56 -0800 GMT
let time = Date.UTC(2034, 1, 23, 12, 34, 56);
@ -36,13 +36,13 @@ add_test(function test_write_timestamp() {
helper.writeTimestamp(dateInput);
dateOutput.setTime(helper.readTimestamp());
do_check_eq(dateInput.getFullYear(), dateOutput.getFullYear());
do_check_eq(dateInput.getMonth(), dateOutput.getMonth());
do_check_eq(dateInput.getDate(), dateOutput.getDate());
do_check_eq(dateInput.getHours(), dateOutput.getHours());
do_check_eq(dateInput.getMinutes(), dateOutput.getMinutes());
do_check_eq(dateInput.getSeconds(), dateOutput.getSeconds());
do_check_eq(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset());
equal(dateInput.getFullYear(), dateOutput.getFullYear());
equal(dateInput.getMonth(), dateOutput.getMonth());
equal(dateInput.getDate(), dateOutput.getDate());
equal(dateInput.getHours(), dateOutput.getHours());
equal(dateInput.getMinutes(), dateOutput.getMinutes());
equal(dateInput.getSeconds(), dateOutput.getSeconds());
equal(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset());
run_next_test();
});
@ -58,22 +58,22 @@ add_test(function test_octect_BCD() {
// 23
let number = 23;
let octet = helper.BCDToOctet(number);
do_check_eq(helper.octetToBCD(octet), number);
equal(helper.octetToBCD(octet), number);
// 56
number = 56;
octet = helper.BCDToOctet(number);
do_check_eq(helper.octetToBCD(octet), number);
equal(helper.octetToBCD(octet), number);
// 0x23
octet = 0x23;
number = helper.octetToBCD(octet);
do_check_eq(helper.BCDToOctet(number), octet);
equal(helper.BCDToOctet(number), octet);
// 0x56
octet = 0x56;
number = helper.octetToBCD(octet);
do_check_eq(helper.BCDToOctet(number), octet);
equal(helper.BCDToOctet(number), octet);
run_next_test();
});

View File

@ -17,7 +17,7 @@ add_test(function test_error_message_read_icc_contact () {
function do_test(options, expectedErrorMsg) {
ril.sendChromeMessage = function(message) {
do_check_eq(message.errorMsg, expectedErrorMsg);
equal(message.errorMsg, expectedErrorMsg);
}
ril.readICCContacts(options);
}
@ -51,7 +51,7 @@ add_test(function test_error_message_update_icc_contact() {
function do_test(options, expectedErrorMsg) {
ril.sendChromeMessage = function(message) {
do_check_eq(message.errorMsg, expectedErrorMsg);
equal(message.errorMsg, expectedErrorMsg);
}
ril.updateICCContact(options);
}
@ -371,7 +371,7 @@ add_test(function test_read_icc_contacts() {
let onerror = function onerror(errorMsg) {
do_print("readICCContacts failed: " + errorMsg);
do_check_true(false);
ok(false);
};
contactHelper.readICCContacts(aTestData.simType, aTestData.contactType, onsuccess, onerror);
@ -438,49 +438,49 @@ add_test(function test_update_icc_contact() {
recordHelper.updateADNLike = function(fileId, contact, pin2, onsuccess, onerror) {
if (aContactType === GECKO_CARDCONTACT_TYPE_FDN) {
do_check_eq(fileId, ICC_EF_FDN);
equal(fileId, ICC_EF_FDN);
} else if (aContactType === GECKO_CARDCONTACT_TYPE_ADN) {
do_check_eq(fileId, ICC_EF_ADN);
equal(fileId, ICC_EF_ADN);
}
do_check_eq(pin2, aPin2);
do_check_eq(contact.alphaId, aContact.alphaId);
do_check_eq(contact.number, aContact.number);
equal(pin2, aPin2);
equal(contact.alphaId, aContact.alphaId);
equal(contact.number, aContact.number);
onsuccess();
};
recordHelper.readIAP = function(fileId, recordNumber, onsuccess, onerror) {
do_check_eq(fileId, IAP_FILE_ID);
do_check_eq(recordNumber, ADN_RECORD_ID);
equal(fileId, IAP_FILE_ID);
equal(recordNumber, ADN_RECORD_ID);
onsuccess((aHaveIapIndex) ? [EMAIL_RECORD_ID, ANR0_RECORD_ID]
: [0xff, 0xff]);
};
recordHelper.updateIAP = function(fileId, recordNumber, iap, onsuccess, onerror) {
do_check_eq(fileId, IAP_FILE_ID);
do_check_eq(recordNumber, ADN_RECORD_ID);
equal(fileId, IAP_FILE_ID);
equal(recordNumber, ADN_RECORD_ID);
onsuccess();
};
recordHelper.updateEmail = function(pbr, recordNumber, email, adnRecordId, onsuccess, onerror) {
do_check_eq(pbr.email.fileId, EMAIL_FILE_ID);
equal(pbr.email.fileId, EMAIL_FILE_ID);
if (pbr.email.fileType === ICC_USIM_TYPE1_TAG) {
do_check_eq(recordNumber, ADN_RECORD_ID);
equal(recordNumber, ADN_RECORD_ID);
} else if (pbr.email.fileType === ICC_USIM_TYPE2_TAG) {
do_check_eq(recordNumber, EMAIL_RECORD_ID);
equal(recordNumber, EMAIL_RECORD_ID);
}
do_check_eq(email, aContact.email);
equal(email, aContact.email);
onsuccess();
};
recordHelper.updateANR = function(pbr, recordNumber, number, adnRecordId, onsuccess, onerror) {
do_check_eq(pbr.anr0.fileId, ANR0_FILE_ID);
equal(pbr.anr0.fileId, ANR0_FILE_ID);
if (pbr.anr0.fileType === ICC_USIM_TYPE1_TAG) {
do_check_eq(recordNumber, ADN_RECORD_ID);
equal(recordNumber, ADN_RECORD_ID);
} else if (pbr.anr0.fileType === ICC_USIM_TYPE2_TAG) {
do_check_eq(recordNumber, ANR0_RECORD_ID);
equal(recordNumber, ANR0_RECORD_ID);
}
if (Array.isArray(aContact.anr)) {
do_check_eq(number, aContact.anr[0]);
equal(number, aContact.anr[0]);
}
onsuccess();
};
@ -506,7 +506,7 @@ add_test(function test_update_icc_contact() {
};
contactHelper.updateICCContact(aSimType, aContactType, aContact, aPin2, onsuccess, onerror);
do_check_true(isSuccess);
ok(isSuccess);
}
let contacts = [
@ -619,12 +619,12 @@ add_test(function test_update_icc_contact_with_remove_type1_attr() {
};
recordHelper.updateEmail = function(pbr, recordNumber, email, adnRecordId, onsuccess, onerror) {
do_check_true(email == null);
ok(email == null);
onsuccess();
};
recordHelper.updateANR = function(pbr, recordNumber, number, adnRecordId, onsuccess, onerror) {
do_check_true(number == null);
ok(number == null);
onsuccess();
};
@ -651,12 +651,12 @@ add_test(function test_update_icc_contact_with_remove_type1_attr() {
};
let successCb = function() {
do_check_true(true);
ok(true);
};
let errorCb = function(errorMsg) {
do_print(errorMsg);
do_check_true(false);
ok(false);
};
contactHelper.updateICCContact(CARD_APPTYPE_USIM,
@ -693,13 +693,13 @@ add_test(function test_find_free_icc_contact_sim() {
};
let successCb = function(pbrIndex, recordId) {
do_check_eq(pbrIndex, PBR_INDEX);
equal(pbrIndex, PBR_INDEX);
records[recordId] = {};
};
let errorCb = function(errorMsg) {
do_print(errorMsg);
do_check_true(false);
ok(false);
};
for (let i = 0; i < MAX_RECORDS; i++) {
@ -708,15 +708,15 @@ add_test(function test_find_free_icc_contact_sim() {
successCb, errorCb);
}
// The 1st element, records[0], is null.
do_check_eq(records.length - 1, MAX_RECORDS);
equal(records.length - 1, MAX_RECORDS);
// Now the EF is full, so finding a free one should result failure.
successCb = function(pbrIndex, recordId) {
do_check_true(false);
ok(false);
};
errorCb = function(errorMsg) {
do_check_true(errorMsg === "No free record found.");
ok(errorMsg === "No free record found.");
};
contactHelper.findFreeICCContact(CARD_APPTYPE_SIM, GECKO_CARDCONTACT_TYPE_ADN,
successCb, errorCb);
@ -756,12 +756,12 @@ add_test(function test_find_free_icc_contact_usim() {
};
let successCb = function(pbrIndex, recordId) {
do_check_eq(pbrIndex, 0);
equal(pbrIndex, 0);
pbrs[pbrIndex].adn.records[recordId] = {};
};
let errorCb = function(errorMsg) {
do_check_true(false);
ok(false);
};
contactHelper.findFreeICCContact(CARD_APPTYPE_USIM,
@ -771,8 +771,8 @@ add_test(function test_find_free_icc_contact_usim() {
// Now the EF_ADN in the 1st phonebook set is full, so the next free contact
// will come from the 2nd phonebook set.
successCb = function(pbrIndex, recordId) {
do_check_eq(pbrIndex, 1);
do_check_eq(recordId, 1);
equal(pbrIndex, 1);
equal(recordId, 1);
}
contactHelper.findFreeICCContact(CARD_APPTYPE_USIM,
GECKO_CARDCONTACT_TYPE_ADN,

View File

@ -18,12 +18,12 @@ add_test(function test_load_linear_fixed_ef() {
io.getResponse = function fakeGetResponse(options) {
// When recordSize is provided, loadLinearFixedEF should call iccIO directly.
do_check_true(false);
ok(false);
run_next_test();
};
ril.iccIO = function fakeIccIO(options) {
do_check_true(true);
ok(true);
run_next_test();
};
@ -40,13 +40,13 @@ add_test(function test_load_linear_fixed_ef() {
let io = context.ICCIOHelper;
io.getResponse = function fakeGetResponse(options) {
do_check_true(true);
ok(true);
run_next_test();
};
ril.iccIO = function fakeIccIO(options) {
// When recordSize is not provided, loadLinearFixedEF should call getResponse.
do_check_true(false);
ok(false);
run_next_test();
};
@ -65,7 +65,7 @@ add_test(function test_process_icc_io_error() {
let called = false;
function errorCb(errorMsg) {
called = true;
do_check_eq(errorMsg, expectedErrorMsg);
equal(errorMsg, expectedErrorMsg);
}
// Write sw1 and sw2 to buffer.
@ -78,7 +78,7 @@ add_test(function test_process_icc_io_error() {
onerror: errorCb});
// onerror callback should be triggered.
do_check_true(called);
ok(called);
}
let TEST_DATA = [
@ -126,7 +126,7 @@ add_test(function test_icc_io_get_response_for_transparent_structure() {
structure: EF_STRUCTURE_TRANSPARENT};
iccioHelper.processICCIOGetResponse(options);
do_check_eq(options.fileSize, 0x0A);
equal(options.fileSize, 0x0A);
}
run_next_test();
@ -164,9 +164,9 @@ add_test(function test_icc_io_get_response_for_linear_fixed_structure() {
structure: EF_STRUCTURE_LINEAR_FIXED};
iccioHelper.processICCIOGetResponse(options);
do_check_eq(options.fileSize, 0x1A);
do_check_eq(options.recordSize, 0x1A);
do_check_eq(options.totalRecords, 0x01);
equal(options.fileSize, 0x1A);
equal(options.recordSize, 0x1A);
equal(options.totalRecords, 0x01);
}
run_next_test();

View File

@ -24,7 +24,7 @@ add_test(function test_read_icc_ucs2_string() {
for (let i = 0; i < ffLen; i++) {
helper.writeHexOctet(0xff);
}
do_check_eq(iccHelper.readICCUCS2String(0x80, (2 * text.length) + ffLen), text);
equal(iccHelper.readICCUCS2String(0x80, (2 * text.length) + ffLen), text);
// 0x81
let array = [0x08, 0xd2, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0xca,
@ -33,7 +33,7 @@ add_test(function test_read_icc_ucs2_string() {
for (let i = 0; i < len; i++) {
helper.writeHexOctet(array[i]);
}
do_check_eq(iccHelper.readICCUCS2String(0x81, len), "Mozilla\u694a");
equal(iccHelper.readICCUCS2String(0x81, len), "Mozilla\u694a");
// 0x82
let array2 = [0x08, 0x69, 0x00, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61,
@ -42,7 +42,7 @@ add_test(function test_read_icc_ucs2_string() {
for (let i = 0; i < len2; i++) {
helper.writeHexOctet(array2[i]);
}
do_check_eq(iccHelper.readICCUCS2String(0x82, len2), "Mozilla\u694a");
equal(iccHelper.readICCUCS2String(0x82, len2), "Mozilla\u694a");
run_next_test();
});
@ -66,7 +66,7 @@ add_test(function test_read_dialling_number() {
};
for (let i = 0; i < str.length; i++) {
do_check_eq(str.substring(0, i - 1), // -1 for the TON
equal(str.substring(0, i - 1), // -1 for the TON
iccHelper.readDiallingNumber(i));
}
@ -104,10 +104,10 @@ add_test(function test_read_8bit_unpacked_to_string() {
helper.writeHexOctet(0xff);
}
do_check_eq(iccHelper.read8BitUnpackedToString(PDU_NL_EXTENDED_ESCAPE),
equal(iccHelper.read8BitUnpackedToString(PDU_NL_EXTENDED_ESCAPE),
langTable.substring(0, PDU_NL_EXTENDED_ESCAPE));
do_check_eq(iccHelper.read8BitUnpackedToString(2), " ");
do_check_eq(iccHelper.read8BitUnpackedToString(langTable.length -
equal(iccHelper.read8BitUnpackedToString(2), " ");
equal(iccHelper.read8BitUnpackedToString(langTable.length -
PDU_NL_EXTENDED_ESCAPE - 1 + ffLen),
langTable.substring(PDU_NL_EXTENDED_ESCAPE + 1));
@ -118,19 +118,19 @@ add_test(function test_read_8bit_unpacked_to_string() {
}
// Read string before RESERVED_CONTROL.
do_check_eq(iccHelper.read8BitUnpackedToString(PDU_NL_RESERVED_CONTROL * 2),
equal(iccHelper.read8BitUnpackedToString(PDU_NL_RESERVED_CONTROL * 2),
langShiftTable.substring(0, PDU_NL_RESERVED_CONTROL));
// ESCAPE + RESERVED_CONTROL will become ' '.
do_check_eq(iccHelper.read8BitUnpackedToString(2), " ");
equal(iccHelper.read8BitUnpackedToString(2), " ");
// Read string between RESERVED_CONTROL and EXTENDED_ESCAPE.
do_check_eq(iccHelper.read8BitUnpackedToString(
equal(iccHelper.read8BitUnpackedToString(
(PDU_NL_EXTENDED_ESCAPE - PDU_NL_RESERVED_CONTROL - 1) * 2),
langShiftTable.substring(PDU_NL_RESERVED_CONTROL + 1,
PDU_NL_EXTENDED_ESCAPE));
// ESCAPE + ESCAPE will become ' '.
do_check_eq(iccHelper.read8BitUnpackedToString(2), " ");
equal(iccHelper.read8BitUnpackedToString(2), " ");
// Read remaining string.
do_check_eq(iccHelper.read8BitUnpackedToString(
equal(iccHelper.read8BitUnpackedToString(
(langShiftTable.length - PDU_NL_EXTENDED_ESCAPE - 1) * 2),
langShiftTable.substring(PDU_NL_EXTENDED_ESCAPE + 1));
@ -157,18 +157,18 @@ add_test(function test_write_string_to_8bit_unpacked() {
iccHelper.writeStringTo8BitUnpacked(langTable.length + ffLen, langTable);
for (let i = 0; i < langTable.length; i++) {
do_check_eq(helper.readHexOctet(), i);
equal(helper.readHexOctet(), i);
}
for (let i = 0; i < ffLen; i++) {
do_check_eq(helper.readHexOctet(), 0xff);
equal(helper.readHexOctet(), 0xff);
}
// Test 2, write GSM extended alphabets.
str = "\u000c\u20ac";
iccHelper.writeStringTo8BitUnpacked(4, str);
do_check_eq(iccHelper.read8BitUnpackedToString(4), str);
equal(iccHelper.read8BitUnpackedToString(4), str);
// Test 3, write GSM and GSM extended alphabets.
// \u000c, \u20ac are from gsm extended alphabets.
@ -181,7 +181,7 @@ add_test(function test_write_string_to_8bit_unpacked() {
// "Totally 7 octets are to be written."
iccHelper.writeStringTo8BitUnpacked(7, str);
do_check_eq(iccHelper.read8BitUnpackedToString(7), str);
equal(iccHelper.read8BitUnpackedToString(7), str);
run_next_test();
});
@ -202,26 +202,26 @@ add_test(function test_write_string_to_8bit_unpacked_with_max_octets_written() {
iccHelper.writeStringTo8BitUnpacked(3, langTable.substring(0, 4));
helper.writeHexOctet(0xff); // dummy octet.
for (let i = 0; i < 3; i++) {
do_check_eq(helper.readHexOctet(), i);
equal(helper.readHexOctet(), i);
}
do_check_false(helper.readHexOctet() == 4);
ok(helper.readHexOctet() != 4);
// \u000c is GSM extended alphabet, 2 octets.
// \u00a3 is GSM alphabet, 1 octet.
let str = "\u000c\u00a3";
iccHelper.writeStringTo8BitUnpacked(3, str);
do_check_eq(iccHelper.read8BitUnpackedToString(3), str);
equal(iccHelper.read8BitUnpackedToString(3), str);
str = "\u00a3\u000c";
iccHelper.writeStringTo8BitUnpacked(3, str);
do_check_eq(iccHelper.read8BitUnpackedToString(3), str);
equal(iccHelper.read8BitUnpackedToString(3), str);
// 2 GSM extended alphabets cost 4 octets, but maximum is 3, so only the 1st
// alphabet can be written.
str = "\u000c\u000c";
iccHelper.writeStringTo8BitUnpacked(3, str);
helper.writeHexOctet(0xff); // dummy octet.
do_check_eq(iccHelper.read8BitUnpackedToString(4), str.substring(0, 1));
equal(iccHelper.read8BitUnpackedToString(4), str.substring(0, 1));
run_next_test();
});
@ -244,28 +244,28 @@ add_test(function test_read_alpha_identifier() {
for (let i = 0; i < ffLen; i++) {
helper.writeHexOctet(0xff);
}
do_check_eq(iccHelper.readAlphaIdentifier(1 + (2 * text.length) + ffLen), text);
equal(iccHelper.readAlphaIdentifier(1 + (2 * text.length) + ffLen), text);
// UCS2: 0x81
let array = [0x81, 0x08, 0xd2, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0xca, 0xff, 0xff];
for (let i = 0; i < array.length; i++) {
helper.writeHexOctet(array[i]);
}
do_check_eq(iccHelper.readAlphaIdentifier(array.length), "Mozilla\u694a");
equal(iccHelper.readAlphaIdentifier(array.length), "Mozilla\u694a");
// UCS2: 0x82
let array2 = [0x82, 0x08, 0x69, 0x00, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0xca, 0xff, 0xff];
for (let i = 0; i < array2.length; i++) {
helper.writeHexOctet(array2[i]);
}
do_check_eq(iccHelper.readAlphaIdentifier(array2.length), "Mozilla\u694a");
equal(iccHelper.readAlphaIdentifier(array2.length), "Mozilla\u694a");
// GSM 8 Bit Unpacked
const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
for (let i = 0; i < PDU_NL_EXTENDED_ESCAPE; i++) {
helper.writeHexOctet(i);
}
do_check_eq(iccHelper.readAlphaIdentifier(PDU_NL_EXTENDED_ESCAPE),
equal(iccHelper.readAlphaIdentifier(PDU_NL_EXTENDED_ESCAPE),
langTable.substring(0, PDU_NL_EXTENDED_ESCAPE));
run_next_test();
@ -284,36 +284,36 @@ add_test(function test_write_alpha_identifier() {
// Removal
iccHelper.writeAlphaIdentifier(10, null);
do_check_eq(iccHelper.readAlphaIdentifier(10), "");
equal(iccHelper.readAlphaIdentifier(10), "");
// GSM 8 bit
let str = "Mozilla";
iccHelper.writeAlphaIdentifier(str.length + ffLen, str);
do_check_eq(iccHelper.readAlphaIdentifier(str.length + ffLen), str);
equal(iccHelper.readAlphaIdentifier(str.length + ffLen), str);
// UCS2
str = "Mozilla\u694a";
iccHelper.writeAlphaIdentifier(str.length * 2 + ffLen, str);
// * 2 for each character will be encoded to UCS2 alphabets.
do_check_eq(iccHelper.readAlphaIdentifier(str.length * 2 + ffLen), str);
equal(iccHelper.readAlphaIdentifier(str.length * 2 + ffLen), str);
// Test with maximum octets written.
// 1 coding scheme (0x80) and 1 UCS2 character, total 3 octets.
str = "\u694a";
iccHelper.writeAlphaIdentifier(3, str);
do_check_eq(iccHelper.readAlphaIdentifier(3), str);
equal(iccHelper.readAlphaIdentifier(3), str);
// 1 coding scheme (0x80) and 2 UCS2 characters, total 5 octets.
// numOctets is limited to 4, so only 1 UCS2 character can be written.
str = "\u694a\u694a";
iccHelper.writeAlphaIdentifier(4, str);
helper.writeHexOctet(0xff); // dummy octet.
do_check_eq(iccHelper.readAlphaIdentifier(5), str.substring(0, 1));
equal(iccHelper.readAlphaIdentifier(5), str.substring(0, 1));
// Write 0 octet.
iccHelper.writeAlphaIdentifier(0, "1");
helper.writeHexOctet(0xff); // dummy octet.
do_check_eq(iccHelper.readAlphaIdentifier(1), "");
equal(iccHelper.readAlphaIdentifier(1), "");
run_next_test();
});
@ -346,10 +346,10 @@ add_test(function test_read_alpha_id_dialling_number() {
let contactR = iccHelper.readAlphaIdDiallingNumber(recordSize);
if (contact.alphaId == "" && contact.number == "") {
do_check_eq(contactR, null);
equal(contactR, null);
} else {
do_check_eq(contactR.alphaId, contact.alphaId);
do_check_eq(contactR.number, contact.number);
equal(contactR.alphaId, contact.alphaId);
equal(contactR.number, contact.number);
}
}
@ -377,8 +377,8 @@ add_test(function test_write_alpha_id_dialling_number() {
contactW.number);
let contactR = helper.readAlphaIdDiallingNumber(recordSize);
do_check_eq(contactW.alphaId, contactR.alphaId);
do_check_eq(contactW.number, contactR.number);
equal(contactW.alphaId, contactR.alphaId);
equal(contactW.number, contactR.number);
// Write a contact with alphaId encoded in UCS2 and number has '+'.
let contactUCS2 = {
@ -388,13 +388,13 @@ add_test(function test_write_alpha_id_dialling_number() {
helper.writeAlphaIdDiallingNumber(recordSize, contactUCS2.alphaId,
contactUCS2.number);
contactR = helper.readAlphaIdDiallingNumber(recordSize);
do_check_eq(contactUCS2.alphaId, contactR.alphaId);
do_check_eq(contactUCS2.number, contactR.number);
equal(contactUCS2.alphaId, contactR.alphaId);
equal(contactUCS2.number, contactR.number);
// Write a null contact (Removal).
helper.writeAlphaIdDiallingNumber(recordSize);
contactR = helper.readAlphaIdDiallingNumber(recordSize);
do_check_eq(contactR, null);
equal(contactR, null);
// Write a longer alphaId/dialling number
// Dialling Number : Maximum 20 digits(10 octets).
@ -408,16 +408,16 @@ add_test(function test_write_alpha_id_dialling_number() {
helper.writeAlphaIdDiallingNumber(recordSize, longContact.alphaId,
longContact.number);
contactR = helper.readAlphaIdDiallingNumber(recordSize);
do_check_eq(contactR.alphaId, "AAAAAAAAABBBBBBBBB");
do_check_eq(contactR.number, "12345678901234567890");
equal(contactR.alphaId, "AAAAAAAAABBBBBBBBB");
equal(contactR.number, "12345678901234567890");
// Add '+' to number and test again.
longContact.number = "+123456789012345678901234567890";
helper.writeAlphaIdDiallingNumber(recordSize, longContact.alphaId,
longContact.number);
contactR = helper.readAlphaIdDiallingNumber(recordSize);
do_check_eq(contactR.alphaId, "AAAAAAAAABBBBBBBBB");
do_check_eq(contactR.number, "+12345678901234567890");
equal(contactR.alphaId, "AAAAAAAAABBBBBBBBB");
equal(contactR.number, "+12345678901234567890");
run_next_test();
});
@ -434,18 +434,18 @@ add_test(function test_write_dialling_number() {
let number = "+123456";
let len = 4;
helper.writeDiallingNumber(number);
do_check_eq(helper.readDiallingNumber(len), number);
equal(helper.readDiallingNumber(len), number);
// without +
number = "987654";
len = 4;
helper.writeDiallingNumber(number);
do_check_eq(helper.readDiallingNumber(len), number);
equal(helper.readDiallingNumber(len), number);
number = "9876543";
len = 5;
helper.writeDiallingNumber(number);
do_check_eq(helper.readDiallingNumber(len), number);
equal(helper.readDiallingNumber(len), number);
run_next_test();
});
@ -513,9 +513,9 @@ add_test(function test_write_number_with_length() {
expectedNumber = expectedNumber || number;
iccHelper.writeNumberWithLength(number);
let numLen = helper.readHexOctet();
do_check_eq(expectedNumber, iccHelper.readDiallingNumber(numLen));
equal(expectedNumber, iccHelper.readDiallingNumber(numLen));
for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES - numLen); i++) {
do_check_eq(0xff, helper.readHexOctet());
equal(0xff, helper.readHexOctet());
}
}
@ -539,7 +539,7 @@ add_test(function test_write_number_with_length() {
// null
iccHelper.writeNumberWithLength(null);
for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES + 1); i++) {
do_check_eq(0xff, helper.readHexOctet());
equal(0xff, helper.readHexOctet());
}
run_next_test();

View File

@ -52,13 +52,13 @@ add_test(function test_read_pbr() {
};
let successCb = function successCb(pbrs) {
do_check_eq(pbrs[0].adn.fileId, 0x4f3a);
do_check_eq(pbrs.length, 1);
equal(pbrs[0].adn.fileId, 0x4f3a);
equal(pbrs.length, 1);
};
let errorCb = function errorCb(errorMsg) {
do_print("Reading EF_PBR failed, msg = " + errorMsg);
do_check_true(false);
ok(false);
};
record.readPBR(successCb, errorCb);
@ -69,7 +69,7 @@ add_test(function test_read_pbr() {
ifLoadEF = true;
}
record.readPBR(successCb, errorCb);
do_check_false(ifLoadEF);
ok(!ifLoadEF);
run_next_test();
});
@ -117,13 +117,13 @@ add_test(function test_read_email() {
// fileId and recordNumber are dummy arguments.
record.readEmail(fileId, type, recordNumber, function(email) {
do_check_eq(email, expectedResult);
equal(email, expectedResult);
});
};
doTestReadEmail(ICC_USIM_TYPE1_TAG, "email@mozilla.com$#");
doTestReadEmail(ICC_USIM_TYPE2_TAG, "email@mozilla.com");
do_check_eq(record._emailRecordSize, recordSize);
equal(record._emailRecordSize, recordSize);
run_next_test();
});
@ -164,29 +164,29 @@ add_test(function test_update_email() {
count++;
// Request Type.
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
equal(this.readInt32(), REQUEST_SIM_IO);
// Token : we don't care
this.readInt32();
// command.
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
// fileId.
do_check_eq(this.readInt32(), fileId);
equal(this.readInt32(), fileId);
// pathId.
do_check_eq(this.readString(),
equal(this.readString(),
EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK);
// p1.
do_check_eq(this.readInt32(), recordNumber);
equal(this.readInt32(), recordNumber);
// p2.
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
// p3.
do_check_eq(this.readInt32(), recordSize);
equal(this.readInt32(), recordSize);
// data.
let strLen = this.readInt32();
@ -195,14 +195,14 @@ add_test(function test_update_email() {
email = iccHelper.read8BitUnpackedToString(recordSize);
} else {
email = iccHelper.read8BitUnpackedToString(recordSize - 2);
do_check_eq(pduHelper.readHexOctet(), pbr.adn.sfi);
do_check_eq(pduHelper.readHexOctet(), expectedAdnRecordId);
equal(pduHelper.readHexOctet(), pbr.adn.sfi);
equal(pduHelper.readHexOctet(), expectedAdnRecordId);
}
this.readStringDelimiter(strLen);
do_check_eq(email, expectedEmail);
equal(email, expectedEmail);
// pin2.
do_check_eq(this.readString(), null);
equal(this.readString(), null);
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
@ -262,12 +262,12 @@ add_test(function test_read_anr() {
// fileId and recordNumber are dummy arguments.
record.readANR(fileId, fileType, recordNumber, function(anr) {
do_check_eq(anr, expectedResult);
equal(anr, expectedResult);
});
};
doTestReadAnr(ICC_USIM_TYPE1_TAG, "0123456");
do_check_eq(record._anrRecordSize, recordSize);
equal(record._anrRecordSize, recordSize);
run_next_test();
});
@ -308,47 +308,47 @@ add_test(function test_update_anr() {
count++;
// Request Type.
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
equal(this.readInt32(), REQUEST_SIM_IO);
// Token : we don't care
this.readInt32();
// command.
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
// fileId.
do_check_eq(this.readInt32(), fileId);
equal(this.readInt32(), fileId);
// pathId.
do_check_eq(this.readString(),
equal(this.readString(),
EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK);
// p1.
do_check_eq(this.readInt32(), recordNumber);
equal(this.readInt32(), recordNumber);
// p2.
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
// p3.
do_check_eq(this.readInt32(), recordSize);
equal(this.readInt32(), recordSize);
// data.
let strLen = this.readInt32();
// EF_AAS, ignore.
pduHelper.readHexOctet();
do_check_eq(iccHelper.readNumberWithLength(), expectedANR);
equal(iccHelper.readNumberWithLength(), expectedANR);
// EF_CCP, ignore.
pduHelper.readHexOctet();
// EF_EXT1, ignore.
pduHelper.readHexOctet();
if (pbr.anr0.fileType === ICC_USIM_TYPE2_TAG) {
do_check_eq(pduHelper.readHexOctet(), pbr.adn.sfi);
do_check_eq(pduHelper.readHexOctet(), expectedAdnRecordId);
equal(pduHelper.readHexOctet(), pbr.adn.sfi);
equal(pduHelper.readHexOctet(), expectedAdnRecordId);
}
this.readStringDelimiter(strLen);
// pin2.
do_check_eq(this.readString(), null);
equal(this.readString(), null);
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
@ -406,14 +406,14 @@ add_test(function test_read_iap() {
let successCb = function successCb(iap) {
for (let i = 0; i < iap.length; i++) {
do_check_eq(expectedIAP[i], iap[i]);
equal(expectedIAP[i], iap[i]);
}
run_next_test();
}.bind(this);
let errorCb = function errorCb(errorMsg) {
do_print(errorMsg);
do_check_true(false);
ok(false);
run_next_test();
}.bind(this);
@ -453,39 +453,39 @@ add_test(function test_update_iap() {
function do_test(expectedIAP) {
buf.sendParcel = function() {
// Request Type.
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
equal(this.readInt32(), REQUEST_SIM_IO);
// Token : we don't care
this.readInt32();
// command.
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
// fileId.
do_check_eq(this.readInt32(), fileId);
equal(this.readInt32(), fileId);
// pathId.
do_check_eq(this.readString(),
equal(this.readString(),
EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK);
// p1.
do_check_eq(this.readInt32(), recordNumber);
equal(this.readInt32(), recordNumber);
// p2.
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
// p3.
do_check_eq(this.readInt32(), recordSize);
equal(this.readInt32(), recordSize);
// data.
let strLen = this.readInt32();
for (let i = 0; i < recordSize; i++) {
do_check_eq(expectedIAP[i], pduHelper.readHexOctet());
equal(expectedIAP[i], pduHelper.readHexOctet());
}
this.readStringDelimiter(strLen);
// pin2.
do_check_eq(this.readString(), null);
equal(this.readString(), null);
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
@ -528,39 +528,39 @@ add_test(function test_update_adn_like() {
buf.sendParcel = function() {
// Request Type.
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
equal(this.readInt32(), REQUEST_SIM_IO);
// Token : we don't care
this.readInt32();
// command.
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
// fileId.
do_check_eq(this.readInt32(), fileId);
equal(this.readInt32(), fileId);
// pathId.
do_check_eq(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM);
equal(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM);
// p1.
do_check_eq(this.readInt32(), 1);
equal(this.readInt32(), 1);
// p2.
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
// p3.
do_check_eq(this.readInt32(), 0x20);
equal(this.readInt32(), 0x20);
// data.
let contact = pdu.readAlphaIdDiallingNumber(0x20);
do_check_eq(contact.alphaId, "test");
do_check_eq(contact.number, "123456");
equal(contact.alphaId, "test");
equal(contact.number, "123456");
// pin2.
if (fileId == ICC_EF_ADN) {
do_check_eq(this.readString(), null);
equal(this.readString(), null);
} else {
do_check_eq(this.readString(), "1111");
equal(this.readString(), "1111");
}
if (!ril.v5Legacy) {
@ -631,12 +631,12 @@ add_test(function test_find_free_record_id() {
recordHelper.findFreeRecordId(
fileId,
function(recordId) {
do_check_eq(recordId, 2);
equal(recordId, 2);
run_next_test();
}.bind(this),
function(errorMsg) {
do_print(errorMsg);
do_check_true(false);
ok(false);
run_next_test();
}.bind(this));
});
@ -663,15 +663,15 @@ add_test(function test_fetch_icc_recodes() {
RIL.appType = CARD_APPTYPE_SIM;
iccRecord.fetchICCRecords();
do_check_eq(fetchTag, 0x01);
equal(fetchTag, 0x01);
RIL.appType = CARD_APPTYPE_RUIM;
iccRecord.fetchICCRecords();
do_check_eq(fetchTag, 0x02);
equal(fetchTag, 0x02);
RIL.appType = CARD_APPTYPE_USIM;
iccRecord.fetchICCRecords();
do_check_eq(fetchTag, 0x01);
equal(fetchTag, 0x01);
run_next_test();
});
@ -711,7 +711,7 @@ add_test(function test_handling_iccid() {
record.readICCID();
do_check_eq(ril.iccInfo.iccid, expectedICCID);
equal(ril.iccInfo.iccid, expectedICCID);
}
// Invalid value 0xE at high nibbile + low nibbile contains 0xF.

View File

@ -19,9 +19,9 @@ add_test(function test_is_icc_service_available() {
function test_table(sst, geckoService, simEnabled, usimEnabled) {
RIL.iccInfoPrivate.sst = sst;
RIL.appType = CARD_APPTYPE_SIM;
do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), simEnabled);
equal(ICCUtilsHelper.isICCServiceAvailable(geckoService), simEnabled);
RIL.appType = CARD_APPTYPE_USIM;
do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), usimEnabled);
equal(ICCUtilsHelper.isICCServiceAvailable(geckoService), usimEnabled);
}
test_table([0x08], "ADN", true, false);
@ -41,9 +41,9 @@ add_test(function test_is_gsm_8bit_alphabet() {
const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
const langShiftTable = PDU_NL_SINGLE_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT];
do_check_eq(ICCUtilsHelper.isGsm8BitAlphabet(langTable), true);
do_check_eq(ICCUtilsHelper.isGsm8BitAlphabet(langShiftTable), true);
do_check_eq(ICCUtilsHelper.isGsm8BitAlphabet("\uaaaa"), false);
equal(ICCUtilsHelper.isGsm8BitAlphabet(langTable), true);
equal(ICCUtilsHelper.isGsm8BitAlphabet(langShiftTable), true);
equal(ICCUtilsHelper.isGsm8BitAlphabet("\uaaaa"), false);
run_next_test();
});
@ -93,14 +93,14 @@ add_test(function test_parse_pbr_tlvs() {
];
let pbr = context.ICCUtilsHelper.parsePbrTlvs(pbrTlvs);
do_check_eq(pbr.adn.fileId, 0x4F3a);
do_check_eq(pbr.iap.fileId, 0x4F25);
do_check_eq(pbr.pbc.fileId, 0x4F09);
do_check_eq(pbr.email.fileId, 0x4F50);
do_check_eq(pbr.anr0.fileId, 0x4f11);
do_check_eq(pbr.anr1.fileId, 0x4f12);
do_check_eq(pbr.ccp1.fileId, 0x4F3D);
do_check_eq(pbr.ext1.fileId, 0x4F4A);
equal(pbr.adn.fileId, 0x4F3a);
equal(pbr.iap.fileId, 0x4F25);
equal(pbr.pbc.fileId, 0x4F09);
equal(pbr.email.fileId, 0x4F50);
equal(pbr.anr0.fileId, 0x4f11);
equal(pbr.anr1.fileId, 0x4f12);
equal(pbr.ccp1.fileId, 0x4F3D);
equal(pbr.ext1.fileId, 0x4F4A);
run_next_test();
});
@ -117,12 +117,12 @@ add_test(function test_mcc_mnc_parsing() {
let result = helper.parseMccMncFromImsi(imsi, mncLength);
if (!imsi) {
do_check_eq(result, null);
equal(result, null);
return;
}
do_check_eq(result.mcc, expectedMcc);
do_check_eq(result.mnc, expectedMnc);
equal(result.mcc, expectedMcc);
equal(result.mnc, expectedMnc);
}
// Test the imsi is null.
@ -153,10 +153,10 @@ add_test(function test_get_network_name_from_icc() {
operatorData.lac);
if (expectedResult == null) {
do_check_eq(result, expectedResult);
equal(result, expectedResult);
} else {
do_check_eq(result.fullName, expectedResult.longName);
do_check_eq(result.shortName, expectedResult.shortName);
equal(result.fullName, expectedResult.longName);
equal(result.shortName, expectedResult.shortName);
}
}
@ -311,7 +311,7 @@ add_test(function test_is_cphs_service_available() {
RIL.iccInfoPrivate.cphsSt.set(cphsSt);
for (let service in GECKO_ICC_SERVICES.cphs) {
do_check_eq(ICCUtilsHelper.isCphsServiceAvailable(service),
equal(ICCUtilsHelper.isCphsServiceAvailable(service),
geckoService == service);
}
}

View File

@ -364,17 +364,17 @@ add_test(function test_load_icon_basic() {
let onsuccess = function(icons) {
// Query one record at a time.
do_check_eq(icons.length, 1);
do_check_eq(icons[0].length, expected.length);
equal(icons.length, 1);
equal(icons[0].length, expected.length);
for (let i = 0; i < icons[0].length; i++) {
// Read the i_th image of the record.
let icon = icons[0][i];
let exp = expected[i];
do_check_eq(icon.width, exp.width);
do_check_eq(icon.height, exp.height);
do_check_eq(icon.pixels.length, exp.pixels.length);
equal(icon.width, exp.width);
equal(icon.height, exp.height);
equal(icon.pixels.length, exp.pixels.length);
for (let j = 0; j < icon.pixels.length; j++) {
do_check_eq(icon.pixels[j], exp.pixels[j]);
equal(icon.pixels[j], exp.pixels[j]);
}
}
};
@ -746,17 +746,17 @@ add_test(function test_load_icons() {
};
let onsuccess = function(icons) {
do_check_eq(icons.length, test_data.expected.length);
equal(icons.length, test_data.expected.length);
for (let i = 0; i < icons.length; i++) {
for (let j = 0; j < icons[i].length; j++) {
// Read the j_th image from the i_th record.
let icon = icons[i][j];
let expected = test_data.expected[i][j];
do_check_eq(icon.width, expected.width);
do_check_eq(icon.height, expected.height);
do_check_eq(icon.pixels.length, expected.pixels.length);
equal(icon.width, expected.width);
equal(icon.height, expected.height);
equal(icon.pixels.length, expected.pixels.length);
for (let k = 0; k < icon.pixels.length; k++) {
do_check_eq(icon.pixels[k], expected.pixels[k]);
equal(icon.pixels[k], expected.pixels[k]);
}
}
}

View File

@ -46,8 +46,8 @@ add_test(function test_reading_ad_and_parsing_mcc_mnc() {
record.readAD();
do_check_eq(ril.iccInfo.mcc, expectedMcc);
do_check_eq(ril.iccInfo.mnc, expectedMnc);
equal(ril.iccInfo.mcc, expectedMcc);
equal(ril.iccInfo.mnc, expectedMnc);
}
do_test(undefined, "466923202422409", "466", "92" );
@ -140,7 +140,7 @@ add_test(function test_reading_optional_efs() {
if (testEf.length !== 0) {
do_print("Un-handled EF: " + JSON.stringify(testEf));
do_check_true(false);
ok(false);
}
};
@ -196,7 +196,7 @@ add_test(function test_fetch_sim_records() {
for (let i = 0; i < expectCalled.length; i++ ) {
if (ifCalled[i] != expectCalled[i]) {
do_print(expectCalled[i] + " is not called.");
do_check_true(false);
ok(false);
}
}
}
@ -263,9 +263,9 @@ add_test(function test_read_mwis() {
buildMwisData(isActive, msgCount);
recordHelper.readMWIS();
do_check_eq("iccmwis", postedMessage.rilMessageType);
do_check_eq(isActive, postedMessage.mwi.active);
do_check_eq((isActive) ? msgCount : 0, postedMessage.mwi.msgCount);
equal("iccmwis", postedMessage.rilMessageType);
equal(isActive, postedMessage.mwi.active);
equal((isActive) ? msgCount : 0, postedMessage.mwi.msgCount);
}
do_test(true, GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN);
@ -319,41 +319,41 @@ add_test(function test_update_mwis() {
isUpdated = true;
// Request Type.
do_check_eq(this.readInt32(), REQUEST_SIM_IO);
equal(this.readInt32(), REQUEST_SIM_IO);
// Token : we don't care
this.readInt32();
// command.
do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD);
// fileId.
do_check_eq(this.readInt32(), ICC_EF_MWIS);
equal(this.readInt32(), ICC_EF_MWIS);
// pathId.
do_check_eq(this.readString(),
equal(this.readString(),
EF_PATH_MF_SIM + ((ril.appType === CARD_APPTYPE_USIM) ? EF_PATH_ADF_USIM : EF_PATH_DF_GSM));
// p1.
do_check_eq(this.readInt32(), recordNum);
equal(this.readInt32(), recordNum);
// p2.
do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE);
// p3.
do_check_eq(this.readInt32(), recordSize);
equal(this.readInt32(), recordSize);
// data.
let strLen = this.readInt32();
do_check_eq(recordSize * 2, strLen);
equal(recordSize * 2, strLen);
let expectedMwis = buildMwisData();
for (let i = 0; i < recordSize; i++) {
do_check_eq(expectedMwis[i], pduHelper.readHexOctet());
equal(expectedMwis[i], pduHelper.readHexOctet());
}
this.readStringDelimiter(strLen);
// pin2.
do_check_eq(this.readString(), null);
equal(this.readString(), null);
if (!ril.v5Legacy) {
// AID. Ignore because it's from modem.
@ -361,12 +361,12 @@ add_test(function test_update_mwis() {
}
};
do_check_false(isUpdated);
ok(!isUpdated);
recordHelper.updateMWIS({ active: isActive,
msgCount: count });
do_check_true((ril.iccInfoPrivate.mwis) ? isUpdated : !isUpdated);
ok((ril.iccInfoPrivate.mwis) ? isUpdated : !isUpdated);
}
do_test(true, GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN);
@ -485,10 +485,10 @@ add_test(function test_read_new_sms_on_sim() {
let postedMessage = workerHelper.postedMessage;
do_check_eq("sms-received", postedMessage.rilMessageType);
do_check_eq("+0123456789", postedMessage.SMSC);
do_check_eq("+9876543210", postedMessage.sender);
do_check_eq("How are you?", postedMessage.body);
equal("sms-received", postedMessage.rilMessageType);
equal("+0123456789", postedMessage.SMSC);
equal("+9876543210", postedMessage.sender);
equal("How are you?", postedMessage.body);
}
do_test();
@ -534,8 +534,8 @@ add_test(function test_update_display_condition() {
record.readSPDI();
do_check_eq(ril.iccInfo.isDisplayNetworkNameRequired, true);
do_check_eq(ril.iccInfo.isDisplaySpnRequired, false);
equal(ril.iccInfo.isDisplayNetworkNameRequired, true);
equal(ril.iccInfo.isDisplaySpnRequired, false);
}
function do_test_spn(displayCondition,
@ -566,8 +566,8 @@ add_test(function test_update_display_condition() {
record.readSPN();
do_check_eq(ril.iccInfo.isDisplayNetworkNameRequired, expectedPlmnNameDisplay);
do_check_eq(ril.iccInfo.isDisplaySpnRequired, expectedSpnDisplay);
equal(ril.iccInfo.isDisplayNetworkNameRequired, expectedPlmnNameDisplay);
equal(ril.iccInfo.isDisplaySpnRequired, expectedSpnDisplay);
}
// Create empty operator object.
@ -758,17 +758,17 @@ add_test(function test_reading_img_basic() {
};
let onsuccess = function(icons) {
do_check_eq(icons.length, expected.length);
equal(icons.length, expected.length);
for (let i = 0; i < icons.length; i++) {
let icon = icons[i];
let exp = expected[i];
do_check_eq(icon.width, exp.width);
do_check_eq(icon.height, exp.height);
do_check_eq(icon.codingScheme, exp.codingScheme);
equal(icon.width, exp.width);
equal(icon.height, exp.height);
equal(icon.codingScheme, exp.codingScheme);
do_check_eq(icon.body.length, exp.body.length);
equal(icon.body.length, exp.body.length);
for (let j = 0; j < icon.body.length; j++) {
do_check_eq(icon.body[j], exp.body[j]);
equal(icon.body[j], exp.body[j]);
}
}
};
@ -839,12 +839,12 @@ add_test(function test_reading_img_length_error() {
let onsuccess = function() {
do_print("onsuccess shouldn't be called.");
do_check_true(false);
ok(false);
};
let onerror = function() {
do_print("onerror called as expected.");
do_check_true(true);
ok(true);
};
record.readIMG(0, onsuccess, onerror);
@ -908,12 +908,12 @@ add_test(function test_reading_img_invalid_fileId() {
let onsuccess = function() {
do_print("onsuccess shouldn't be called.");
do_check_true(false);
ok(false);
};
let onerror = function() {
do_print("onerror called as expected.");
do_check_true(true);
ok(true);
};
record.readIMG(0, onsuccess, onerror);
@ -957,12 +957,12 @@ add_test(function test_reading_img_wrong_record_length() {
let onsuccess = function() {
do_print("onsuccess shouldn't be called.");
do_check_true(false);
ok(false);
};
let onerror = function() {
do_print("onerror called as expected.");
do_check_true(true);
ok(true);
};
record.readIMG(0, onsuccess, onerror);
@ -1109,22 +1109,22 @@ add_test(function test_reading_img_color() {
};
let onsuccess = function(icons) {
do_check_eq(icons.length, expected.length);
equal(icons.length, expected.length);
for (let i = 0; i < icons.length; i++) {
let icon = icons[i];
let exp = expected[i];
do_check_eq(icon.width, exp.width);
do_check_eq(icon.height, exp.height);
do_check_eq(icon.codingScheme, exp.codingScheme);
equal(icon.width, exp.width);
equal(icon.height, exp.height);
equal(icon.codingScheme, exp.codingScheme);
do_check_eq(icon.body.length, exp.body.length);
equal(icon.body.length, exp.body.length);
for (let j = 0; j < icon.body.length; j++) {
do_check_eq(icon.body[j], exp.body[j]);
equal(icon.body[j], exp.body[j]);
}
do_check_eq(icon.clut.length, exp.clut.length);
equal(icon.clut.length, exp.clut.length);
for (let j = 0; j < icon.clut.length; j++) {
do_check_eq(icon.clut[j], exp.clut[j]);
equal(icon.clut[j], exp.clut[j]);
}
}
};
@ -1274,22 +1274,22 @@ add_test(function test_reading_img_color() {
};
let onsuccess = function(icons) {
do_check_eq(icons.length, expected.length);
equal(icons.length, expected.length);
for (let i = 0; i < icons.length; i++) {
let icon = icons[i];
let exp = expected[i];
do_check_eq(icon.width, exp.width);
do_check_eq(icon.height, exp.height);
do_check_eq(icon.codingScheme, exp.codingScheme);
equal(icon.width, exp.width);
equal(icon.height, exp.height);
equal(icon.codingScheme, exp.codingScheme);
do_check_eq(icon.body.length, exp.body.length);
equal(icon.body.length, exp.body.length);
for (let j = 0; j < icon.body.length; j++) {
do_check_eq(icon.body[j], exp.body[j]);
equal(icon.body[j], exp.body[j]);
}
do_check_eq(icon.clut.length, exp.clut.length);
equal(icon.clut.length, exp.clut.length);
for (let j = 0; j < icon.clut.length; j++) {
do_check_eq(icon.clut[j], exp.clut[j]);
equal(icon.clut[j], exp.clut[j]);
}
}
};
@ -1346,15 +1346,15 @@ add_test(function test_read_cphs_info() {
recordHelper.readCphsInfo(() => { onsuccess = true; },
() => { onerror = true; });
do_check_true((cphsSt) ? onsuccess : onerror);
do_check_false((cphsSt) ? onerror : onsuccess);
ok((cphsSt) ? onsuccess : onerror);
ok(!((cphsSt) ? onerror : onsuccess));
if (cphsSt) {
do_check_eq(RIL.iccInfoPrivate.cphsSt.length, cphsSt.length);
equal(RIL.iccInfoPrivate.cphsSt.length, cphsSt.length);
for (let i = 0; i < cphsSt.length; i++) {
do_check_eq(RIL.iccInfoPrivate.cphsSt[i], cphsSt[i]);
equal(RIL.iccInfoPrivate.cphsSt[i], cphsSt[i]);
}
} else {
do_check_eq(RIL.iccInfoPrivate.cphsSt, cphsSt);
equal(RIL.iccInfoPrivate.cphsSt, cphsSt);
}
}
@ -1439,9 +1439,9 @@ add_test(function test_read_voicemail_number() {
delete RIL.iccInfoPrivate.mbdn;
recordHelper[funcName]();
do_check_eq("iccmbdn", postedMessage.rilMessageType);
do_check_eq("Voicemail", postedMessage.alphaId);
do_check_eq("111", postedMessage.number);
equal("iccmbdn", postedMessage.rilMessageType);
equal("Voicemail", postedMessage.alphaId);
equal("111", postedMessage.number);
}
do_test("readMBDN");
@ -1498,8 +1498,8 @@ add_test(function test_read_mbdn_recovered_from_cphs_mbn() {
recordHelper.readMBDN();
do_check_eq(RIL.iccInfoPrivate.mbdn, undefined);
do_check_true(isRecovered);
equal(RIL.iccInfoPrivate.mbdn, undefined);
ok(isRecovered);
run_next_test();
});
@ -1554,7 +1554,7 @@ add_test(function test_pnn_with_different_coding_scheme() {
record.readPNN();
do_check_eq(ril.iccInfoPrivate.PNN[0].fullName, expectedResult);
equal(ril.iccInfoPrivate.PNN[0].fullName, expectedResult);
// Reset PNN info for next test
ril.iccInfoPrivate.PNN = null;
}
@ -1630,15 +1630,15 @@ add_test(function test_pnn_with_different_content() {
record.readPNN();
do_check_eq(test_data.length, ril.iccInfoPrivate.PNN.length);
equal(test_data.length, ril.iccInfoPrivate.PNN.length);
for (let i = 0; i < test_data.length; i++) {
if (test_data[i].expectedResult) {
do_check_eq(test_data[i].expectedResult.fullName,
equal(test_data[i].expectedResult.fullName,
ril.iccInfoPrivate.PNN[i].fullName);
do_check_eq(test_data[i].expectedResult.shortName,
equal(test_data[i].expectedResult.shortName,
ril.iccInfoPrivate.PNN[i].shortName);
} else {
do_check_eq(test_data[i].expectedResult, ril.iccInfoPrivate.PNN[i]);
equal(test_data[i].expectedResult, ril.iccInfoPrivate.PNN[i]);
}
}
}

View File

@ -32,8 +32,8 @@ function testSendMMI(mmi, error) {
let postedMessage = workerhelper.postedMessage;
do_check_eq(postedMessage.rilMessageType, "sendMMI");
do_check_eq(postedMessage.errorMsg, error);
equal(postedMessage.rilMessageType, "sendMMI");
equal(postedMessage.errorMsg, error);
}
/**
@ -65,10 +65,10 @@ add_test(function test_sendMMI_short_code() {
context.RIL.sendMMI({mmi: {fullMMI: "**"}});
let postedMessage = workerhelper.postedMessage;
do_check_eq(ussdOptions.ussd, "**");
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
do_check_true(context.RIL._ussdSession);
equal(ussdOptions.ussd, "**");
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
ok(context.RIL._ussdSession);
run_next_test();
});
@ -90,8 +90,8 @@ add_test(function test_sendMMI_change_PIN() {
let postedMessage = workerhelper.postedMessage;
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
});
@ -141,8 +141,8 @@ add_test(function test_sendMMI_change_PIN2() {
let postedMessage = workerhelper.postedMessage;
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
});
@ -192,8 +192,8 @@ add_test(function test_sendMMI_unblock_PIN() {
let postedMessage = workerhelper.postedMessage;
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
});
@ -243,8 +243,8 @@ add_test(function test_sendMMI_unblock_PIN2() {
let postedMessage = workerhelper.postedMessage;
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
});
@ -294,9 +294,9 @@ add_test(function test_sendMMI_get_IMEI() {
let postedMessage = workerhelper.postedMessage;
do_check_neq(mmiOptions.mmi, null);
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
notEqual(mmiOptions.mmi, null);
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
run_next_test();
});
@ -318,9 +318,9 @@ add_test(function test_sendMMI_get_IMEI_error() {
let postedMessage = workerhelper.postedMessage;
do_check_neq(mmiOptions.mmi, null);
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_RADIO_NOT_AVAILABLE);
do_check_false(postedMessage.success);
notEqual(mmiOptions.mmi, null);
equal (postedMessage.errorMsg, GECKO_ERROR_RADIO_NOT_AVAILABLE);
ok(!postedMessage.success);
run_next_test();
});
@ -347,11 +347,11 @@ add_test(function test_sendMMI_call_barring_BAIC_interrogation_voice() {
let postedMessage = workerhelper.postedMessage;
do_check_true(postedMessage.success);
do_check_true(postedMessage.enabled);
do_check_eq(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED_FOR);
do_check_true(Array.isArray(postedMessage.additionalInformation));
do_check_eq(postedMessage.additionalInformation[0], "serviceClassVoice");
ok(postedMessage.success);
ok(postedMessage.enabled);
equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED_FOR);
ok(Array.isArray(postedMessage.additionalInformation));
equal(postedMessage.additionalInformation[0], "serviceClassVoice");
run_next_test();
});
@ -377,9 +377,9 @@ add_test(function test_sendMMI_call_barring_BAIC_activation() {
let postedMessage = workerhelper.postedMessage;
do_check_eq(mmiOptions.procedure, MMI_PROCEDURE_ACTIVATION);
do_check_true(postedMessage.success);
do_check_eq(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED);
equal(mmiOptions.procedure, MMI_PROCEDURE_ACTIVATION);
ok(postedMessage.success);
equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED);
run_next_test();
});
@ -405,9 +405,9 @@ add_test(function test_sendMMI_call_barring_BAIC_deactivation() {
let postedMessage = workerhelper.postedMessage;
do_check_eq(mmiOptions.procedure, MMI_PROCEDURE_DEACTIVATION);
do_check_true(postedMessage.success);
do_check_eq(postedMessage.statusMessage, MMI_SM_KS_SERVICE_DISABLED);
equal(mmiOptions.procedure, MMI_PROCEDURE_DEACTIVATION);
ok(postedMessage.success);
equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_DISABLED);
run_next_test();
});
@ -436,10 +436,10 @@ add_test(function test_sendMMI_USSD() {
let postedMessage = workerhelper.postedMessage;
do_check_eq(ussdOptions.ussd, "**123#");
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
do_check_true(context.RIL._ussdSession);
equal(ussdOptions.ussd, "**123#");
equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
ok(context.RIL._ussdSession);
run_next_test();
});
@ -462,10 +462,10 @@ add_test(function test_sendMMI_USSD_error() {
let postedMessage = workerhelper.postedMessage;
do_check_eq(ussdOptions.ussd, "**123#");
do_check_eq (postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
do_check_false(postedMessage.success);
do_check_false(context.RIL._ussdSession);
equal(ussdOptions.ussd, "**123#");
equal (postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
ok(!postedMessage.success);
ok(!context.RIL._ussdSession);
run_next_test();
});
@ -486,8 +486,8 @@ function setCallWaitingSuccess(mmi) {
let postedMessage = workerhelper.postedMessage;
do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
}
add_test(function test_sendMMI_call_waiting_activation() {
@ -539,9 +539,9 @@ add_test(function test_sendMMI_call_waiting_interrogation() {
let postedMessage = workerhelper.postedMessage;
do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
do_check_true(postedMessage.success);
do_check_eq(postedMessage.length, 2);
do_check_true(postedMessage.enabled);
equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS);
ok(postedMessage.success);
equal(postedMessage.length, 2);
ok(postedMessage.enabled);
run_next_test();
});

View File

@ -37,8 +37,8 @@ function setCallForwardSuccess(procedure, serviceCode, sia, sib, sic) {
let postedMessage = workerhelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
}
add_test(function test_sendMMI_call_forwarding_activation() {
@ -85,13 +85,13 @@ add_test(function test_sendMMI_call_forwarding_interrogation() {
let postedMessage = workerhelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.success);
do_check_true(Array.isArray(postedMessage.rules));
do_check_eq(postedMessage.rules.length, 1);
do_check_true(postedMessage.rules[0].active);
do_check_eq(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL);
do_check_eq(postedMessage.rules[0].number, "+34666222333");
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.success);
ok(Array.isArray(postedMessage.rules));
equal(postedMessage.rules.length, 1);
ok(postedMessage.rules[0].active);
equal(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL);
equal(postedMessage.rules[0].number, "+34666222333");
run_next_test();
});
@ -115,8 +115,8 @@ add_test(function test_sendMMI_call_forwarding_interrogation_no_rules() {
let postedMessage = workerhelper.postedMessage;
do_check_eq(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
do_check_false(postedMessage.success);
equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE);
ok(!postedMessage.success);
run_next_test();
});

View File

@ -18,7 +18,7 @@ add_test(function test_is_ruim_service_available() {
function test_table(cst, geckoService, enabled) {
context.RIL.iccInfoPrivate.cst = cst;
do_check_eq(context.ICCUtilsHelper.isICCServiceAvailable(geckoService),
equal(context.ICCUtilsHelper.isICCServiceAvailable(geckoService),
enabled);
}
@ -40,7 +40,7 @@ add_test(function test_ruim_file_path_id() {
let ICCFileHelper = context.ICCFileHelper;
RIL.appType = CARD_APPTYPE_RUIM;
do_check_eq(ICCFileHelper.getEFPath(ICC_EF_CSIM_CST),
equal(ICCFileHelper.getEFPath(ICC_EF_CSIM_CST),
EF_PATH_MF_SIM + EF_PATH_DF_CDMA);
run_next_test();
@ -76,7 +76,7 @@ add_test(function test_fetch_ruim_recodes() {
for (let i = 0; i < expectCalled.length; i++ ) {
if (ifCalled[i] != expectCalled[i]) {
do_print(expectCalled[i] + " is not called.");
do_check_true(false);
ok(false);
}
}
}
@ -98,7 +98,7 @@ add_test(function test_decode_imsi_value() {
function testDecodeImsiValue(encoded, length, expect) {
let decoded = context.RuimRecordHelper.decodeIMSIValue(encoded, length);
do_check_eq(expect, decoded);
equal(expect, decoded);
}
testDecodeImsiValue( 99, 2, "00");
@ -150,7 +150,7 @@ add_test(function test_get_imsi_m() {
context.RuimRecordHelper.getIMSI_M();
let imsi = context.RIL.iccInfoPrivate.imsi;
do_check_eq(expectedImsi, imsi)
equal(expectedImsi, imsi)
}
let imsi_1 = "466050081062861";
@ -198,11 +198,11 @@ add_test(function test_read_cdmahome() {
context.RuimRecordHelper.readCDMAHome();
let cdmaHome = context.RIL.cdmaHome;
for (let i = 0; i < expectedSystemIds.length; i++) {
do_check_eq(cdmaHome.systemId[i], expectedSystemIds[i]);
do_check_eq(cdmaHome.networkId[i], expectedNetworkIds[i]);
equal(cdmaHome.systemId[i], expectedSystemIds[i]);
equal(cdmaHome.networkId[i], expectedNetworkIds[i]);
}
do_check_eq(cdmaHome.systemId.length, expectedSystemIds.length);
do_check_eq(cdmaHome.networkId.length, expectedNetworkIds.length);
equal(cdmaHome.systemId.length, expectedSystemIds.length);
equal(cdmaHome.networkId.length, expectedNetworkIds.length);
}
testCdmaHome([13505], [65535]);
@ -239,8 +239,8 @@ add_test(function test_read_cdmaspn() {
};
context.RuimRecordHelper.readSPN();
do_check_eq(context.RIL.iccInfo.spn, expectedSpn);
do_check_eq(context.RIL.iccInfoPrivate.spnDisplayCondition,
equal(context.RIL.iccInfo.spn, expectedSpn);
equal(context.RIL.iccInfoPrivate.spnDisplayCondition,
expectedDisplayCondition);
}
@ -287,9 +287,9 @@ add_test(function test_cdma_spn_display_condition() {
RIL._isCdma = true;
// Test updateDisplayCondition runs before any of SIM file is ready.
do_check_eq(ICCUtilsHelper.updateDisplayCondition(), true);
do_check_eq(RIL.iccInfo.isDisplayNetworkNameRequired, true);
do_check_eq(RIL.iccInfo.isDisplaySpnRequired, false);
equal(ICCUtilsHelper.updateDisplayCondition(), true);
equal(RIL.iccInfo.isDisplayNetworkNameRequired, true);
equal(RIL.iccInfo.isDisplaySpnRequired, false);
// Test with value.
function testDisplayCondition(ruimDisplayCondition,
@ -307,9 +307,9 @@ add_test(function test_cdma_spn_display_condition() {
cdmaNetworkId: currentNetworkId
};
do_check_eq(ICCUtilsHelper.updateDisplayCondition(), expectUpdateDisplayCondition);
do_check_eq(RIL.iccInfo.isDisplayNetworkNameRequired, false);
do_check_eq(RIL.iccInfo.isDisplaySpnRequired, expectIsDisplaySPNRequired);
equal(ICCUtilsHelper.updateDisplayCondition(), expectUpdateDisplayCondition);
equal(RIL.iccInfo.isDisplayNetworkNameRequired, false);
equal(RIL.iccInfo.isDisplaySpnRequired, expectIsDisplaySPNRequired);
};
// SPN is not required when ruimDisplayCondition is false.

View File

@ -142,7 +142,7 @@ function add_test_receiving_sms(expected, pdu) {
},
postMessage: function(message) {
do_print("fullBody: " + message.fullBody);
do_check_eq(expected, message.fullBody)
equal(expected, message.fullBody)
}
});
@ -247,7 +247,7 @@ add_test(function test_sendSMS_UCS2_without_langIndex_langShiftIndex_defined() {
//
// If we have additional 6(type, len, langIndex, type len, langShiftIndex)
// octets here, then bug 809553 is not fixed.
do_check_eq(this.outgoingIndex, 57);
equal(this.outgoingIndex, 57);
run_next_test();
};

View File

@ -213,20 +213,20 @@ add_test(function test_processCdmaSmsStatusReport() {
let postedMessage = workerHelper.postedMessage;
// Check if pending token is removed.
do_check_true((errorClass === 2) ? !!sentSmsMap[msgId] : !sentSmsMap[msgId]);
ok((errorClass === 2) ? !!sentSmsMap[msgId] : !sentSmsMap[msgId]);
// Check the response message accordingly.
if (errorClass === -1) {
// Check if the report is treated as normal incoming SMS
do_check_eq("sms-received", postedMessage.rilMessageType);
equal("sms-received", postedMessage.rilMessageType);
} else if (errorClass === 2) {
// Do nothing.
} else {
// Check Delivery Status
if (errorClass === 0) {
do_check_eq(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_SUCCESS);
equal(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_SUCCESS);
} else {
do_check_eq(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_ERROR);
equal(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_ERROR);
}
}
}
@ -283,12 +283,12 @@ add_test(function test_processCdmaSmsWapPush() {
do_print("fullDataHexString: " + fullDataHexString);
do_check_eq("sms-received", postedMessage.rilMessageType);
do_check_eq(PDU_CDMA_MSG_TELESERIVCIE_ID_WAP, postedMessage.teleservice);
do_check_eq(orig_address, postedMessage.sender);
do_check_eq(0x23F0, postedMessage.header.originatorPort);
do_check_eq(0x0B84, postedMessage.header.destinationPort);
do_check_eq(fullDataHexString, bytesToHexString(postedMessage.data));
equal("sms-received", postedMessage.rilMessageType);
equal(PDU_CDMA_MSG_TELESERIVCIE_ID_WAP, postedMessage.teleservice);
equal(orig_address, postedMessage.sender);
equal(0x23F0, postedMessage.header.originatorPort);
equal(0x0B84, postedMessage.header.destinationPort);
equal(fullDataHexString, bytesToHexString(postedMessage.data));
}
// Verify Single WAP PDU

View File

@ -29,10 +29,10 @@ add_test(function test_CdmaPDUHelper_encodeUserDataReplyOption() {
let expectedDataBuffer = [PDU_CDMA_MSG_USERDATA_REPLY_OPTION, 0x01, 0x40];
do_check_eq(testDataBuffer.length, expectedDataBuffer.length);
equal(testDataBuffer.length, expectedDataBuffer.length);
for (let i = 0; i < expectedDataBuffer.length; i++) {
do_check_eq(testDataBuffer[i], expectedDataBuffer[i]);
equal(testDataBuffer[i], expectedDataBuffer[i]);
}
run_next_test();
@ -58,8 +58,8 @@ add_test(function test_CdmaPDUHelper_decodeUserDataMsgStatus() {
context.BitBufferHelper.startRead(testDataBuffer);
let result = helper.decodeUserDataMsgStatus();
do_check_eq(result.errorClass, octet >>> 6);
do_check_eq(result.msgStatus, octet & 0x3F);
equal(result.errorClass, octet >>> 6);
equal(result.msgStatus, octet & 0x3F);
}
// 00|000000: no error|Message accepted
@ -93,7 +93,7 @@ add_test(function test_CdmaPDUHelper_decodeCdmaPDUMsg_Shift_jis() {
function test_decodePDUMsg(testDataBuffer, expected, encoding, msgType, msgBodySize) {
context.BitBufferHelper.startRead(testDataBuffer);
let result = helper.decodeCdmaPDUMsg(encoding, msgType, msgBodySize);
do_check_eq(result, expected);
equal(result, expected);
}
// Shift-JIS has 1 byte and 2 byte code for one character and has some types of characters:

View File

@ -30,14 +30,14 @@ add_test(function test_GsmPDUHelper_readDataCodingScheme() {
let msg = {};
helper.readDataCodingScheme(msg);
do_check_eq(msg.dcs, dcs);
do_check_eq(msg.encoding, encoding);
do_check_eq(msg.messageClass, messageClass);
do_check_eq(msg.mwi == null, mwi == null);
equal(msg.dcs, dcs);
equal(msg.encoding, encoding);
equal(msg.messageClass, messageClass);
equal(msg.mwi == null, mwi == null);
if (mwi != null) {
do_check_eq(msg.mwi.active, mwi.active);
do_check_eq(msg.mwi.discard, mwi.discard);
do_check_eq(msg.mwi.msgCount, mwi.msgCount);
equal(msg.mwi.active, mwi.active);
equal(msg.mwi.discard, mwi.discard);
equal(msg.mwi.msgCount, mwi.msgCount);
}
}
@ -179,7 +179,7 @@ add_test(function test_GsmPDUHelper_writeStringAsSeptets() {
helper.resetOctetWritten();
helper.writeStringAsSeptets(str, paddingBits, PDU_NL_IDENTIFIER_DEFAULT,
PDU_NL_IDENTIFIER_DEFAULT);
do_check_eq(Math.ceil(((len * 7) + paddingBits) / 8),
equal(Math.ceil(((len * 7) + paddingBits) / 8),
helper.octetsWritten);
}
}
@ -217,7 +217,7 @@ add_test(function test_GsmPDUHelper_readAddress() {
}
let length = helper.readHexOctet();
let parsedAddr = helper.readAddress(length);
do_check_eq(parsedAddr, addrString);
equal(parsedAddr, addrString);
}
// For AlphaNumeric

View File

@ -24,13 +24,13 @@ add_test(function test_nl_locking_shift_tables_validity() {
let table = PDU_NL_LOCKING_SHIFT_TABLES[lst];
// Make sure table length is 128, or it will break table lookup algorithm.
do_check_eq(table.length, 128);
equal(table.length, 128);
// Make sure special values are preserved.
do_check_eq(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE);
do_check_eq(table[PDU_NL_LINE_FEED], LF);
do_check_eq(table[PDU_NL_CARRIAGE_RETURN], CR);
do_check_eq(table[PDU_NL_SPACE], SP);
equal(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE);
equal(table[PDU_NL_LINE_FEED], LF);
equal(table[PDU_NL_CARRIAGE_RETURN], CR);
equal(table[PDU_NL_SPACE], SP);
}
run_next_test();
@ -43,12 +43,12 @@ add_test(function test_nl_single_shift_tables_validity() {
let table = PDU_NL_SINGLE_SHIFT_TABLES[sst];
// Make sure table length is 128, or it will break table lookup algorithm.
do_check_eq(table.length, 128);
equal(table.length, 128);
// Make sure special values are preserved.
do_check_eq(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE);
do_check_eq(table[PDU_NL_PAGE_BREAK], FF);
do_check_eq(table[PDU_NL_RESERVED_CONTROL], RESCTL);
equal(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE);
equal(table[PDU_NL_PAGE_BREAK], FF);
equal(table[PDU_NL_RESERVED_CONTROL], RESCTL);
}
run_next_test();
@ -64,12 +64,12 @@ add_test(function test_gsm_sms_strict_7bit_charmap_validity() {
+ to.charCodeAt(0).toString(16) + "\"");
// Make sure "from" is not in default table
do_check_eq(defaultTable.indexOf(from), -1);
do_check_eq(defaultShiftTable.indexOf(from), -1);
equal(defaultTable.indexOf(from), -1);
equal(defaultShiftTable.indexOf(from), -1);
// Make sure "to" is in default table
if ((defaultTable.indexOf(to) < 0)
&& (defaultShiftTable.indexOf(to) < 0)) {
do_check_eq(false, true);
equal(false, true);
}
}

View File

@ -42,7 +42,7 @@ add_test(function test_SmsSegmentHelper__countGsm7BitSeptets() {
};
function do_check_calc(str, expectedCalcLen, lst, sst, strict7BitEncoding, strToWrite) {
do_check_eq(expectedCalcLen,
equal(expectedCalcLen,
gSmsSegmentHelper
.countGsm7BitSeptets(str,
PDU_NL_LOCKING_SHIFT_TABLES[lst],
@ -52,7 +52,7 @@ add_test(function test_SmsSegmentHelper__countGsm7BitSeptets() {
helper.resetOctetWritten();
strToWrite = strToWrite || str;
helper.writeStringAsSeptets(strToWrite, 0, lst, sst);
do_check_eq(Math.ceil(expectedCalcLen * 7 / 8), helper.octetsWritten);
equal(Math.ceil(expectedCalcLen * 7 / 8), helper.octetsWritten);
}
// Test calculation encoded message length using both locking/single shift tables.

View File

@ -67,9 +67,9 @@ add_test(function test_notification() {
context.RIL._processSuppSvcNotification(notificationInfo);
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.rilMessageType, 'suppSvcNotification');
do_check_eq(postedMessage.notification, resultNotification);
do_check_eq(postedMessage.callIndex, resultCallIndex);
equal(postedMessage.rilMessageType, 'suppSvcNotification');
equal(postedMessage.notification, resultNotification);
equal(postedMessage.callIndex, resultCallIndex);
// Clear all existed calls.
context.RIL._processCalls({});

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ add_test(function test_setVoicePrivacyMode_success() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
equal(postedMessage.errorMsg, undefined);
run_next_test();
});
@ -46,7 +46,7 @@ add_test(function test_setVoicePrivacyMode_generic_failure() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, "GenericFailure");
equal(postedMessage.errorMsg, "GenericFailure");
run_next_test();
});
@ -70,8 +70,8 @@ add_test(function test_queryVoicePrivacyMode_success_enabled_true() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_true(postedMessage.enabled);
equal(postedMessage.errorMsg, undefined);
ok(postedMessage.enabled);
run_next_test();
});
@ -94,7 +94,7 @@ add_test(function test_queryVoicePrivacyMode_success_enabled_false() {
let postedMessage = workerHelper.postedMessage;
do_check_eq(postedMessage.errorMsg, undefined);
do_check_false(postedMessage.enabled);
equal(postedMessage.errorMsg, undefined);
ok(!postedMessage.enabled);
run_next_test();
});

View File

@ -43,6 +43,6 @@ partial interface EventTarget {
// chrome easier. This returns the window which can be used to create
// events to fire at this EventTarget, or null if there isn't one.
partial interface EventTarget {
[ChromeOnly]
[ChromeOnly, Exposed=Window]
readonly attribute WindowProxy? ownerGlobal;
};

View File

@ -520,7 +520,7 @@ interface WebGLRenderingContext {
void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
void bindTexture(GLenum target, WebGLTexture? texture);
void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void blendEquation(GLenum mode);
void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
void blendFunc(GLenum sfactor, GLenum dfactor);
@ -535,7 +535,7 @@ interface WebGLRenderingContext {
[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
void clear(GLbitfield mask);
void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
void clearDepth(GLclampf depth);
void clearStencil(GLint s);
void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);

View File

@ -42,55 +42,21 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
nsIObserver *openDialogObserver,
bool *notifyOnOpen)
{
m_observer = openDialogObserver;
nsresult rv = NS_ERROR_FAILURE;
if (m_dialog)
return NS_ERROR_ALREADY_INITIALIZED;
if (!dialogURL || !*dialogURL)
return NS_ERROR_INVALID_ARG;
if (parent)
{
// Set up window.arguments[0]...
nsCOMPtr<nsISupportsArray> array;
rv = NS_NewISupportsArray(getter_AddRefs(array));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsISupportsInterfacePointer> ifptr =
do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
ifptr->SetData(static_cast<nsIPrintProgress*>(this));
ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress));
array->AppendElement(ifptr);
array->AppendElement(parameters);
// Open the dialog.
nsCOMPtr<nsIDOMWindow> newWindow;
rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
NS_LITERAL_STRING("_blank"),
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
array, getter_AddRefs(newWindow));
if (NS_SUCCEEDED(rv)) {
*notifyOnOpen = true;
}
}
return rv;
MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress "
"implementation for OS X returns "
"NS_ERROR_NOT_IMPLEMENTED, so we should never get "
"here.");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void closeProgressDialog (in boolean forceClose); */
NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose)
{
m_closeProgress = true;
// XXX Casting bool to nsresult
return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP,
static_cast<nsresult>(forceClose));
MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress "
"implementation for OS X returns "
"NS_ERROR_NOT_IMPLEMENTED, so we should never get "
"here.");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIPrompt GetPrompter (); */

View File

@ -6,10 +6,16 @@
#include "nsPrintProgress.h"
#include "nsIBaseWindow.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsISupportsArray.h"
#include "nsIXULWindow.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsPIDOMWindow.h"
NS_IMPL_ADDREF(nsPrintProgress)
NS_IMPL_RELEASE(nsPrintProgress)
@ -71,12 +77,29 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
array->AppendElement(parameters);
// We will set the opener of the dialog to be the nsIDOMWindow for the
// browser XUL window itself, as opposed to the content. That way, the
// progress window has access to the opener.
nsCOMPtr<nsPIDOMWindow> pParentWindow = do_QueryInterface(parent);
NS_ENSURE_STATE(pParentWindow);
nsCOMPtr<nsIDocShell> docShell = pParentWindow->GetDocShell();
NS_ENSURE_STATE(docShell);
nsCOMPtr<nsIDocShellTreeOwner> owner;
docShell->GetTreeOwner(getter_AddRefs(owner));
nsCOMPtr<nsIXULWindow> ownerXULWindow = do_GetInterface(owner);
nsCOMPtr<nsIDOMWindow> ownerWindow = do_GetInterface(ownerXULWindow);
NS_ENSURE_STATE(ownerWindow);
// Open the dialog.
nsCOMPtr<nsIDOMWindow> newWindow;
rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
NS_LITERAL_STRING("_blank"),
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
array, getter_AddRefs(newWindow));
rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
NS_LITERAL_STRING("_blank"),
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
array, getter_AddRefs(newWindow));
}
return rv;

View File

@ -6,11 +6,16 @@
#include "nsPrintProgress.h"
#include "nsIBaseWindow.h"
#include "nsIDocShell.h"
#include "nsIDocShellTreeOwner.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsISupportsArray.h"
#include "nsIXULWindow.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsIComponentManager.h"
#include "nsIServiceManager.h"
#include "nsPIDOMWindow.h"
#if 0
NS_IMPL_ADDREF(nsPrintProgress)
@ -100,12 +105,28 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
array->AppendElement(parameters);
// We will set the opener of the dialog to be the nsIDOMWindow for the
// browser XUL window itself, as opposed to the content. That way, the
// progress window has access to the opener.
nsCOMPtr<nsPIDOMWindow> pParentWindow = do_QueryInterface(parent);
NS_ENSURE_STATE(pParentWindow);
nsCOMPtr<nsIDocShell> docShell = pParentWindow->GetDocShell();
NS_ENSURE_STATE(docShell);
nsCOMPtr<nsIDocShellTreeOwner> owner;
docShell->GetTreeOwner(getter_AddRefs(owner));
nsCOMPtr<nsIXULWindow> ownerXULWindow = do_GetInterface(owner);
nsCOMPtr<nsIDOMWindow> ownerWindow = do_GetInterface(ownerXULWindow);
NS_ENSURE_STATE(ownerWindow);
// Open the dialog.
nsCOMPtr<nsIDOMWindow> newWindow;
rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
NS_LITERAL_STRING("_blank"),
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
array, getter_AddRefs(newWindow));
rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
NS_LITERAL_STRING("_blank"),
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
array, getter_AddRefs(newWindow));
}
return rv;

View File

@ -1166,6 +1166,8 @@ public:
// This is a little hacky at the moment, but we want to have this data. Bug 1068613.
static void SetLogForwarder(LogForwarder* aLogFwd);
static uint32_t GetMaxSurfaceSize(BackendType aType);
static LogForwarder* GetLogForwarder() { return mLogForwarder; }
private:

View File

@ -111,8 +111,8 @@ struct BaseRect {
Sub result;
result.x = std::max<T>(x, aRect.x);
result.y = std::max<T>(y, aRect.y);
result.width = std::min<T>(XMost(), aRect.XMost()) - result.x;
result.height = std::min<T>(YMost(), aRect.YMost()) - result.y;
result.width = std::min<T>(x - result.x + width, aRect.x - result.x + aRect.width);
result.height = std::min<T>(y - result.y + height, aRect.y - result.y + aRect.height);
if (result.width < 0 || result.height < 0) {
result.SizeTo(0, 0);
}

View File

@ -1693,10 +1693,11 @@ DrawTargetCG::Init(BackendType aType,
{
// XXX: we should come up with some consistent semantics for dealing
// with zero area drawtargets
if (aSize.width <= 0 || aSize.height <= 0 ||
// 32767 is the maximum size supported by cairo
// we clamp to that to make it easier to interoperate
aSize.width > 32767 || aSize.height > 32767) {
if (aSize.width <= 0 ||
aSize.height <= 0 ||
size_t(aSize.width) > GetMaxSurfaceSize() ||
size_t(aSize.height) > GetMaxSurfaceSize())
{
gfxWarning() << "Failed to Init() DrawTargetCG because of bad size.";
mColorSpace = nullptr;
mCg = nullptr;

View File

@ -183,6 +183,13 @@ public:
CGContextRef GetCGContext() {
return mCg;
}
// 32767 is the maximum size supported by cairo. We clamp to that to make it
// easier to interoperate.
static size_t GetMaxSurfaceSize() {
return 32767;
}
private:
void MarkChanged();

View File

@ -170,6 +170,11 @@ public:
static cairo_surface_t *GetDummySurface();
// Cairo hardcodes this as its maximum surface size.
static size_t GetMaxSurfaceSize() {
return 32767;
}
private: // methods
// Init cairo surface without doing a cairo_surface_reference() call.
bool InitAlreadyReferenced(cairo_surface_t* aSurface, const IntSize& aSize, SurfaceFormat* aFormat = nullptr);

View File

@ -145,6 +145,10 @@ public:
static IDWriteFactory *GetDWriteFactory();
ID2D1RenderTarget *GetRT() { return mRT; }
static uint32_t GetMaxSurfaceSize() {
return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION;
}
operator std::string() const {
std::stringstream stream;
stream << "DrawTargetD2D(" << this << ")";

View File

@ -144,6 +144,10 @@ public:
return stream.str();
}
static uint32_t GetMaxSurfaceSize() {
return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION;
}
static uint64_t mVRAMUsageDT;
static uint64_t mVRAMUsageSS;

View File

@ -449,6 +449,30 @@ Factory::DoesBackendSupportDataDrawtarget(BackendType aType)
return false;
}
uint32_t
Factory::GetMaxSurfaceSize(BackendType aType)
{
switch (aType) {
case BackendType::CAIRO:
case BackendType::COREGRAPHICS:
return DrawTargetCairo::GetMaxSurfaceSize();
#ifdef XP_MACOSX
case BackendType::COREGRAPHICS_ACCELERATED:
return DrawTargetCG::GetMaxSurfaceSize();
#endif
case BackendType::SKIA:
return INT_MAX;
#ifdef WIN32
case BackendType::DIRECT2D:
return DrawTargetD2D::GetMaxSurfaceSize();
case BackendType::DIRECT2D1_1:
return DrawTargetD2D1::GetMaxSurfaceSize();
#endif
default:
return 0;
}
}
TemporaryRef<ScaledFont>
Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSize)
{

View File

@ -295,7 +295,7 @@ void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLcla
if (context)
{
context->getState().setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha));
context->getState().setBlendColor(red, green, blue, alpha);
}
}

View File

@ -886,7 +886,7 @@ public:
AFTER_GL_CALL;
}
void fBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) {
void fBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) {
BEFORE_GL_CALL;
mSymbols.fBlendColor(red, green, blue, alpha);
AFTER_GL_CALL;
@ -986,7 +986,7 @@ public:
AFTER_GL_CALL;
}
void fClearColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) {
void fClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
BEFORE_GL_CALL;
mSymbols.fClearColor(r, g, b, a);
AFTER_GL_CALL;

View File

@ -49,7 +49,7 @@ struct GLContextSymbols
PFNGLBINDTEXTUREPROC fBindTexture;
typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYPROC) (GLuint array);
PFNGLBINDVERTEXARRAYPROC fBindVertexArray;
typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
PFNGLBLENDCOLORPROC fBlendColor;
typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode);
PFNGLBLENDEQUATIONPROC fBlendEquation;
@ -73,7 +73,7 @@ struct GLContextSymbols
PFNGLCLEARBUFFERIVPROC fClearBufferiv;
typedef void (GLAPIENTRY * PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint* value);
PFNGLCLEARBUFFERUIVPROC fClearBufferuiv;
typedef void (GLAPIENTRY * PFNGLCLEARCOLORPROC) (GLclampf, GLclampf, GLclampf, GLclampf);
typedef void (GLAPIENTRY * PFNGLCLEARCOLORPROC) (GLfloat, GLfloat, GLfloat, GLfloat);
PFNGLCLEARCOLORPROC fClearColor;
typedef void (GLAPIENTRY * PFNGLCLEARSTENCILPROC) (GLint);
PFNGLCLEARSTENCILPROC fClearStencil;

View File

@ -67,6 +67,9 @@ BasicCompositor::BasicCompositor(nsIWidget *aWidget)
{
MOZ_COUNT_CTOR(BasicCompositor);
SetBackend(LayersBackend::LAYERS_BASIC);
mMaxTextureSize =
Factory::GetMaxSurfaceSize(gfxPlatform::GetPlatform()->GetContentBackend());
}
BasicCompositor::~BasicCompositor()
@ -74,6 +77,12 @@ BasicCompositor::~BasicCompositor()
MOZ_COUNT_DTOR(BasicCompositor);
}
int32_t
BasicCompositor::GetMaxTextureSize() const
{
return mMaxTextureSize;
}
void
BasicCompositingRenderTarget::BindRenderTarget()
{

View File

@ -103,7 +103,7 @@ public:
virtual bool SupportsPartialTextureUpdate() MOZ_OVERRIDE { return true; }
virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) MOZ_OVERRIDE { return true; }
virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE { return INT32_MAX; }
virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE;
virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) MOZ_OVERRIDE { }
virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) MOZ_OVERRIDE {
@ -140,6 +140,8 @@ private:
gfx::IntRect mInvalidRect;
nsIntRegion mInvalidRegion;
uint32_t mMaxTextureSize;
};
} // namespace layers

View File

@ -219,6 +219,12 @@ ClientTiledPaintedLayer::IsScrollingOnCompositor(const FrameMetrics& aParentMetr
bool
ClientTiledPaintedLayer::UseFastPath()
{
// The fast path doesn't allow rendering at low resolution. It will draw the low-res
// area at full resolution and cause OOM.
if (gfxPrefs::UseLowPrecisionBuffer()) {
return false;
}
LayerMetricsWrapper scrollAncestor;
GetAncestorLayers(&scrollAncestor, nullptr);
if (!scrollAncestor) {
@ -227,16 +233,35 @@ ClientTiledPaintedLayer::UseFastPath()
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
bool multipleTransactionsNeeded = gfxPlatform::GetPlatform()->UseProgressivePaint()
|| gfxPrefs::UseLowPrecisionBuffer()
|| !parentMetrics.GetCriticalDisplayPort().IsEmpty();
bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition();
bool isScrollable = parentMetrics.IsScrollable();
return !multipleTransactionsNeeded || isFixed || !isScrollable
#if !defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ)
|| !IsScrollingOnCompositor(parentMetrics)
return !multipleTransactionsNeeded || isFixed || !isScrollable;
}
bool
ClientTiledPaintedLayer::UseProgressiveDraw() {
// Don't draw progressively in a reftest scenario (that's what the HasShadowTarget() check is for).
if (!gfxPlatform::GetPlatform()->UseProgressivePaint() || ClientManager()->HasShadowTarget()) {
return false;
}
// XXX We probably want to disable progressive drawing for non active APZ layers in the future
// but we should wait for a proper test case before making this change.
#if 0 //!defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ)
LayerMetricsWrapper scrollAncestor;
GetAncestorLayers(&scrollAncestor, nullptr);
if (!scrollAncestor) {
return true;
}
const FrameMetrics& parentMetrics = scrollAncestor.Metrics();
return !IsScrollingOnCompositor(parentMetrics);
#else
return true;
#endif
;
}
bool
@ -251,10 +276,8 @@ ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion,
return false;
}
// Only draw progressively when the resolution is unchanged, and we're not
// in a reftest scenario (that's what the HasShadowManager() check is for).
if (gfxPlatform::GetPlatform()->UseProgressivePaint() &&
!ClientManager()->HasShadowTarget() &&
// Only draw progressively when the resolution is unchanged
if (UseProgressiveDraw() &&
mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) {
// Store the old valid region, then clear it before painting.
// We clip the old valid region to the visible region, as it only gets
@ -418,36 +441,20 @@ ClientTiledPaintedLayer::RenderLayer()
ToClientLayer(GetMaskLayer())->RenderLayer();
}
// For more complex cases we need to calculate a bunch of metrics before we
// can do the paint.
BeginPaint();
if (mPaintData.mPaintFinished) {
return;
}
// In some cases we can take a fast path and just be done with it.
if (UseFastPath()) {
TILING_LOG("TILING %p: Taking fast-path\n", this);
mValidRegion = neededRegion;
// Make sure that tiles that fall outside of the visible region or outside of the
// critical displayport are discarded on the first update. Also make sure that we
// only draw stuff inside the critical displayport on the first update.
if (!mPaintData.mCriticalDisplayPort.IsEmpty()) {
mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort));
}
if (invalidRegion.IsEmpty()) {
EndPaint();
return;
}
mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution);
mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, callback, data);
ClientManager()->Hold(this);
mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER);
EndPaint();
return;
}
// For more complex cases we need to calculate a bunch of metrics before we
// can do the paint.
BeginPaint();
if (mPaintData.mPaintFinished) {
return;
}

View File

@ -106,6 +106,13 @@ private:
*/
bool IsScrollingOnCompositor(const FrameMetrics& aParentMetrics);
/**
* Check if we should use progressive draw on this layer. We will
* disable progressive draw based on a preference or if the layer
* is not being scrolled.
*/
bool UseProgressiveDraw();
/**
* Helper function to do the high-precision paint.
* This function returns true if it updated the paint buffer.

View File

@ -745,7 +745,7 @@ BufferTextureClient::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFla
}
uint32_t bufSize = ImageDataSerializer::ComputeMinBufferSize(aSize, mFormat);
if (!Allocate(bufSize)) {
if (!bufSize || !Allocate(bufSize)) {
return false;
}

View File

@ -547,7 +547,7 @@ static struct lutmABType *read_tag_lutmABType(struct mem_source *src, struct tag
}
num_in_channels = read_u8(src, offset + 8);
num_out_channels = read_u8(src, offset + 8);
num_out_channels = read_u8(src, offset + 9);
if (num_in_channels > MAX_CHANNELS || num_out_channels > MAX_CHANNELS)
return NULL;

View File

@ -400,6 +400,25 @@ TestFiniteGfx()
return true;
}
// We want to test nsRect values that are still in range but where
// the implementation is at risk of overflowing
template <class RectType>
static bool
TestBug1135677()
{
RectType rect1(1073741344, 1073741344, 1073756696, 1073819936);
RectType rect2(1073741820, 1073741820, 14400, 77640);
RectType dest;
dest = rect1.Intersect(rect2);
EXPECT_TRUE(dest.x == 1073741820 && dest.y == 1073741820 &&
dest.width == 14400 && dest.height == 77640) <<
"[1] Operation should not overflow internally.";
return true;
}
TEST(Gfx, nsRect) {
TestConstructors<nsRect>();
TestEqualityOperator<nsRect>();
@ -407,6 +426,7 @@ TEST(Gfx, nsRect) {
TestIntersects<nsRect>();
TestIntersection<nsRect>();
TestUnion<nsRect>();
TestBug1135677<nsRect>();
}
TEST(Gfx, nsIntRect) {
@ -416,6 +436,7 @@ TEST(Gfx, nsIntRect) {
TestIntersects<nsIntRect>();
TestIntersection<nsIntRect>();
TestUnion<nsIntRect>();
TestBug1135677<nsIntRect>();
}
TEST(Gfx, gfxRect) {
@ -425,5 +446,6 @@ TEST(Gfx, gfxRect) {
TestIntersects<gfxRect>();
TestIntersection<gfxRect>();
TestUnion<gfxRect>();
TestBug1135677<gfxRect>();
TestFiniteGfx();
}

View File

@ -312,7 +312,7 @@ private:
DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false);
DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false);
DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false);
DECL_GFX_PREF(Once, "layers.progressive-paint", ProgressivePaintDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaintDoNotUseDirectly, bool, false);
DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false);
DECL_GFX_PREF(Once, "layers.gralloc.disable", DisableGralloc, bool, false);

View File

@ -64,12 +64,18 @@ struct IconURIParams
int32_t iconState;
};
struct NullPrincipalURIParams
{
// Purposefully empty. Null principal URIs do not round-trip.
};
union URIParams
{
SimpleURIParams;
StandardURLParams;
JARURIParams;
IconURIParams;
NullPrincipalURIParams;
};
union OptionalURIParams

View File

@ -13,6 +13,7 @@
#include "nsID.h"
#include "nsJARURI.h"
#include "nsIIconURI.h"
#include "nsNullPrincipalURI.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsThreadUtils.h"
@ -41,7 +42,7 @@ SerializeURI(nsIURI* aURI,
nsCOMPtr<nsIIPCSerializableURI> serializable = do_QueryInterface(aURI);
if (!serializable) {
MOZ_CRASH("All IPDL URIs must be serializable scheme!");
MOZ_CRASH("All IPDL URIs must be serializable!");
}
serializable->Serialize(aParams);
@ -90,6 +91,10 @@ DeserializeURI(const URIParams& aParams)
serializable = do_CreateInstance(kIconURICID);
break;
case URIParams::TNullPrincipalURIParams:
serializable = new nsNullPrincipalURI();
break;
default:
MOZ_CRASH("Unknown params!");
}

View File

@ -355,7 +355,7 @@ class JS_FRIEND_API(BaseProxyHandler)
* to add an override in CrossCompartmentWrapper. If you don't, you risk
* compartment mismatches. See bug 945826 comment 0.
*/
class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler
class JS_FRIEND_API(DirectProxyHandler) : public BaseProxyHandler
{
public:
explicit MOZ_CONSTEXPR DirectProxyHandler(const void *aFamily, bool aHasPrototype = false,

View File

@ -29,7 +29,7 @@ const Class SymbolObject::class_ = {
};
SymbolObject *
SymbolObject::create(JSContext *cx, JS::Symbol *symbol)
SymbolObject::create(JSContext *cx, JS::HandleSymbol symbol)
{
JSObject *obj = NewBuiltinClassInstance(cx, &class_);
if (!obj)

View File

@ -28,7 +28,7 @@ class SymbolObject : public NativeObject
* Creates a new Symbol object boxing the given primitive Symbol. The
* object's [[Prototype]] is determined from context.
*/
static SymbolObject *create(JSContext *cx, JS::Symbol *symbol);
static SymbolObject *create(JSContext *cx, JS::HandleSymbol symbol);
JS::Symbol *unbox() const {
return getFixedSlot(PRIMITIVE_VALUE_SLOT).toSymbol();

View File

@ -183,6 +183,18 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
if (!JS_SetProperty(cx, info, "intl-api", value))
return false;
#if defined(XP_WIN)
value = BooleanValue(false);
#elif defined(SOLARIS)
value = BooleanValue(false);
#elif defined(XP_UNIX)
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "mapped-array-buffer", value))
return false;
args.rval().setObject(*info);
return true;
}

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