Merge m-c to mozilla-inbound

This commit is contained in:
Carsten "Tomcat" Book 2013-10-10 13:42:10 +02:00
commit 907ba804fb
105 changed files with 743 additions and 8611 deletions

View File

@ -18,4 +18,4 @@
# Modifying this file will now automatically clobber the buildbot machines \o/
#
Bug 817194 needs a clobber on Windows due to bug 924992.
Bug 899574 needed a clobber, at least on Windows.

View File

@ -96,7 +96,6 @@ pref("browser.helperApps.deleteTempFileOnExit", false);
/* password manager */
pref("signon.rememberSignons", true);
pref("signon.expireMasterPassword", false);
pref("signon.SignonFileName", "signons.txt");
/* autocomplete */
pref("browser.formfill.enable", true);

View File

@ -1,4 +1,4 @@
{
"revision": "916fa42b75d23393752647ef2b44da15e2e1dd52",
"revision": "ed107ffac75d42dbacc19f81d0e2650e34c83a16",
"repo_path": "/integration/gaia-central"
}

View File

@ -383,7 +383,6 @@
@BINPATH@/components/HttpDataUsage.js
@BINPATH@/components/SiteSpecificUserAgent.js
@BINPATH@/components/SiteSpecificUserAgent.manifest
@BINPATH@/components/storage-Legacy.js
@BINPATH@/components/storage-mozStorage.js
@BINPATH@/components/crypto-SDR.js
@BINPATH@/components/jsconsole-clhandler.manifest

View File

@ -545,7 +545,7 @@ let gDevToolsBrowser = {
*/
_addToolToWindows: function DT_addToolToWindows(toolDefinition) {
// No menu item or global shortcut is required for options panel.
if (toolDefinition.id == "options") {
if (!toolDefinition.inMenu) {
return;
}
@ -561,7 +561,7 @@ let gDevToolsBrowser = {
let allDefs = gDevTools.getToolDefinitionArray();
let prevDef;
for (let def of allDefs) {
if (def.id == "options") {
if (!def.inMenu) {
continue;
}
if (def === toolDefinition) {
@ -630,7 +630,7 @@ let gDevToolsBrowser = {
let fragMenuItems = doc.createDocumentFragment();
for (let toolDefinition of gDevTools.getToolDefinitionArray()) {
if (toolDefinition.id == "options") {
if (!toolDefinition.inMenu) {
continue;
}

View File

@ -27,6 +27,7 @@ function testRegister(aToolbox)
gDevTools.registerTool({
id: "test-tool",
label: "Test Tool",
inMenu: true,
isTargetSupported: function() true,
build: function() {}
});

View File

@ -59,6 +59,7 @@ Tools.options = {
url: "chrome://browser/content/devtools/framework/toolbox-options.xul",
icon: "chrome://browser/skin/devtools/tool-options.png",
tooltip: l10n("optionsButton.tooltip", toolboxStrings),
inMenu: false,
isTargetSupported: function(target) {
return true;
},
@ -79,6 +80,7 @@ Tools.webConsole = {
label: l10n("ToolboxTabWebconsole.label", webConsoleStrings),
menuLabel: l10n("MenuWebconsole.label", webConsoleStrings),
tooltip: l10n("ToolboxWebconsole.tooltip", webConsoleStrings),
inMenu: true,
isTargetSupported: function(target) {
return true;
@ -99,6 +101,7 @@ Tools.inspector = {
url: "chrome://browser/content/devtools/inspector/inspector.xul",
label: l10n("inspector.label", inspectorStrings),
tooltip: l10n("inspector.tooltip", inspectorStrings),
inMenu: true,
preventClosingOnKey: true,
onkey: function(panel) {
@ -129,6 +132,7 @@ Tools.jsdebugger = {
url: "chrome://browser/content/devtools/debugger.xul",
label: l10n("ToolboxDebugger.label", debuggerStrings),
tooltip: l10n("ToolboxDebugger.tooltip", debuggerStrings),
inMenu: true,
isTargetSupported: function(target) {
return true;
@ -150,6 +154,7 @@ Tools.styleEditor = {
url: "chrome://browser/content/devtools/styleeditor.xul",
label: l10n("ToolboxStyleEditor.label", styleEditorStrings),
tooltip: l10n("ToolboxStyleEditor.tooltip2", styleEditorStrings),
inMenu: true,
isTargetSupported: function(target) {
return true;
@ -172,6 +177,7 @@ Tools.jsprofiler = {
url: "chrome://browser/content/devtools/profiler.xul",
label: l10n("profiler.label", profilerStrings),
tooltip: l10n("profiler.tooltip2", profilerStrings),
inMenu: true,
isTargetSupported: function (target) {
return true;
@ -194,6 +200,7 @@ Tools.netMonitor = {
url: "chrome://browser/content/devtools/netmonitor.xul",
label: l10n("netmonitor.label", netMonitorStrings),
tooltip: l10n("netmonitor.tooltip", netMonitorStrings),
inMenu: true,
isTargetSupported: function(target) {
return !target.isApp;
@ -213,6 +220,7 @@ Tools.scratchpad = {
url: "chrome://browser/content/devtools/scratchpad.xul",
label: l10n("scratchpad.label", scratchpadStrings),
tooltip: l10n("scratchpad.tooltip", scratchpadStrings),
inMenu: false,
isTargetSupported: function(target) {
return target.isRemote;

View File

@ -373,7 +373,6 @@
@BINPATH@/components/nsLoginInfo.js
@BINPATH@/components/nsLoginManager.js
@BINPATH@/components/nsLoginManagerPrompter.js
@BINPATH@/components/storage-Legacy.js
@BINPATH@/components/storage-mozStorage.js
@BINPATH@/components/crypto-SDR.js
@BINPATH@/components/jsconsole-clhandler.manifest

View File

@ -186,7 +186,6 @@ pref("browser.helperApps.deleteTempFileOnExit", false);
/* password manager */
pref("signon.rememberSignons", true);
pref("signon.SignonFileName", "signons.txt");
/* find helper */
pref("findhelper.autozoom", true);

View File

@ -0,0 +1,25 @@
# 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/.
JAVA_JAR_TARGETS += annotationProcessors
annotationProcessors_DEST := annotationProcessors.jar
annotationProcessors_JAVAFILES := \
AnnotationProcessor.java \
CodeGenerator.java \
MethodWithAnnotationInfo.java \
classloader/IterableJarLoadingURLClassLoader.java \
classloader/JarClassIterator.java \
utils/AlphabeticMethodComparator.java \
utils/GeneratableEntryPointIterator.java \
utils/Utils.java \
$(NULL)
include $(topsrcdir)/config/rules.mk
JAVA_CLASSPATH := $(ANDROID_SDK)/android.jar
# Include Android specific java flags, instead of what's in rules.mk.
include $(topsrcdir)/config/android-common.mk
libs:: annotationProcessors.jar

View File

@ -0,0 +1,5 @@
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

View File

@ -505,12 +505,12 @@ public class Utils {
* @param aClass Class to check for CharSequence-esqueness
* @return True if the given class implements CharSequence, false otherwise.
*/
public static boolean isCharSequence(Class aClass) {
public static boolean isCharSequence(Class<?> aClass) {
if (aClass.getCanonicalName().equals("java.lang.CharSequence")) {
return true;
}
Class[] interfaces = aClass.getInterfaces();
for (Class c : interfaces) {
Class<?>[] interfaces = aClass.getInterfaces();
for (Class<?> c : interfaces) {
if (c.getCanonicalName().equals("java.lang.CharSequence")) {
return true;
}

View File

@ -13,6 +13,7 @@ if CONFIG['OS_TARGET'] == 'Android' and not CONFIG['MOZ_ANDROID_LIBSTDCXX']:
DIRS += ['stlport']
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DIRS += ['annotationProcessors']
TEST_DIRS += [
'mobile/sutagent/android',
'mobile/sutagent/android/watcher',

View File

@ -90,6 +90,40 @@ endif #} ANDROID_EXTRA_JARS
include $(topsrcdir)/config/android-common.mk
endif #} ANDROID_APK_NAME
ifdef JAVA_JAR_TARGETS #{
# Arg 1: Output target name with .jar suffix, like jars/jarfile.jar.
# Intermediate class files are generated in jars/jarfile-classes.
# Arg 2: Java sources list. We use VPATH and $^ so sources can be
# relative to $(srcdir) or $(CURDIR).
# Arg 3: List of extra jars to link against. We do not use VPATH so
# jars must be relative to $(CURDIR).
# Arg 4: Additional JAVAC_FLAGS.
define java_jar_template
$(1): $(2) $(3)
$$(REPORT_BUILD)
@$$(NSINSTALL) -D $(1:.jar=)-classes
@$$(if $$(filter-out .,$$(@D)),$$(NSINSTALL) -D $$(@D))
$$(JAVAC) $$(JAVAC_FLAGS)\
$(4)\
-d $(1:.jar=)-classes\
$(if $(strip $(3)),-classpath $(subst $(NULL) ,:,$(strip $(3))))\
$$(filter %.java,$$^)
$$(JAR) cMf $$@ -C $(1:.jar=)-classes .
GARBAGE += $(1)
GARBAGE_DIRS += $(1:.jar=)-classes
endef
$(foreach jar,$(JAVA_JAR_TARGETS),\
$(if $($(jar)_DEST),,$(error Missing $(jar)_DEST))\
$(if $($(jar)_JAVAFILES),,$(error Missing $(jar)_JAVAFILES))\
$(eval $(call java_jar_template,$($(jar)_DEST),$($(jar)_JAVAFILES) $($(jar)_PP_JAVAFILES),$($(jar)_EXTRA_JARS),$($(jar)_JAVAC_FLAGS)))\
)
endif #} JAVA_JAR_TARGETS
INCLUDED_JAVA_BUILD_MK := 1
endif #} INCLUDED_JAVA_BUILD_MK

View File

@ -1221,7 +1221,7 @@ endif
###############################################################################
# Java rules
###############################################################################
ifneq (,$(value JAVAFILES)$(value ANDROID_RESFILES))
ifneq (,$(JAVAFILES)$(ANDROID_RESFILES)$(ANDROID_APKNAME)$(JAVA_JAR_TARGETS))
include $(topsrcdir)/config/makefiles/java-build.mk
endif

View File

@ -90,6 +90,40 @@ endif #} ANDROID_EXTRA_JARS
include $(topsrcdir)/config/android-common.mk
endif #} ANDROID_APK_NAME
ifdef JAVA_JAR_TARGETS #{
# Arg 1: Output target name with .jar suffix, like jars/jarfile.jar.
# Intermediate class files are generated in jars/jarfile-classes.
# Arg 2: Java sources list. We use VPATH and $^ so sources can be
# relative to $(srcdir) or $(CURDIR).
# Arg 3: List of extra jars to link against. We do not use VPATH so
# jars must be relative to $(CURDIR).
# Arg 4: Additional JAVAC_FLAGS.
define java_jar_template
$(1): $(2) $(3)
$$(REPORT_BUILD)
@$$(NSINSTALL) -D $(1:.jar=)-classes
@$$(if $$(filter-out .,$$(@D)),$$(NSINSTALL) -D $$(@D))
$$(JAVAC) $$(JAVAC_FLAGS)\
$(4)\
-d $(1:.jar=)-classes\
$(if $(strip $(3)),-classpath $(subst $(NULL) ,:,$(strip $(3))))\
$$(filter %.java,$$^)
$$(JAR) cMf $$@ -C $(1:.jar=)-classes .
GARBAGE += $(1)
GARBAGE_DIRS += $(1:.jar=)-classes
endef
$(foreach jar,$(JAVA_JAR_TARGETS),\
$(if $($(jar)_DEST),,$(error Missing $(jar)_DEST))\
$(if $($(jar)_JAVAFILES),,$(error Missing $(jar)_JAVAFILES))\
$(eval $(call java_jar_template,$($(jar)_DEST),$($(jar)_JAVAFILES) $($(jar)_PP_JAVAFILES),$($(jar)_EXTRA_JARS),$($(jar)_JAVAC_FLAGS)))\
)
endif #} JAVA_JAR_TARGETS
INCLUDED_JAVA_BUILD_MK := 1
endif #} INCLUDED_JAVA_BUILD_MK

View File

@ -1221,7 +1221,7 @@ endif
###############################################################################
# Java rules
###############################################################################
ifneq (,$(value JAVAFILES)$(value ANDROID_RESFILES))
ifneq (,$(JAVAFILES)$(ANDROID_RESFILES)$(ANDROID_APKNAME)$(JAVA_JAR_TARGETS))
include $(topsrcdir)/config/makefiles/java-build.mk
endif

View File

@ -146,7 +146,6 @@ pref("browser.helperApps.deleteTempFileOnExit", false);
/* password manager */
pref("signon.rememberSignons", true);
pref("signon.expireMasterPassword", false);
pref("signon.SignonFileName", "signons.txt");
pref("signon.debug", false);
/* form helper (scroll to and optionally zoom into editable fields) */

View File

@ -172,7 +172,13 @@
</intent-filter>
</activity>
#include @OBJDIR@/WebAppManifestFragment.xml.in
<!-- Declare a predefined number of WebApp<num> activities. These are
used so that each web app can launch in its own process. Keep
this number in sync with the total number of web apps handled in
WebAppAllocator. -->
#define FRAGMENT WebAppManifestFragment.xml.frag
#include WebAppFragmentRepeater.inc
<!-- Masquerade as the Resolver so that we can be opened from the Marketplace. -->
<activity-alias

View File

@ -1230,6 +1230,77 @@ ifdef MOZ_WEBRTC
ALL_JARS += jars/webrtc.jar
endif
JAVA_JAR_TARGETS += websockets
websockets_DEST := jars/websockets.jar
websockets_JAVAFILES := \
$(WEBSOCKETS_JAVA_FILES) \
$(NULL)
websockets_JAVAC_FLAGS := -Xlint:all,-serial
JAVA_JAR_TARGETS += gecko-browser
gecko-browser_DEST := jars/gecko-browser.jar
gecko-browser_JAVAFILES := \
$(FENNEC_JAVA_FILES) \
$(SYNC_JAVA_FILES) \
$(NULL)
gecko-browser_PP_JAVAFILES := \
$(FENNEC_PP_JAVA_FILES) \
$(FENNEC_PP_JAVA_VIEW_FILES) \
$(SYNC_PP_JAVA_FILES) \
R.java \
$(NULL)
gecko-browser_EXTRA_JARS := \
jars/gecko-mozglue.jar \
jars/gecko-util.jar \
jars/sync-thirdparty.jar \
jars/websockets.jar \
$(NULL)
gecko-browser_JAVAC_FLAGS := -Xlint:all,-deprecation,-fallthrough
JAVA_JAR_TARGETS += gecko-mozglue
gecko-mozglue_DEST := jars/gecko-mozglue.jar
gecko-mozglue_JAVAFILES := \
$(MOZGLUE_JAVA_FILES) \
$(NULL)
gecko-mozglue_PP_JAVAFILES := \
$(MOZGLUE_PP_JAVA_FILES) \
$(NULL)
gecko-mozglue_JAVAC_FLAGS := -Xlint:all
JAVA_JAR_TARGETS += gecko-util
gecko-util_DEST := jars/gecko-util.jar
gecko-util_JAVAFILES := \
$(UTIL_JAVA_FILES) \
$(UTIL_PP_JAVA_FILES) \
$(NULL)
gecko-util_EXTRA_JARS := \
jars/gecko-mozglue.jar \
$(NULL)
gecko-util_JAVAC_FLAGS := -Xlint:all,-deprecation
JAVA_JAR_TARGETS += sync-thirdparty
sync-thirdparty_DEST := jars/sync-thirdparty.jar
sync-thirdparty_JAVAFILES := \
$(SYNC_THIRDPARTY_JAVA_FILES) \
$(NULL)
sync-thirdparty_JAVAC_FLAGS := -Xlint:none
ifdef MOZ_WEBRTC
JAVA_JAR_TARGETS += webrtc
webrtc_DEST := jars/webrtc.jar
webrtc_JAVAFILES := \
$(WEBRTC_JAVA_FILES) \
$(NULL)
webrtc_EXTRA_JARS := \
jars/gecko-browser.jar \
jars/gecko-util.jar \
jars/gecko-mozglue.jar \
$(NULL)
webrtc_JAVAC_FLAGS := -Xlint:all,-deprecation,-cast
endif
include $(topsrcdir)/config/makefiles/java-build.mk
include $(topsrcdir)/config/rules.mk
# Override the Java settings with some specific android settings
@ -1242,49 +1313,7 @@ include $(topsrcdir)/config/android-common.mk
# indices.
classes.dex: $(ALL_JARS)
@echo "DX classes.dex"
$(DX) --dex --output=classes.dex jars $(ANDROID_COMPAT_LIB)
jars/gecko-browser.jar: jars/gecko-mozglue.jar jars/gecko-util.jar jars/sync-thirdparty.jar jars/websockets.jar $(addprefix $(srcdir)/,$(FENNEC_JAVA_FILES)) $(FENNEC_PP_JAVA_FILES) $(FENNEC_PP_JAVA_VIEW_FILES) $(addprefix $(srcdir)/,$(SYNC_JAVA_FILES)) $(SYNC_PP_JAVA_FILES) R.java
@echo "JAR gecko-browser.jar"
$(NSINSTALL) -D classes/gecko-browser
$(JAVAC) $(JAVAC_FLAGS) -Xlint:all,-deprecation,-fallthrough -d classes/gecko-browser -classpath "jars/gecko-mozglue.jar:jars/gecko-util.jar:jars/sync-thirdparty.jar:jars/websockets.jar" $(addprefix $(srcdir)/,$(FENNEC_JAVA_FILES)) $(FENNEC_PP_JAVA_FILES) $(FENNEC_PP_JAVA_VIEW_FILES) $(addprefix $(srcdir)/,$(SYNC_JAVA_FILES)) $(SYNC_PP_JAVA_FILES) R.java
$(JAR) cMf jars/gecko-browser.jar -C classes/gecko-browser .
jars/gecko-mozglue.jar: $(addprefix $(srcdir)/,$(MOZGLUE_JAVA_FILES)) $(MOZGLUE_PP_JAVA_FILES) jars
@echo "JAR gecko-mozglue.jar"
$(NSINSTALL) -D classes/gecko-mozglue
$(JAVAC) $(JAVAC_FLAGS) -Xlint:all -d classes/gecko-mozglue $(addprefix $(srcdir)/,$(MOZGLUE_JAVA_FILES)) $(MOZGLUE_PP_JAVA_FILES)
$(JAR) cMf jars/gecko-mozglue.jar -C classes/gecko-mozglue .
jars/gecko-util.jar: jars/gecko-mozglue.jar $(addprefix $(srcdir)/,$(UTIL_JAVA_FILES)) jars
@echo "JAR gecko-util.jar"
$(NSINSTALL) -D classes/gecko-util
$(JAVAC) $(JAVAC_FLAGS) -Xlint:all,-deprecation -d classes/gecko-util -classpath "jars/gecko-mozglue.jar" $(addprefix $(srcdir)/,$(UTIL_JAVA_FILES))
$(JAR) cMf jars/gecko-util.jar -C classes/gecko-util .
jars/sync-thirdparty.jar: $(addprefix $(srcdir)/,$(SYNC_THIRDPARTY_JAVA_FILES)) jars
@echo "JAR sync-thirdparty.jar"
$(NSINSTALL) -D classes/sync-thirdparty
$(JAVAC) $(JAVAC_FLAGS) -d classes/sync-thirdparty $(addprefix $(srcdir)/,$(SYNC_THIRDPARTY_JAVA_FILES))
$(JAR) cMf jars/sync-thirdparty.jar -C classes/sync-thirdparty .
jars/websockets.jar: $(addprefix $(srcdir)/, $(WEBSOCKETS_JAVA_FILES)) jars
@echo "JAR websockets.jar"
$(NSINSTALL) -D classes/websockets
$(JAVAC) $(JAVAC_FLAGS) -Xlint:all,-serial -d classes/websockets $(addprefix $(srcdir)/,$(WEBSOCKETS_JAVA_FILES))
$(JAR) cMf jars/websockets.jar -C classes/websockets .
ifdef MOZ_WEBRTC
jars/webrtc.jar: $(addprefix $(srcdir)/, $(WEBRTC_JAVA_FILES)) jars jars/gecko-browser.jar jars/gecko-util.jar jars/gecko-mozglue.jar
@echo "JAR webrtc.jar"
$(NSINSTALL) -D classes/webrtc
$(JAVAC) $(JAVAC_FLAGS) -d classes/webrtc -classpath classes/gecko-browser:classes/gecko-util:classes/gecko-mozglue $(addprefix $(srcdir)/,$(WEBRTC_JAVA_FILES))
$(JAR) cMf jars/webrtc.jar -C classes/webrtc .
endif
jars:
@echo "MKDIR jars"
$(NSINSTALL) -D jars
$(DX) --dex --output=classes.dex $(ALL_JARS) $(ANDROID_COMPAT_LIB)
CLASSES_WITH_JNI= \
org.mozilla.gecko.GeckoAppShell \
@ -1306,20 +1335,11 @@ jni-stubs.inc: jars/gecko-browser.jar jars/gecko-mozglue.jar jars/gecko-util.jar
$(JAVAH) -o javah.out -bootclasspath $(JAVA_BOOTCLASSPATH) -classpath $(subst $(NULL) $(NULL),:,$^) $(CLASSES_WITH_JNI)
$(PYTHON) $(topsrcdir)/mobile/android/base/jni-generator.py javah.out $@
ANNOTATION_PROCESSOR_JAVA_FILES = \
build/annotationProcessors/AnnotationProcessor.java \
build/annotationProcessors/CodeGenerator.java \
build/annotationProcessors/MethodWithAnnotationInfo.java \
build/annotationProcessors/classloader/IterableJarLoadingURLClassLoader.java \
build/annotationProcessors/classloader/JarClassIterator.java \
build/annotationProcessors/utils/AlphabeticMethodComparator.java \
build/annotationProcessors/utils/GeneratableEntryPointIterator.java \
build/annotationProcessors/utils/Utils.java \
$(NULL)
ANNOTATION_PROCESSOR_JAR_FILES := $(DEPTH)/build/annotationProcessors/annotationProcessors.jar
GeneratedJNIWrappers.cpp: jars/gecko-browser.jar jars/gecko-mozglue.jar jars/gecko-util.jar jars/sync-thirdparty.jar
$(JAVAC) $(addprefix $(topsrcdir)/,$(ANNOTATION_PROCESSOR_JAVA_FILES)) -d $(CURDIR)
$(JAVA) -classpath $(JAVA_BOOTCLASSPATH):$(CURDIR) org.mozilla.gecko.annotationProcessors.AnnotationProcessor $^
GeneratedJNIWrappers.cpp: $(ANNOTATION_PROCESSOR_JAR_FILES)
GeneratedJNIWrappers.cpp: $(ALL_JARS)
$(JAVA) -classpath $(JAVA_BOOTCLASSPATH):$(ANNOTATION_PROCESSOR_JAR_FILES) org.mozilla.gecko.annotationProcessors.AnnotationProcessor $(ALL_JARS)
PP_RES_XML= \
$(SYNC_PP_RES_XML) \
@ -1348,29 +1368,11 @@ android-preqs = \
$(call mkdir_deps,$(sort $(dir $(FENNEC_PP_JAVA_FILES)))) \
$(call mkdir_deps,$(sort $(dir $(SYNC_PP_JAVA_FILES)))) \
$(SERVICES_MANIFEST_FRAGMENTS) \
WebAppManifestFragment.xml.in \
WebAppsFragments.java \
$(NULL)
$(android-tgts): % : %.in $(android-preqs)
$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
$(AUTOMATION_PPARGS) -DOBJDIR="`pwd`" $(DEFINES) $(ACDEFINES) $< > $@
# Add a predefined number of WebApp<num> classes to the WebApps class.
# These are used so that each webapp can launch in its own process
# Keep this number in sync with the max web apps in WebAppAllocator.java
NUM_WEB_APPS=100
WebAppManifestFragment.xml.in: WebAppManifestFragment.xml.frag
@rm -f $@
@for n in `$(PYTHON) -c "for x in range($(NUM_WEB_APPS)): print x"`; do \
cat $< | sed s,@APPNUM@,$$n,g >> $@ ; \
done
WebAppsFragments.java: WebAppsFragment.java.frag
@rm -f $@
@for n in `$(PYTHON) -c "for x in range($(NUM_WEB_APPS)): print x"`; do \
cat $< | sed s,@APPNUM@,$$n,g >> $@ ; \
done
$(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
# Replace @VIEWTYPE@ with different View names.
$(FENNEC_PP_JAVA_VIEW_FILES): GeckoView.java.frag

View File

@ -0,0 +1,301 @@
#define APPNUM 0
#include @FRAGMENT@
#define APPNUM 1
#include @FRAGMENT@
#define APPNUM 2
#include @FRAGMENT@
#define APPNUM 3
#include @FRAGMENT@
#define APPNUM 4
#include @FRAGMENT@
#define APPNUM 5
#include @FRAGMENT@
#define APPNUM 6
#include @FRAGMENT@
#define APPNUM 7
#include @FRAGMENT@
#define APPNUM 8
#include @FRAGMENT@
#define APPNUM 9
#include @FRAGMENT@
#define APPNUM 10
#include @FRAGMENT@
#define APPNUM 11
#include @FRAGMENT@
#define APPNUM 12
#include @FRAGMENT@
#define APPNUM 13
#include @FRAGMENT@
#define APPNUM 14
#include @FRAGMENT@
#define APPNUM 15
#include @FRAGMENT@
#define APPNUM 16
#include @FRAGMENT@
#define APPNUM 17
#include @FRAGMENT@
#define APPNUM 18
#include @FRAGMENT@
#define APPNUM 19
#include @FRAGMENT@
#define APPNUM 20
#include @FRAGMENT@
#define APPNUM 21
#include @FRAGMENT@
#define APPNUM 22
#include @FRAGMENT@
#define APPNUM 23
#include @FRAGMENT@
#define APPNUM 24
#include @FRAGMENT@
#define APPNUM 25
#include @FRAGMENT@
#define APPNUM 26
#include @FRAGMENT@
#define APPNUM 27
#include @FRAGMENT@
#define APPNUM 28
#include @FRAGMENT@
#define APPNUM 29
#include @FRAGMENT@
#define APPNUM 30
#include @FRAGMENT@
#define APPNUM 31
#include @FRAGMENT@
#define APPNUM 32
#include @FRAGMENT@
#define APPNUM 33
#include @FRAGMENT@
#define APPNUM 34
#include @FRAGMENT@
#define APPNUM 35
#include @FRAGMENT@
#define APPNUM 36
#include @FRAGMENT@
#define APPNUM 37
#include @FRAGMENT@
#define APPNUM 38
#include @FRAGMENT@
#define APPNUM 39
#include @FRAGMENT@
#define APPNUM 40
#include @FRAGMENT@
#define APPNUM 41
#include @FRAGMENT@
#define APPNUM 42
#include @FRAGMENT@
#define APPNUM 43
#include @FRAGMENT@
#define APPNUM 44
#include @FRAGMENT@
#define APPNUM 45
#include @FRAGMENT@
#define APPNUM 46
#include @FRAGMENT@
#define APPNUM 47
#include @FRAGMENT@
#define APPNUM 48
#include @FRAGMENT@
#define APPNUM 49
#include @FRAGMENT@
#define APPNUM 50
#include @FRAGMENT@
#define APPNUM 51
#include @FRAGMENT@
#define APPNUM 52
#include @FRAGMENT@
#define APPNUM 53
#include @FRAGMENT@
#define APPNUM 54
#include @FRAGMENT@
#define APPNUM 55
#include @FRAGMENT@
#define APPNUM 56
#include @FRAGMENT@
#define APPNUM 57
#include @FRAGMENT@
#define APPNUM 58
#include @FRAGMENT@
#define APPNUM 59
#include @FRAGMENT@
#define APPNUM 60
#include @FRAGMENT@
#define APPNUM 61
#include @FRAGMENT@
#define APPNUM 62
#include @FRAGMENT@
#define APPNUM 63
#include @FRAGMENT@
#define APPNUM 64
#include @FRAGMENT@
#define APPNUM 65
#include @FRAGMENT@
#define APPNUM 66
#include @FRAGMENT@
#define APPNUM 67
#include @FRAGMENT@
#define APPNUM 68
#include @FRAGMENT@
#define APPNUM 69
#include @FRAGMENT@
#define APPNUM 70
#include @FRAGMENT@
#define APPNUM 71
#include @FRAGMENT@
#define APPNUM 72
#include @FRAGMENT@
#define APPNUM 73
#include @FRAGMENT@
#define APPNUM 74
#include @FRAGMENT@
#define APPNUM 75
#include @FRAGMENT@
#define APPNUM 76
#include @FRAGMENT@
#define APPNUM 77
#include @FRAGMENT@
#define APPNUM 78
#include @FRAGMENT@
#define APPNUM 79
#include @FRAGMENT@
#define APPNUM 80
#include @FRAGMENT@
#define APPNUM 81
#include @FRAGMENT@
#define APPNUM 82
#include @FRAGMENT@
#define APPNUM 83
#include @FRAGMENT@
#define APPNUM 84
#include @FRAGMENT@
#define APPNUM 85
#include @FRAGMENT@
#define APPNUM 86
#include @FRAGMENT@
#define APPNUM 87
#include @FRAGMENT@
#define APPNUM 88
#include @FRAGMENT@
#define APPNUM 89
#include @FRAGMENT@
#define APPNUM 90
#include @FRAGMENT@
#define APPNUM 91
#include @FRAGMENT@
#define APPNUM 92
#include @FRAGMENT@
#define APPNUM 93
#include @FRAGMENT@
#define APPNUM 94
#include @FRAGMENT@
#define APPNUM 95
#include @FRAGMENT@
#define APPNUM 96
#include @FRAGMENT@
#define APPNUM 97
#include @FRAGMENT@
#define APPNUM 98
#include @FRAGMENT@
#define APPNUM 99
#include @FRAGMENT@
#undef APPNUM
#undef FRAGMENT

View File

@ -6,8 +6,12 @@
#filter substitution
package @ANDROID_PACKAGE_NAME@;
/**
* Declare a predefined number of WebApp<num> classes to the WebApps class.
* These are used so that each web app can launch in its own process. Keep this
* number in sync with the number of web apps handled in WebAppAllocator.
*/
public final class WebApps {
#include @OBJDIR@/WebAppsFragments.java
#define FRAGMENT WebAppsFragment.java.frag
#include WebAppFragmentRepeater.inc
}

View File

@ -20,6 +20,7 @@ import android.support.v4.widget.CursorAdapter;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -98,6 +99,24 @@ class PinSiteDialog extends DialogFragment {
}
});
mSearch.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode != KeyEvent.KEYCODE_ENTER || mOnSiteSelectedListener == null) {
return false;
}
// If the user manually entered a search term or URL, wrap the value in
// a special URI until we can get a valid URL for this bookmark.
final String text = mSearch.getText().toString();
final String url = TopSitesPage.encodeUserEnteredUrl(text);
mOnSiteSelectedListener.onSiteSelected(url, text);
dismiss();
return true;
}
});
mList = (HomeListView) view.findViewById(R.id.list);
mList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override

View File

@ -95,7 +95,9 @@ public class TopSitesGridView extends GridView {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
TopSitesGridItemView row = (TopSitesGridItemView) view;
String url = row.getUrl();
// Decode "user-entered" URLs before loading them.
String url = TopSitesPage.decodeUserEnteredUrl(row.getUrl());
// If the url is empty, the user can pin a site.
// If not, navigate to the page given by the url.

View File

@ -29,6 +29,7 @@ import android.content.Context;
import android.content.res.Configuration;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.LoaderManager;
@ -316,7 +317,8 @@ public class TopSitesPage extends HomeFragment {
if (item.getItemId() == R.id.top_sites_open_private_tab)
flags |= Tabs.LOADURL_PRIVATE;
Tabs.getInstance().loadUrl(info.url, flags);
// Decode "user-entered" URLs before loading them.
Tabs.getInstance().loadUrl(decodeUserEnteredUrl(info.url), flags);
Toast.makeText(activity, R.string.new_tab_opened, Toast.LENGTH_SHORT).show();
return true;
}
@ -372,6 +374,18 @@ public class TopSitesPage extends HomeFragment {
ThreadUtils.reduceGeckoPriority(PRIORITY_RESET_TIMEOUT);
}
static String encodeUserEnteredUrl(String url) {
return Uri.fromParts("user-entered", url, null).toString();
}
static String decodeUserEnteredUrl(String url) {
Uri uri = Uri.parse(url);
if ("user-entered".equals(uri.getScheme())) {
return uri.getSchemeSpecificPart();
}
return url;
}
/**
* Listener for pinning sites.
*/

View File

@ -29,7 +29,7 @@
android:textSelectHandleRight="@drawable/handle_end"
android:textCursorDrawable="@null"
android:inputType="textUri|textNoSuggestions"
android:imeOptions="actionSearch|flagNoExtractUi|flagNoFullscreen"
android:imeOptions="actionGo|flagNoExtractUi|flagNoFullscreen"
android:singleLine="true"
android:gravity="center_vertical|left"/>

View File

@ -25,7 +25,7 @@ package:
$(MKDIR) -p bin gen libs/$(ABI_DIR) src
# Copy the JARs
cp ../base/jars/* libs/
cp ../base/jars/*.jar libs/
# Copy the SOs
cp $(DIST)/bin/libmozglue.so $(DIST)/bin/lib/libplugin-container.so libs/$(ABI_DIR)/

View File

@ -314,7 +314,6 @@
@BINPATH@/components/nsLoginManagerPrompter.js
@BINPATH@/components/SiteSpecificUserAgent.js
@BINPATH@/components/SiteSpecificUserAgent.manifest
@BINPATH@/components/storage-Legacy.js
@BINPATH@/components/storage-mozStorage.js
@BINPATH@/components/crypto-SDR.js
@BINPATH@/components/jsconsole-clhandler.manifest

File diff suppressed because one or more lines are too long

View File

@ -3971,9 +3971,6 @@ pref("print.print_command", "lp -c -s ${MOZ_PRINTER_NAME:+-d\"$MOZ_PRINTER_NAME\
// Login Manager prefs
pref("signon.rememberSignons", true);
pref("signon.SignonFileName", "signons.txt"); // obsolete
pref("signon.SignonFileName2", "signons2.txt"); // obsolete
pref("signon.SignonFileName3", "signons3.txt"); // obsolete
pref("signon.autofillForms", true);
pref("signon.autologin.proxy", false);
pref("signon.debug", false);

View File

@ -145,14 +145,7 @@ LoginManagerCrypto_SDR.prototype = {
this._uiBusy = true;
try {
let plainOctet;
if (cipherText.charAt(0) == '~') {
// The old Wallet file format obscured entries by
// base64-encoding them. These entries are signaled by a
// leading '~' character.
plainOctet = atob(cipherText.substring(1));
} else {
plainOctet = this._decoderRing.decryptString(cipherText);
}
plainOctet = this._decoderRing.decryptString(cipherText);
plainText = this._utfConverter.ConvertToUnicode(plainOctet);
} catch (e) {
this.log("Failed to decrypt string: " + cipherText +

View File

@ -10,7 +10,6 @@ XPIDL_SOURCES += [
'nsILoginInfo.idl',
'nsILoginManager.idl',
'nsILoginManagerCrypto.idl',
'nsILoginManagerIEMigrationHelper.idl',
'nsILoginManagerPrompter.idl',
'nsILoginManagerStorage.idl',
'nsILoginMetaInfo.idl',
@ -24,7 +23,6 @@ EXTRA_COMPONENTS += [
'nsLoginManager.js',
'nsLoginManagerPrompter.js',
'passwordmgr.manifest',
'storage-Legacy.js',
]
EXTRA_PP_COMPONENTS += [

View File

@ -9,7 +9,7 @@
interface nsILoginManagerCrypto : nsISupports {
const unsigned long ENCTYPE_BASE64 = 0;
const unsigned long ENCTYPE_BASE64 = 0; // obsolete
const unsigned long ENCTYPE_SDR = 1;
/**

View File

@ -1,25 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
interface nsILoginInfo;
[scriptable, uuid(8a59ea3d-b8d0-48af-a3e2-63e27a02cde7)]
interface nsILoginManagerIEMigrationHelper : nsISupports {
/**
* Takes a login provided from nsIEProfileMigrator, migrates it to the
* current login manager format, and adds it to the list of stored logins.
*
* @param aLogin
* The login to be migrated.
*
* Note: In some cases, multiple logins may be created from a single input
* when the format is ambigious.
*
*/
void migrateAndAddLogin(in nsILoginInfo aLogin);
};

View File

@ -9,7 +9,7 @@ interface nsIFile;
interface nsILoginInfo;
interface nsIPropertyBag;
[scriptable, uuid(d9fee9e2-c649-4c47-8c85-90fbbb5ccf67)]
[scriptable, uuid(fe0a4e80-d36f-43cc-a37b-4e1906e77257)]
/*
* NOTE: This interface is intended to be implemented by modules
@ -30,13 +30,11 @@ interface nsILoginManagerStorage : nsISupports {
* locations. This is primarily used to the unit tests and profile
* migration.
*
* @param aInputFile
* File to read for stored logins.
* @param aOutputFile
* If non-null, file to output logins to.
* @param aFile
* If non-null, file to use for login storage.
*
*/
void initWithFile(in nsIFile aInputFile, in nsIFile aOutputFile);
void initWithFile(in nsIFile aFile);
/**

View File

@ -15,12 +15,6 @@ nsLoginInfo.prototype = {
classID : Components.ID("{0f2f347c-1e4f-40cc-8efd-792dea70a85e}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsILoginInfo, Ci.nsILoginMetaInfo]),
// Allow storage-Legacy.js to get at the JS object so it can
// slap on a few extra properties for internal use.
get wrappedJSObject() {
return this;
},
//
// nsILoginInfo interfaces...
//

View File

@ -6,8 +6,6 @@ component {8aa66d77-1bbb-45a6-991e-b8f47751c291} nsLoginManagerPrompter.js
contract @mozilla.org/login-manager/prompter;1 {8aa66d77-1bbb-45a6-991e-b8f47751c291}
component {0f2f347c-1e4f-40cc-8efd-792dea70a85e} nsLoginInfo.js
contract @mozilla.org/login-manager/loginInfo;1 {0f2f347c-1e4f-40cc-8efd-792dea70a85e}
component {e09e4ca6-276b-4bb4-8b71-0635a3a2a007} storage-Legacy.js
contract @mozilla.org/login-manager/storage/legacy;1 {e09e4ca6-276b-4bb4-8b71-0635a3a2a007}
component {8c2023b9-175c-477e-9761-44ae7b549756} storage-mozStorage.js
contract @mozilla.org/login-manager/storage/mozStorage;1 {8c2023b9-175c-477e-9761-44ae7b549756}
component {dc6c2976-0f73-4f1f-b9ff-3d72b4e28309} crypto-SDR.js

File diff suppressed because it is too large Load Diff

View File

@ -147,9 +147,7 @@ LoginManagerStorage_mozStorage.prototype = {
_prefBranch : null, // Preferences service
_signonsFile : null, // nsIFile for "signons.sqlite"
_importFile : null, // nsIFile for import from legacy
_debug : false, // mirrors signon.debug
_base64checked : false,
/*
@ -170,11 +168,8 @@ LoginManagerStorage_mozStorage.prototype = {
*
* Initialize the component, but override the default filename locations.
* This is primarily used to the unit tests and profile migration.
* aImportFile is legacy storage file, aDBFile is a sqlite/mozStorage file.
*/
initWithFile : function(aImportFile, aDBFile) {
if (aImportFile)
this._importFile = aImportFile;
initWithFile : function(aDBFile) {
if (aDBFile)
this._signonsFile = aDBFile;
@ -185,8 +180,6 @@ LoginManagerStorage_mozStorage.prototype = {
/*
* init
*
* Initialize this storage component; import from legacy files, if
* necessary. Most of the work is done in _deferredInit.
*/
init : function () {
this._dbStmts = {};
@ -197,6 +190,10 @@ LoginManagerStorage_mozStorage.prototype = {
let isFirstRun;
try {
// Force initialization of the crypto module.
// See bug 717490 comment 17.
this._crypto;
// If initWithFile is calling us, _signonsFile may already be set.
if (!this._signonsFile) {
// Initialize signons.sqlite
@ -208,13 +205,6 @@ LoginManagerStorage_mozStorage.prototype = {
// Initialize the database (create, migrate as necessary)
isFirstRun = this._dbInit();
// On first run we want to import the default legacy storage files.
// Otherwise if passed a file, import from that.
if (isFirstRun && !this._importFile)
this._importLegacySignons();
else if (this._importFile)
this._importLegacySignons(this._importFile);
this._initialized = true;
} catch (e) {
this.log("Initialization failed: " + e);
@ -231,28 +221,12 @@ LoginManagerStorage_mozStorage.prototype = {
*
*/
addLogin : function (login) {
this._addLogin(login, false);
},
/*
* _addLogin
*
* Private function wrapping core addLogin functionality.
*/
_addLogin : function (login, isEncrypted) {
let encUsername, encPassword;
// Throws if there are bogus values.
this._checkLoginValues(login);
// isEncrypted only set when importing from an legacy (signons3.txt)
// format, which only would have used SDR or BASE64 encoding. The
// latter of which is handled a little further down.
if (isEncrypted)
[encUsername, encPassword, encType] = [login.username, login.password, Ci.nsILoginManagerCrypto.ENCTYPE_SDR];
else
[encUsername, encPassword, encType] = this._encryptLogin(login);
[encUsername, encPassword, encType] = this._encryptLogin(login);
// Clone the login, so we don't modify the caller's object.
let loginClone = login.clone();
@ -266,11 +240,6 @@ LoginManagerStorage_mozStorage.prototype = {
loginClone.guid = this._uuidService.generateUUID().toString();
}
// If we're migrating legacy storage, check for base64 logins.
if (isEncrypted &&
(encUsername.charAt(0) == '~' || encPassword.charAt(0) == '~'))
encType = this._crypto.ENCTYPE_BASE64;
// Set timestamps
let currentTime = Date.now();
if (!loginClone.timeCreated)
@ -314,7 +283,7 @@ LoginManagerStorage_mozStorage.prototype = {
stmt = this._dbCreateStatement(query, params);
stmt.execute();
} catch (e) {
this.log("_addLogin failed: " + e.name + " : " + e.message);
this.log("addLogin failed: " + e.name + " : " + e.message);
throw "Couldn't write to database, login not added.";
} finally {
if (stmt) {
@ -323,8 +292,7 @@ LoginManagerStorage_mozStorage.prototype = {
}
// Send a notification that a login was added.
if (!isEncrypted)
this._sendNotification("addLogin", loginClone);
this._sendNotification("addLogin", loginClone);
},
@ -687,9 +655,6 @@ LoginManagerStorage_mozStorage.prototype = {
let stmt;
let transaction = new Transaction(this._dbConnection);
// Delete any old, unused files.
this._removeOldSignonsFiles();
// Disabled hosts kept, as one presumably doesn't want to erase those.
// TODO: Add these items to the deleted items table once we've sorted
// out the issues from bug 756701
@ -1063,76 +1028,6 @@ LoginManagerStorage_mozStorage.prototype = {
},
/*
* _importLegacySignons
*
* Imports a file that uses Legacy storage. Will use importFile if provided
* else it will attempt to initialize the Legacy storage normally.
*
*/
_importLegacySignons : function (importFile) {
this.log("Importing " + (importFile ? importFile.path : "legacy storage"));
let legacy = Cc["@mozilla.org/login-manager/storage/legacy;1"].
createInstance(Ci.nsILoginManagerStorage);
// Import all logins and disabled hosts
try {
if (importFile)
legacy.initWithFile(importFile, null);
else
legacy.init();
// Import logins and disabledHosts
let logins = legacy.getAllEncryptedLogins();
// Wrap in a transaction for better performance.
let transaction = new Transaction(this._dbConnection);
for each (let login in logins) {
try {
this._addLogin(login, true);
} catch (e) {
this.log("_importLegacySignons failed to add login: " + e);
}
}
let disabledHosts = legacy.getAllDisabledHosts();
for each (let hostname in disabledHosts)
this.setLoginSavingEnabled(hostname, false);
transaction.commit();
} catch (e) {
this.log("_importLegacySignons failed: " + e.name + " : " + e.message);
throw "Import failed";
}
},
/*
* _removeOldSignonsFiles
*
* Deletes any storage files that we're not using any more.
*/
_removeOldSignonsFiles : function () {
// We've used a number of prefs over time due to compatibility issues.
// We want to delete all files referenced in prefs, which are only for
// importing and clearing logins from storage-Legacy.js.
let filenamePrefs = ["SignonFileName3", "SignonFileName2", "SignonFileName"];
for each (let prefname in filenamePrefs) {
let filename = this._prefBranch.getCharPref(prefname);
let file = this._profileDir.clone();
file.append(filename);
if (file.exists()) {
this.log("Deleting old " + filename + " (" + prefname + ")");
try {
file.remove(false);
} catch (e) {
this.log("NOTICE: Couldn't delete " + filename + ": " + e);
}
}
}
},
/*
* _encryptLogin
*
@ -1144,9 +1039,6 @@ LoginManagerStorage_mozStorage.prototype = {
let encPassword = this._crypto.encrypt(login.password);
let encType = this._crypto.defaultEncType;
if (!this._base64checked)
this._reencryptBase64Logins();
return [encUsername, encPassword, encType];
},
@ -1181,82 +1073,10 @@ LoginManagerStorage_mozStorage.prototype = {
result.push(login);
}
if (!this._base64checked)
this._reencryptBase64Logins();
return result;
},
/*
* _reencryptBase64Logins
*
* Checks the signons DB for any logins using the old wallet-style base64
* obscuring of the username/password, instead of proper encryption. We're
* called once per session, after the user has successfully encrypted or
* decrypted some login (this helps ensure the user doesn't get mysterious
* prompts for a master password, when set).
*/
_reencryptBase64Logins : function () {
let base64Type = Ci.nsILoginManagerCrypto.ENCTYPE_BASE64;
this._base64checked = true;
// Ignore failures, will try again next session...
this.log("Reencrypting Base64 logins");
let transaction;
try {
let [logins, ids] = this._searchLogins({ encType: base64Type });
if (!logins.length)
return;
try {
logins = this._decryptLogins(logins);
} catch (e) {
// User might have canceled master password entry, just ignore.
return;
}
transaction = new Transaction(this._dbConnection);
let encUsername, encPassword, stmt;
for each (let login in logins) {
[encUsername, encPassword, encType] = this._encryptLogin(login);
let query =
"UPDATE moz_logins " +
"SET encryptedUsername = :encryptedUsername, " +
"encryptedPassword = :encryptedPassword, " +
"encType = :encType " +
"WHERE guid = :guid";
let params = {
encryptedUsername: encUsername,
encryptedPassword: encPassword,
encType: encType,
guid: login.guid
};
try {
stmt = this._dbCreateStatement(query, params);
stmt.execute();
} catch (e) {
// Ignore singular errors, continue trying to update others.
this.log("_reencryptBase64Logins caught error: " + e);
} finally {
if (stmt) {
stmt.reset();
}
}
}
} catch (e) {
this.log("_reencryptBase64Logins failed: " + e);
} finally {
if (transaction) {
transaction.commit();
}
}
},
//**************************************************************************//
// Database Creation & Access
@ -1287,8 +1107,7 @@ LoginManagerStorage_mozStorage.prototype = {
* _dbInit
*
* Attempts to initialize the database. This creates the file if it doesn't
* exist, performs any migrations, etc. When database is first created, we
* attempt to import legacy signons. Return if this is the first run.
* exist, performs any migrations, etc. Return if this is the first run.
*/
_dbInit : function () {
this.log("Initializing Database");
@ -1481,6 +1300,7 @@ LoginManagerStorage_mozStorage.prototype = {
stmt = this._dbCreateStatement(query);
while (stmt.executeStep()) {
let params = { id: stmt.row.id };
// We will tag base64 logins correctly, but no longer support their use.
if (stmt.row.encryptedUsername.charAt(0) == '~' ||
stmt.row.encryptedPassword.charAt(0) == '~')
params.encType = Ci.nsILoginManagerCrypto.ENCTYPE_BASE64;

View File

@ -1,3 +0,0 @@
#2d
http://www.nsa.gov
.

View File

@ -1,3 +0,0 @@
#2d
http://www.nsa.gov
.

View File

@ -1,9 +0,0 @@
#2d
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECIfQXnNdOlcABBCrqWo0hzkpOPmpGiybiVkU
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECO2TxG6B5o66BBA1PUI/iSkl1G020imhKgEa
.

View File

@ -1,16 +0,0 @@
#2d
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECCcwyTNPm0qJBBD10w5WFcQ7eMIMGSTujH3k
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECOqroi20oiqbBBC2UnpoZC9M/pkem9Csfzeg
.
http://dummyhost2.mozilla.org
put_user2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECKRdcGvGFLweBBBPN2MNaaw6NUUkkj0CebX+
*put_pw2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECPFh9cwe24C1BBA3dcR+4B6G5kmb/oE+9zFT
http://cgi.site.com
.

View File

@ -1,14 +0,0 @@
#2d
.
http://dummyhost2.mozilla.org
put_user2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECI/wcg7naww1BBD/ookfBmtc2MX0g8Xyr51f
*put_pw2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECAoufABHZExXBBDEjlmK9AmpFcp8ODsdgofN
http://cgi.site.com
put_user3_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECK+7oqm6qJyjBBCu0Nxgl+ebE25bMcl4/RnT
*put_pw3_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECA//vIyOIl4oBBALsaRqgn86jFYdZioff78I
http://cgi.site.com
.

View File

@ -1,21 +0,0 @@
#2d
.
http://dummyhost2.mozilla.org
put_user3_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECKfHgxwiNXmTBBDcGLjIy+oENYOm1q221TOt
*put_pw3_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECA+Z8io0HuoEBBAeIuKN+GhWoUBTe2BXMXFi
http://cgi.site.com
put_user2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHyVmW8pKofcBBBpItqB2fSkoRy5QpsDqRLC
*put_pw2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECOeOPkiPdHytBBCiyHzAsUTV5lJsf5DODskj
http://cgi.site.com
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECH8TQwm4TZZvBBA5QKgtqCn/M56QolF8ul4i
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECO9sv4sGVI+aBBDFwhQekg9Gzw1dpx41zp6D
.

View File

@ -1,2 +0,0 @@
thisHeaderIsInvalid

View File

@ -1,3 +0,0 @@
#2c
http://www.disabled.com
.

View File

@ -1,4 +0,0 @@
#2c
http://www.disabled.com
.
.

View File

@ -1,8 +0,0 @@
#2c
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,9 +0,0 @@
#2c
https://www.site.net
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,12 +0,0 @@
#2c
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
put_user2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECN3Gv1qOhoVxBBCgfjGGL+0PJ9iqP/uAHp2c
*put_pw2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECMOQnjGpKF9jBBAoXZIkQ9BSElkS5s6L51qX
.

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
#2c
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,8 +0,0 @@
#2c
.
dummyhost.mozilla.org:80 (Some Realm)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,8 +0,0 @@
#2c
.
dummyhost.mozilla.org:80 ()
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,9 +0,0 @@
#2d
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,9 +0,0 @@
#2d
.
dummyhost.mozilla.org:80 (Some Realm)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,16 +0,0 @@
#2d
.
dummyhost80.mozilla.org:80 (Some Realm)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.
dummyhost443.mozilla.org:443 (Some Realm)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,9 +0,0 @@
#2d
.
dummyhost8080.mozilla.org:8080 (Some Realm)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,16 +0,0 @@
#2d
.
dummyhost80.mozilla.org:80 ()
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.
dummyhost443.mozilla.org:443 ()
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,9 +0,0 @@
#2d
.
dummyhost8080.mozilla.org:8080 ()
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,23 +0,0 @@
#2d
.
http://dummyhost80.mozilla.org:80
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
http://dummyhost80.mozilla.org:80
.
https://dummyhost443.mozilla.org:443
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
https://dummyhost443.mozilla.org:443
.
http://dummyhost8080.mozilla.org:8080
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
http://dummyhost8080.mozilla.org:8080
.

View File

@ -1,23 +0,0 @@
#2d
.
ftp://protocol.mozilla.org
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.
ftp://form.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.
ftp://form2.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
http://cgi.mozilla.org
.

View File

@ -1,16 +0,0 @@
#2d
.
ftp://urluser@protocol.mozilla.org
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.
ftp://urluser@form.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -1,16 +0,0 @@
#2d
.
eBay.companion.paypal.guard
MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECNePtPzgmj5LBAhTfGF4EdqA/A==
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECGqjM6mOKO/5BBCj4F1AP8q3uRv+nZBEo2UT
.
eBay.companion.ebay.guard
MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECPt4wsEg6r7qBAiJSTMiFBk7dw==
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECNWeFfM4ZZ+ZBBD/lkgrrRXLM7kLfg4fPAn1
.

View File

@ -1,8 +0,0 @@
#2c
.
http://dummyhost.mozilla.org
put_user_here
~dGVzdHVzZXIx
*put_pw_here
~dGVzdHBhc3Mx
.

View File

@ -1,14 +0,0 @@
#2c
.
http://dummyhost2.mozilla.org
put_user3_here
~dGVzdHVzZXIz
*put_pw3_here
~dGVzdHBhc3Mz
.
http://dummyhost2.mozilla.org
put_user2_here
~dGVzdHVzZXIy
*put_pw2_here
~dGVzdHBhc3My
.

View File

@ -1,20 +0,0 @@
#2c
.
http://dummyhost.mozilla.org
put_user_here
~dGVzdHVzZXIx
*put_pw_here
~dGVzdHBhc3Mx
.
http://dummyhost2.mozilla.org
put_user2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECNWapDjcvpB4BBDaJV5sQxBXjxB0chRkwJQL
*put_pw2_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECE5N0haJMG8hBBCNoNP0rnQYV6Up4QDLFJvG
.
http://dummyhost2.mozilla.org
put_user3_here
~dGVzdHVzZXIz
*put_pw3_here
~dGVzdHBhc3Mz
.

View File

@ -1,9 +0,0 @@
#2d
.
https://site.org
username
MEIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECCSKaJ7xRN+pBBgIZONGV3hhPmYgNGWx076wG7t4IfY9AOM=
*password
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEBHDZz893BwBBAtfya3S/aHmc7dzxs3v3Dv
https://site.org
.

View File

@ -1,38 +0,0 @@
#2c
.
mailbox://bugzilla@localhost
\=username=\
~
*\=password=\
~dGVzdHBhc3Mx
.
ldap://localhost1:389/dc=test
\=username=\
~
*\=password=\
~dGVzdHBhc3My
.
mailbox://test%2Bpop3@localhost
\=username=\
~
*\=password=\
~cG9wM3Rlc3Q=
.
news://localhost:119/#password
\=username=\
~
*\=password=\
~bmV3c3Rlc3Q=
.
news://localhost:119/#username
\=username=\
~
*\=password=\
~dGVzdG5ld3M=
.
mailbox://bugzilla%4,0mail.com@localhost
\=username=\
~
*\=password=\
~bmV3c3Rlc3Q=
.

View File

@ -1,9 +0,0 @@
#2d
.
http://jstest.site.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
javascript://javascript
.

View File

@ -1,10 +0,0 @@
#2e
.
https://FcK<63>.jp
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
https://FcK<63>.jp
---
.

View File

@ -1,10 +0,0 @@
#2e
.
https://bugzilla.mozilla.org (Accès reservé)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
---
.

View File

@ -1,10 +0,0 @@
#2e
.
https://bugzilla.mozilla.org
Accè
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*pass
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
https://bugzilla.mozilla.org
---
.

View File

@ -1,10 +0,0 @@
#2e
.
https://bugzilla.mozilla.org
u-Accè
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*p-Accè
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
https://bugzilla.mozilla.org
---
.

View File

@ -1,10 +0,0 @@
#2e
.
https://bugzilla.mozilla.org (Accè)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
---
.

View File

@ -1,18 +0,0 @@
#2e
.
https://www.google.com
un
MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECAcH36OqRDPBBAj4u1kKe2oefQ==
*pw
MDIEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECDG4MxIBIm3IBAjLrxoeWcW5eg==
https://www.google.com
---
.
https://bugzilla.mozilla.org (extra user test)
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
---
.

View File

@ -1,33 +0,0 @@
#2e
.
http://dummyhost.mozilla.org
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.
http://dummyhost2.mozilla.org
put_user_here2
*MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here2
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
---
put_user_here3
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here3
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
put_user_here
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*put_pw_here4
*MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.
http://dummyhost4.mozilla.org
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECEnlbhAkNBbBBBCexD5eaffSLGH/ORiFlQ4X
*password
MDoEEPgAAAAAAAAAAAAAAAAAAAEwFAYIKoZIhvcNAwcECHmiTaseYjkkBBAA0ILJTFSa5CnlpD5PTEYR
.

View File

@ -12,20 +12,11 @@ const LoginTest = {
* initStorage
*
*/
initStorage : function (aInputPathName, aInputFileName,
aOutputPathName, aOutputFileName, aExpectedError) {
initStorage : function (aOutputPathName, aOutputFileName, aExpectedError) {
var err = null;
var newStorage = this.newStorage();
var inputFile = null;
if (aInputFileName) {
var inputFile = Cc["@mozilla.org/file/local;1"].
createInstance(Ci.nsILocalFile);
inputFile.initWithPath(aInputPathName);
inputFile.append(aInputFileName);
}
var outputFile = null;
if (aOutputFileName) {
var outputFile = Cc["@mozilla.org/file/local;1"].
@ -40,7 +31,7 @@ const LoginTest = {
}
try {
newStorage.initWithFile(inputFile, outputFile);
newStorage.initWithFile(outputFile);
} catch (e) {
err = e;
}
@ -69,15 +60,7 @@ const LoginTest = {
}
try {
// Different semantics for the modules...
// The legacy module uses initWF(input, output)
// The mozStorage uses initWF(import, DB)
if (STORAGE_TYPE == "legacy")
newStorage.initWithFile(inputFile, null);
else if (STORAGE_TYPE == "mozStorage")
newStorage.initWithFile(null, inputFile);
else
throw "Unknown STORAGE_TYPE";
newStorage.initWithFile(inputFile);
} catch (e) {
err = e;
}
@ -183,16 +166,8 @@ const LoginTest = {
},
newStorage : function () {
var ID;
if (STORAGE_TYPE == "legacy")
ID = "@mozilla.org/login-manager/storage/legacy;1";
else if (STORAGE_TYPE == "mozStorage")
ID = "@mozilla.org/login-manager/storage/mozStorage;1";
else
throw "Unknown STORAGE_TYPE";
var storage = Cc[ID].
var storage = Cc["@mozilla.org/login-manager/storage/mozStorage;1"].
createInstance(Ci.nsILoginManagerStorage);
if (!storage)
throw "Couldn't create storage instance.";
@ -252,7 +227,6 @@ var PROFDIR = do_get_profile();
var DATADIR = do_get_file("data/");
// string versions...
var OUTDIR = PROFDIR.path;
var INDIR = DATADIR.path;
// Copy key3.db into the profile used for the unit tests. Need this so we can
// decrypt the encrypted logins stored in the various tests inputs.

View File

@ -1,13 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
const STORAGE_TYPE = "mozStorage";
function run_test()
{
// Make sure that the storage component exposes its database connection.
let storage = LoginTest.initStorage(INDIR, "signons-empty.txt", OUTDIR,
"signons-empty.sqlite");
let storage = LoginTest.initStorage(OUTDIR, "signons-empty.sqlite");
do_check_true(storage instanceof Ci.nsIInterfaceRequestor);
let db = storage.getInterface(Ci.mozIStorageConnection);
do_check_neq(db, null);

View File

@ -1,448 +0,0 @@
/*
* Test suite for storage-Legacy.js -- exercises reading from on-disk storage.
*
* This test interfaces directly with the legacy password storage module,
* bypassing the normal password manager usage.
*
*/
const STORAGE_TYPE = "legacy";
function run_test() {
try {
var testnum = 0;
var testdesc = "Setup of nsLoginInfo test-users";
var nsLoginInfo = new Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1",
Components.interfaces.nsILoginInfo);
do_check_true(nsLoginInfo != null);
var testuser1 = new nsLoginInfo;
testuser1.init("http://dummyhost.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
var testuser2 = new nsLoginInfo;
testuser2.init("http://dummyhost.mozilla.org", "", null,
"dummydude2", "itsasecret2", "put_user2_here", "put_pw2_here");
/* ========== 1 ========== */
var testnum = 1;
var testdesc = "Initial connection to storage module"
var storage = Cc["@mozilla.org/login-manager/storage/legacy;1"].
createInstance(Ci.nsILoginManagerStorage);
if (!storage)
throw "Couldn't create storage instance.";
/* ========== 2 ========== */
testnum++;
testdesc = "[ensuring file doesn't exist]";
var filename="this-file-does-not-exist-"+Math.floor(Math.random() * 10000);
var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(OUTDIR);
file.append(filename);
var exists = file.exists();
if (exists) {
// Go ahead and remove the file, so that this failure doesn't
// repeat itself w/o intervention.
file.remove(false);
do_check_false(exists); // fail on purpose
}
testdesc = "Initialize with a nonexistent data file";
storage = LoginTest.initStorage(OUTDIR, filename);
LoginTest.checkStorageData(storage, [], []);
if (file.exists())
file.remove(false);
/* ========== 3 ========== */
testnum++;
testdesc = "Initialize with signons-00.txt (a zero-length file)";
storage = LoginTest.initStorage(INDIR, "signons-00.txt",
null, null, /invalid file header/);
LoginTest.checkStorageData(storage, [], []);
/* ========== 4 ========== */
testnum++;
testdesc = "Initialize with signons-01.txt (bad file header)";
storage = LoginTest.initStorage(INDIR, "signons-01.txt",
null, null, /invalid file header/);
LoginTest.checkStorageData(storage, [], []);
/* ========== 5 ========== */
testnum++;
testdesc = "Initialize with signons-02.txt (valid, but empty)";
storage = LoginTest.initStorage(INDIR, "signons-02.txt");
LoginTest.checkStorageData(storage, [], []);
/* ========== 6 ========== */
testnum++;
testdesc = "Initialize with signons-03.txt (1 disabled, 0 logins)";
storage = LoginTest.initStorage(INDIR, "signons-03.txt");
LoginTest.checkStorageData(storage, ["http://www.disabled.com"], []);
/* ========== 7 ========== */
testnum++;
testdesc = "Initialize with signons-04.txt (1 disabled, 0 logins, extra '.')";
// Mozilla code should never have generated the extra ".", but it's possible
// someone writing an external utility might have generated it, since it
// would seem consistant with the format.
storage = LoginTest.initStorage(INDIR, "signons-04.txt");
LoginTest.checkStorageData(storage, ["http://www.disabled.com"], []);
/* ========== 8 ========== */
testnum++;
testdesc = "Initialize with signons-05.txt (0 disabled, 1 login)";
storage = LoginTest.initStorage(INDIR, "signons-05.txt");
LoginTest.checkStorageData(storage, [], [testuser1]);
// counting logins matching host
do_check_eq(1, storage.countLogins("http://dummyhost.mozilla.org", "", null));
// counting logins matching host (login has blank actionURL)
do_check_eq(1, storage.countLogins("http://dummyhost.mozilla.org", "foo", null));
// counting logins (don't match form login for HTTP search)
do_check_eq(0, storage.countLogins("http://dummyhost.mozilla.org", null, ""));
// counting logins (don't match a bogus hostname)
do_check_eq(0, storage.countLogins("blah", "", ""));
// counting all logins (empty hostname)
do_check_eq(1, storage.countLogins("", "", null));
// counting all logins (empty hostname)
do_check_eq(1, storage.countLogins("", "foo", null));
// counting no logins (null hostname)
do_check_eq(0, storage.countLogins(null, "", null));
do_check_eq(0, storage.countLogins(null, null, ""));
do_check_eq(0, storage.countLogins(null, "", ""));
do_check_eq(0, storage.countLogins(null, null, null));
/* ========== 9 ========== */
testnum++;
testdesc = "Initialize with signons-06.txt (1 disabled, 1 login)";
storage = LoginTest.initStorage(INDIR, "signons-06.txt");
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
/* ========== 10 ========== */
testnum++;
testdesc = "Initialize with signons-07.txt (0 disabled, 2 logins on same host)";
storage = LoginTest.initStorage(INDIR, "signons-07.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
// counting logins matching host
do_check_eq(2, storage.countLogins("http://dummyhost.mozilla.org", "", null));
// counting logins matching host (login has blank actionURL)
do_check_eq(2, storage.countLogins("http://dummyhost.mozilla.org", "foo", null));
// counting logins (don't match form login for HTTP search)
do_check_eq(0, storage.countLogins("http://dummyhost.mozilla.org", null, ""));
// counting logins (don't match a bogus hostname)
do_check_eq(0, storage.countLogins("blah", "", ""));
/* ========== 11 ========== */
testnum++;
testdesc = "Initialize with signons-08.txt (500 disabled, 500 logins)";
storage = LoginTest.initStorage(INDIR, "signons-08.txt");
var disabledHosts = [];
for (var i = 1; i <= 500; i++) {
disabledHosts.push("http://host-" + i + ".site.com");
}
var bulkLogin, logins = [];
for (i = 1; i <= 250; i++) {
bulkLogin = new nsLoginInfo;
bulkLogin.init("http://dummyhost.site.org", "http://cgi.site.org", null,
"dummydude", "itsasecret", "usernameField-" + i, "passwordField-" + i);
logins.push(bulkLogin);
}
for (i = 1; i <= 250; i++) {
bulkLogin = new nsLoginInfo;
bulkLogin.init("http://dummyhost-" + i + ".site.org", "http://cgi.site.org", null,
"dummydude", "itsasecret", "usernameField", "passwordField");
logins.push(bulkLogin);
}
LoginTest.checkStorageData(storage, disabledHosts, logins);
// counting all logins for dummyhost
do_check_eq(250, storage.countLogins("http://dummyhost.site.org", "", ""));
do_check_eq(250, storage.countLogins("http://dummyhost.site.org", "", null));
do_check_eq(0, storage.countLogins("http://dummyhost.site.org", null, ""));
// counting all logins for dummyhost-1
do_check_eq(1, storage.countLogins("http://dummyhost-1.site.org", "", ""));
do_check_eq(1, storage.countLogins("http://dummyhost-1.site.org", "", null));
do_check_eq(0, storage.countLogins("http://dummyhost-1.site.org", null, ""));
// counting logins for all hosts
do_check_eq(500, storage.countLogins("", "", ""));
do_check_eq(500, storage.countLogins("", "http://cgi.site.org", ""));
do_check_eq(500, storage.countLogins("", "http://cgi.site.org", null));
do_check_eq(0, storage.countLogins("", "blah", ""));
do_check_eq(0, storage.countLogins("", "", "blah"));
// counting logins for no hosts
do_check_eq(0, storage.countLogins(null, "", ""));
do_check_eq(0, storage.countLogins(null, "http://cgi.site.org", ""));
do_check_eq(0, storage.countLogins(null, "http://cgi.site.org", null));
do_check_eq(0, storage.countLogins(null, null, null));
/* ========== 12 ========== */
testnum++;
testdesc = "Initialize with signons-2c-01.txt";
// This test confirms that when upgrading from an entry that does not have
// a formSubmitURL stored, we correctly set the new formSubmitURL to
// null or "", depending on if it's a form login or protocol login.
// First with a form login (formSubmitURL should be "")
storage = LoginTest.initStorage(INDIR, "signons-2c-01.txt");
LoginTest.checkStorageData(storage, [], [testuser1]);
// Then with a protocol login (formSubmitURL should be null)
testdesc = "Initialize with signons-2c-02.txt";
var testuser3 = new nsLoginInfo;
testuser3.init("http://dummyhost.mozilla.org", null, "Some Realm",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2c-02.txt");
LoginTest.checkStorageData(storage, [], [testuser3]);
/* ========== 13 ========== */
testnum++;
testdesc = "Initialize with signons-2c-03.txt";
// Make sure that when we read a blank HTTP realm, it's reset to
// the hostname and the formSubmitURL is null (not blank).
testuser3.init("http://dummyhost.mozilla.org", null,
"http://dummyhost.mozilla.org",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2c-03.txt");
LoginTest.checkStorageData(storage, [], [testuser3]);
/* ========== 14 ========== */
testnum++;
testdesc = "Initialize with signons-2d-01.txt";
// This test confirms that when reading a 2D entry with a blank
// formSubmitURL line, the parser sets formSubmitURL to null or ""
// depending on if it's a form login or protocol login.
// First with a form login
storage = LoginTest.initStorage(INDIR, "signons-2d-01.txt");
LoginTest.checkStorageData(storage, [], [testuser1]);
// Then with a protocol login
testdesc = "Initialize with signons-2d-02.txt";
testuser3.init("http://dummyhost.mozilla.org", null, "Some Realm",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2d-02.txt");
LoginTest.checkStorageData(storage, [], [testuser3]);
/* ========== 15 ========== */
testnum++;
testdesc = "Initialize with signons-2d-03.txt";
// This test confirms that when upgrading a 2D entry with HTTP[S] protocol
// logins on the default port, that we correctly update the form and drop
// the port number. EG:
// www.site.com:80 --> http://www.site.com
testuser1.init("http://dummyhost80.mozilla.org", null, "Some Realm",
"dummydude", "itsasecret", "", "");
testuser2.init("https://dummyhost443.mozilla.org", null, "Some Realm",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2d-03.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
/* ========== 16 ========== */
testnum++;
testdesc = "Initialize with signons-2d-04.txt";
// This test confirms that when upgrading a 2D entry with a protocol
// logins on a nonstandard port, that we add both http and https
// versions of the login.
// site.com:8080 --> http://site.com:8080, https://site.com:8080
testuser1.init("http://dummyhost8080.mozilla.org:8080", null, "Some Realm",
"dummydude", "itsasecret", "", "");
testuser2.init("https://dummyhost8080.mozilla.org:8080", null, "Some Realm",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2d-04.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
/* ========== 17 ========== */
testnum++;
testdesc = "Initialize with signons-2d-05.txt";
// This test confirms that when upgrading a 2D entry with a blank
// HTTP realm, we set the realm to the hostname.
// foo.com:80 () --> http://foo.com (http://foo.com)
testuser1.init("http://dummyhost80.mozilla.org", null,
"http://dummyhost80.mozilla.org",
"dummydude", "itsasecret", "", "");
testuser2.init("https://dummyhost443.mozilla.org", null,
"https://dummyhost443.mozilla.org",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2d-05.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
// And again, with a single entry that was cloned
testdesc = "Initialize with signons-2d-06.txt";
testuser1.init("http://dummyhost8080.mozilla.org:8080", null,
"http://dummyhost8080.mozilla.org:8080",
"dummydude", "itsasecret", "", "");
testuser2.init("https://dummyhost8080.mozilla.org:8080", null,
"https://dummyhost8080.mozilla.org:8080",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2d-06.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
/* ========== 18 ========== */
testnum++;
testdesc = "Initialize with signons-2d-07.txt";
// Form logins could have been saved with the port number explicitly
// specified in the hostname or formSubmitURL. Make sure it gets
// stripped when it's the default value.
testuser1.init("http://dummyhost80.mozilla.org",
"http://dummyhost80.mozilla.org", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
testuser2.init("https://dummyhost443.mozilla.org",
"https://dummyhost443.mozilla.org", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
// non-standard port, so it shouldn't get stripped.
testuser3.init("http://dummyhost8080.mozilla.org:8080",
"http://dummyhost8080.mozilla.org:8080", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
storage = LoginTest.initStorage(INDIR, "signons-2d-07.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2, testuser3]);
/* ========== 19 ========== */
testnum++;
testdesc = "Initialize with signons-2d-08.txt";
// Bug 396316: Non-HTTP[S] hostnames were stored the same way for both forms
// and protocol logins. If the login looks like it's not a form login (no
// form field names, no action URL), then assign it a default realm.
testuser1.init("ftp://protocol.mozilla.org", null,
"ftp://protocol.mozilla.org",
"dummydude", "itsasecret", "", "");
testuser2.init("ftp://form.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
testuser3.init("ftp://form2.mozilla.org", "http://cgi.mozilla.org", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
storage = LoginTest.initStorage(INDIR, "signons-2d-08.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2, testuser3]);
/* ========== 20 ========== */
testnum++;
testdesc = "Initialize with signons-2d-09.txt";
// Logins stored when signing into, say, an FTP server via a URL with a
// username (ftp://user@ftp.site.com) were stored with a blank encrypted
// username, and the actual username in the hostname. Test to make sure we
// move it back to the encrypted username field. If the username was saved as
// part of a form, just drop it. (eg, ftp://ftpuser@site.com/form.html)
testuser1.init("ftp://protocol.mozilla.org", null, "ftp://protocol.mozilla.org",
"urluser", "itsasecret", "", "");
testuser2.init("ftp://form.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
storage = LoginTest.initStorage(INDIR, "signons-2d-09.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
/* ========== 21 ========== */
testnum++;
testdesc = "Initialize with signons-2d-10.txt";
// Extensions like the eBay Companion just use an arbitrary string for the
// hostname. We don't want to change the format of these logins.
testuser1.init("eBay.companion.paypal.guard", "", null,
"p", "paypalpass", "", "");
testuser2.init("eBay.companion.ebay.guard", "", null,
"p", "ebaypass", "", "");
storage = LoginTest.initStorage(INDIR, "signons-2d-10.txt");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
/* ========== 22 ========== */
testnum++;
testdesc = "Initialize with signons-06.txt (1 disabled, 1 login); test removeLogin";
testuser1.init("http://dummyhost.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
testuser2.init("http://dummyhost.mozilla.org", "", null,
"dummydude2", "itsasecret2", "put_user2_here", "put_pw2_here");
storage = LoginTest.initStorage(INDIR, "signons-06.txt", OUTDIR, "signons-06-2.txt");
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
testdesc = "test removeLogin";
storage.removeLogin(testuser1);
LoginTest.checkStorageData(storage, ["https://www.site.net"], []);
/* ========== 23 ========== */
testnum++;
testdesc = "Initialize with signons-06.txt (1 disabled, 1 login); test modifyLogin";
storage = LoginTest.initStorage(INDIR, "signons-06.txt", OUTDIR, "signons-06-3.txt");
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
testdesc = "test modifyLogin";
storage.modifyLogin(testuser1, testuser2);
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser2]);
/*
* ---------------------- Bug 427033 ----------------------
* Check migration of logins stored with a JS formSubmitURL
*/
/* ========== 24 ========== */
testnum++;
testdesc = "checking import of JS formSubmitURL entries"
testuser1.init("http://jstest.site.org", "javascript:", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
storage = LoginTest.initStorage(INDIR, "signons-427033-1.txt",
OUTDIR, "output-427033-1.txt");
LoginTest.checkStorageData(storage, [], [testuser1]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-427033-1.txt");
LoginTest.checkStorageData(storage, [], [testuser1]);
} catch (e) {
throw "FAILED in test #" + testnum + " -- " + testdesc + ": " + e;
}
};

View File

@ -1,246 +0,0 @@
/*
* Test suite for storage-Legacy.js -- exercises writing to on-disk storage.
*
* This test interfaces directly with the legacy login storage module,
* bypassing the normal login manager usage.
*
*/
const STORAGE_TYPE = "legacy";
function run_test() {
try {
/* ========== 0 ========== */
var testnum = 0;
var testdesc = "Initial connection to storage module"
var storage = Cc["@mozilla.org/login-manager/storage/legacy;1"].
createInstance(Ci.nsILoginManagerStorage);
if (!storage)
throw "Couldn't create storage instance.";
/* ========== 1 ========== */
testnum++;
var testdesc = "Create nsILoginInfo instances for testing with"
var dummyuser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
dummyuser1.init( "http://dummyhost.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
dummyuser2.init("http://dummyhost2.mozilla.org", "http://cgi.site.com", null,
"dummydude2", "itsasecret2", "put_user2_here", "put_pw2_here");
dummyuser3.init("http://dummyhost2.mozilla.org", "http://cgi.site.com", null,
"dummydude3", "itsasecret3", "put_user3_here", "put_pw3_here");
/* ========== 2 ========== */
testnum++;
testdesc = "[ensuring file doesn't exist]";
var filename="nonexistent-file-"+Math.floor(Math.random() * 10000);
var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(OUTDIR);
file.append(filename);
var exists = file.exists();
if (exists) {
// Go ahead and remove the file, so that this failure
// doesn't repeat itself w/o intervention.
file.remove(false);
do_check_false(exists); // fail on purpose
}
testdesc = "Initialize with no existing file";
storage = LoginTest.initStorage(OUTDIR, filename);
LoginTest.checkStorageData(storage, [], []);
testdesc = "Add 1 disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], []);
file.remove(false);
/* ========== 3 ========== */
testnum++;
testdesc = "Initialize with existing file (valid, but empty)";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-01.txt");
LoginTest.checkStorageData(storage, [], []);
testdesc = "Add 1 disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], []);
testdesc = "Remove disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", true);
LoginTest.checkStorageData(storage, [], []);
/* ========== 4 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-02.txt");
// Previous tests made sure we can write to an existing file, so now just
// tweak component to output elsewhere.
testdesc = "Add 1 login only";
storage.addLogin(dummyuser1);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-02.txt");
testdesc = "Verify output-02.txt";
LoginTest.checkStorageData(storage, [], [dummyuser1]);
/* ========== 5 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-03.txt");
testdesc = "Add 1 disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-03.txt");
testdesc = "Verify output-03.txt";
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], []);
/* ========== 6 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-04.txt");
testdesc = "Add 1 disabled host and 1 login";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
storage.addLogin(dummyuser1);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-04.txt");
testdesc = "Verify output-04.txt";
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], [dummyuser1]);
/* ========== 7 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-03.txt");
testdesc = "Add 2 logins (to different hosts)";
storage.addLogin(dummyuser1);
storage.addLogin(dummyuser2);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-03.txt");
testdesc = "Verify output-03.txt";
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser1]);
/* ========== 8 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-04.txt");
testdesc = "Add 2 logins (to same host)";
storage.addLogin(dummyuser2);
storage.addLogin(dummyuser3);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-04.txt");
testdesc = "Verify output-04.txt";
LoginTest.checkStorageData(storage, [], [dummyuser3, dummyuser2]);
/* ========== 9 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-05.txt");
testdesc = "Add 3 logins (2 to same host)";
storage.addLogin(dummyuser3);
storage.addLogin(dummyuser1);
storage.addLogin(dummyuser2);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-05.txt");
testdesc = "Verify output-05.txt";
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
// count dummyhost2 logins
do_check_eq(2, storage.countLogins("http://dummyhost2.mozilla.org", "", ""));
// count dummyhost logins
do_check_eq(1, storage.countLogins("http://dummyhost.mozilla.org", "", ""));
// count dummyhost2 logins w/ specific formSubmitURL
do_check_eq(2, storage.countLogins("http://dummyhost2.mozilla.org", "http://cgi.site.com", ""));
/* ========== 10 ========== */
testnum++;
testdesc = "[init with 1 login, 1 disabled host]";
storage = LoginTest.initStorage(INDIR, "signons-06.txt",
OUTDIR, "output-06.txt");
var oldfile1 = PROFDIR.clone();
oldfile1.append("signons.txt");
// Shouldn't exist, but if a previous run failed it could be left over
if (oldfile1.exists())
oldfile1.remove(false);
oldfile1.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
do_check_true(oldfile1.exists());
var oldfile2 = PROFDIR.clone();
oldfile2.append("signons2.txt");
// Shouldn't exist, but if a previous run failed it could be left over
if (oldfile2.exists())
oldfile2.remove(false);
oldfile2.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
do_check_true(oldfile2.exists());
testdesc = "Ensure old files are deleted when removeAllLogins is called";
storage.removeAllLogins();
LoginTest.checkStorageData(storage, ["https://www.site.net"], []);
do_check_false(oldfile1.exists());
do_check_false(oldfile2.exists());
} catch (e) {
throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
}
};

View File

@ -1,772 +0,0 @@
/*
* Test suite for storage-Legacy.js -- various bug fixes.
*
* This test interfaces directly with the legacy login storage module,
* bypassing the normal login manager usage.
*
*/
const STORAGE_TYPE = "legacy";
function run_test() {
try {
/* ========== 0 ========== */
var testnum = 0;
var testdesc = "Initial connection to storage module"
var storage = Cc["@mozilla.org/login-manager/storage/legacy;1"].
createInstance(Ci.nsILoginManagerStorage);
if (!storage)
throw "Couldn't create storage instance.";
/* ========== 1 ========== */
testnum++;
var testdesc = "Create nsILoginInfo instances for testing with"
var dummyuser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
dummyuser1.init("http://dummyhost.mozilla.org", "", null,
"testuser1", "testpass1", "put_user_here", "put_pw_here");
dummyuser2.init("http://dummyhost2.mozilla.org", "", null,
"testuser2", "testpass2", "put_user2_here", "put_pw2_here");
dummyuser3.init("http://dummyhost2.mozilla.org", "", null,
"testuser3", "testpass3", "put_user3_here", "put_pw3_here");
/*
* ---------------------- Bug 380961 ----------------------
* Need to support decoding the mime64-obscured format still
* used by SeaMonkey.
*/
/* ========== 2 ========== */
testnum++;
testdesc = "checking import of mime64-obscured entries"
storage = LoginTest.initStorage(INDIR, "signons-380961-1.txt",
OUTDIR, "output-380961-1.txt");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-380961-1.txt");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
/* ========== 3 ========== */
testnum++;
testdesc = "testing import of multiple mime-64 entries for a host"
storage = LoginTest.initStorage(INDIR, "signons-380961-2.txt",
OUTDIR, "output-380961-2.txt");
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser3]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-380961-2.txt");
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser3]);
/* ========== 4 ========== */
testnum++;
testdesc = "testing import of mixed encrypted and mime-64 entries."
storage = LoginTest.initStorage(INDIR, "signons-380961-3.txt",
OUTDIR, "output-380961-3.txt");
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-380961-3.txt");
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
/*
* ---------------------- Bug 381262 ----------------------
* The SecretDecoderRing can't handle UCS2, failure to
* convert to UTF8 garbles the result.
*
* Note: dump()ing to the console on OS X (at least) outputs
* garbage, whereas the "bad" UCS2 looks ok!
*/
/* ========== 5 ========== */
testnum++;
testdesc = "initializing login with non-ASCII data."
var dummyuser4 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
dummyuser4.hostname = "https://site.org";
dummyuser4.username = String.fromCharCode(
355, 277, 349, 357, 533, 537, 101, 345, 185);
// "testuser1" using similar-looking glyphs
dummyuser4.usernameField = "username";
dummyuser4.password = "testpa" + String.fromCharCode(223) + "1";
// "ss" replaced with German eszett.
dummyuser4.passwordField = "password";
dummyuser4.formSubmitURL = "https://site.org";
dummyuser4.httpRealm = null;
/* ========== 6 ========== */
testnum++;
testdesc = "testing import of non-ascii username and password."
storage = LoginTest.initStorage(INDIR, "signons-381262.txt",
OUTDIR, "output-381262-1.txt");
LoginTest.checkStorageData(storage, [], [dummyuser4]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-381262-1.txt");
LoginTest.checkStorageData(storage, [], [dummyuser4]);
/* ========== 7 ========== */
testnum++;
testdesc = "testing storage of non-ascii username and password."
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-381262-2.txt");
LoginTest.checkStorageData(storage, [], []);
storage.addLogin(dummyuser4);
LoginTest.checkStorageData(storage, [], [dummyuser4]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-381262-2.txt");
LoginTest.checkStorageData(storage, [], [dummyuser4]);
/*
* ---------------------- Bug 400751 ----------------------
* Migrating from existing mime64 encoded format causes
* errors in storage legacy's code
*/
/* ========== 8 ========== */
testnum++;
testdesc = "checking double reading of mime64-obscured entries";
storage = LoginTest.initStorage(INDIR, "signons-380961-1.txt");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
testdesc = "checking double reading of mime64-obscured entries part 2";
LoginTest.checkStorageData(storage, [], [dummyuser1]);
/* ========== 9 ========== */
testnum++;
testdesc = "checking correct storage of mime64 converted entries";
storage = LoginTest.initStorage(INDIR, "signons-380961-1.txt",
OUTDIR, "output-400751-1.txt");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
LoginTest.checkStorageData(storage, [], [dummyuser1]);
storage.addLogin(dummyuser2); // trigger a write
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2]);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-400751-1.txt");
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2]);
/*
* ---------------------- Bug 394610 ----------------------
* Ensure input which might mess with the format or structure of
* the store file is appropriately filtered.
*/
/* ========== 10 ========== */
testnum++;
function tryAddUser(storage, aUser, aExpectedError) {
var err = null;
try {
storage.addLogin(aUser);
} catch (e) {
err = e;
}
LoginTest.checkExpectedError(aExpectedError, err);
}
testdesc = "preparting to try logins with bogus values";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-1.txt");
LoginTest.checkStorageData(storage, [], []);
var failUser = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
// init with legal values, we'll change on-the-fly
failUser.init("http://failure.site.org",
"http://failure.site.org", null,
"username", "password", "uname", "pword");
testdesc = "storing data values with embedded newlines."
// newline in "never for this site" address.
var failHost = "http://new\nline.never.net";
var error = null;
try {
storage.setLoginSavingEnabled(failHost, false);
} catch (e) {
error = e;
}
LoginTest.checkExpectedError(/Invalid hostname/, error);
// CR in "never for this site" address.
failHost = "http://new\rline.never.net";
error = null;
try {
storage.setLoginSavingEnabled(failHost, false);
} catch (e) {
error = e;
}
LoginTest.checkExpectedError(/Invalid hostname/, error);
// check hostname
failUser.hostname = "http://fail\nure.site.org";
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.hostname = "http://fail\rure.site.org";
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.hostname = "http://failure.site.org";
// check httpRealm and formSubmitURL
failUser.httpRealm = "http://fail\nure.site.org";
failUser.formSubmitURL = null;
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.httpRealm = "http://fail\rure.site.org";
failUser.formSubmitURL = null;
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.formSubmitURL = "http://fail\nure.site.org";
failUser.httpRealm = null;
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.formSubmitURL = "http://fail\rure.site.org";
failUser.httpRealm = null;
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.formSubmitURL = "http://failure.site.org";
// check usernameField
failUser.usernameField = "u\nname";
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.usernameField = "u\rname";
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.usernameField = "uname";
// check passwordField
failUser.passwordField = "p\nword";
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.passwordField = "p\rword";
tryAddUser(storage, failUser, /login values can't contain newlines/);
failUser.passwordField = "pword";
// check username and password, which are OK with embedded newlines.
failUser.username = "user\r\nname";
failUser.password = "pass\r\nword";
tryAddUser(storage, failUser, null);
var numLines = LoginTest.countLinesInFile(OUTDIR, "output-394610-1.txt");
do_check_eq(numLines, 10);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-394610-1.txt");
LoginTest.checkStorageData(storage, [], [failUser]);
failUser.username = "username";
failUser.password = "password";
/* ========== 11 ========== */
testnum++;
testdesc = "storing data values with special period-only value"
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-2.txt");
LoginTest.checkStorageData(storage, [], []);
failHost = ".";
error = null;
try {
storage.setLoginSavingEnabled(failHost, false);
} catch (e) {
error = e;
}
LoginTest.checkExpectedError(/Invalid hostname/, error);
// check usernameField
failUser.usernameField = ".";
tryAddUser(storage, failUser, /login values can't be periods/);
failUser.usernameField = "uname";
// check formSubmitURL
failUser.usernameField = ".";
tryAddUser(storage, failUser, /login values can't be periods/);
failUser.formSubmitURL = "http://failure.site.org";
testdesc = "check added data"
LoginTest.checkStorageData(storage, [], []);
var numLines = LoginTest.countLinesInFile(OUTDIR, "output-394610-2.txt");
do_check_eq(numLines, 2);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-394610-2.txt");
LoginTest.checkStorageData(storage, [], []);
/* ========== 12 ========== */
testnum++;
testdesc = "create logins with parens in host/httpRealm"
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-3.txt");
LoginTest.checkStorageData(storage, [], []);
var parenUser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser4 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser5 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser6 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser7 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser8 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var parenUser9 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
// realm as "(realm", "realm)", "(realm)", ")realm("
parenUser1.init("http://parens.site.org", null, "(realm",
"user1", "pass1", "uname", "pword");
parenUser2.init("http://parens.site.org", null, "realm)",
"user2", "pass2", "uname", "pword");
parenUser3.init("http://parens.site.org", null, "(realm)",
"user3", "pass3", "uname", "pword");
parenUser4.init("http://parens.site.org", null, ")realm(",
"user4", "pass4", "uname", "pword");
// hostname as "xx(xx", "xx)xx", "xx()xx", "xx)(xx"
parenUser5.init("http://parens(yay.site.org", null, "realm",
"user5", "pass5", "uname", "pword");
parenUser6.init("http://parens)yay.site.org", null, "realm",
"user6", "pass6", "uname", "pword");
parenUser7.init("http://parens(yay).site.org", null, "realm",
"user7", "pass7", "uname", "pword");
parenUser8.init("http://parens)yay(.site.org", null, "realm",
"user8", "pass8", "uname", "pword");
// "xx (xx" as a special case
parenUser9.init("http://parens (.site.org", null, "realm",
"user9", "pass9", "uname", "pword");
testdesc = "add logins with parens in host/httpRealm"
tryAddUser(storage, parenUser1, null);
tryAddUser(storage, parenUser2, null);
tryAddUser(storage, parenUser3, null);
tryAddUser(storage, parenUser4, null);
tryAddUser(storage, parenUser5, null);
tryAddUser(storage, parenUser6, null);
tryAddUser(storage, parenUser7, null);
tryAddUser(storage, parenUser8, null);
// we expect this one to fail.
tryAddUser(storage, parenUser9, /bad parens in hostname/);
var parenLogins = [
parenUser1, parenUser2, parenUser3, parenUser4,
parenUser5, parenUser6, parenUser7, parenUser8
];
testdesc = "check added data"
LoginTest.checkStorageData(storage, [], parenLogins);
var numLines = LoginTest.countLinesInFile(OUTDIR, "output-394610-3.txt");
do_check_eq(numLines, 66);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-394610-3.txt");
LoginTest.checkStorageData(storage, [], parenLogins);
/* ========== 13 ========== */
testnum++;
testdesc = "storing data values with embedded nulls."
// sanity check
do_check_eq( "foo\0bar", "foo\0bar");
do_check_neq("foo\0bar", "foobar");
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-4.txt");
LoginTest.checkStorageData(storage, [], []);
var nullUser = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
nullUser.init("http://null.site.org",
"http://null.site.org", null,
"username", "password", "usernull", "passnull");
// null in "never for this site" address.
var nullHost = "http://never\0X.sit.org";
error = null;
try {
storage.setLoginSavingEnabled(nullHost, false);
} catch (e) {
error = e;
}
LoginTest.checkExpectedError(/Invalid hostname/, error);
// check hostname
nullUser.hostname = "http://null\0X.site.org";
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.hostname = "http://null.site.org";
// check httpRealm and formSubmitURL
nullUser.httpRealm = "http://null\0X.site.org";
nullUser.formSubmitURL = null;
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.formSubmitURL = "http://null\0X.site.org";
nullUser.httpRealm = null;
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.formSubmitURL = "http://null.site.org";
// check usernameField
nullUser.usernameField = "usernull\0X";
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.usernameField = "usernull";
// check usernameField with a special case value
nullUser.usernameField = ".\0";
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.usernameField = "usernull";
// check passwordField
nullUser.passwordField = "passnull\0X";
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.passwordField = "passnull";
// check username with null
nullUser.username = "user\0name";
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.username = "username";
// check password with null
nullUser.password = "pass\0word";
tryAddUser(storage, nullUser, /login values can't contain nulls/);
nullUser.password = "password";
// Final sanity check, to make sure we didn't store anything unexpected.
LoginTest.checkStorageData(storage, [], []);
var numLines = LoginTest.countLinesInFile(OUTDIR, "output-394610-4.txt");
do_check_eq(numLines, 2);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-394610-4.txt");
LoginTest.checkStorageData(storage, [], []);
/*
* ---------------------- Bug 449701 ----------------------
* Ensure changes to login objects given to / obtained from
* the storage module don't affect the internal storage.
*/
/* ========== 14 ========== */
testnum++;
testdesc = "ensure internal login objects not shared with callers."
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-449701.txt");
LoginTest.checkStorageData(storage, [], []);
// dummyuser1 == dummyuser2
dummyuser1.init("http://dummyhost.mozilla.org", "", null,
"testuser1", "testpass1", "put_user_here", "put_pw_here");
dummyuser2.init("http://dummyhost.mozilla.org", "", null,
"testuser1", "testpass1", "put_user_here", "put_pw_here");
// Add a login, modify it, make sure orginal values are still stored.
storage.addLogin(dummyuser1);
LoginTest.checkStorageData(storage, [], [dummyuser2]);
dummyuser1.usernameField = "ohnoes";
LoginTest.checkStorageData(storage, [], [dummyuser2]);
// Get a stored login, modify it, make sure the stored login wasn't changed.
var logins = storage.getAllLogins();
do_check_eq(logins.length, 1);
var obtainedLogin1 = logins[0];
obtainedLogin1.usernameField = "ohnoes";
logins = storage.getAllLogins();
var obtainedLogin2 = logins[0];
do_check_neq(obtainedLogin1.usernameField, obtainedLogin2.usernameField);
/*
* ---------------------- Bug 451155 ----------------------
* Ensure that we don't mangle strings when then contain
* UCS2 characters above U+00FF.
*/
/* ========== 15 ========== */
testnum++;
testdesc = "ensure UCS2 strings don't get mangled."
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-451155.txt");
LoginTest.checkStorageData(storage, [], []);
var testString = String.fromCharCode(355, 277, 349, 357, 533, 537, 101, 345, 185);
var utfHost = "http://" + testString + ".org";
var utfUser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var utfUser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
utfUser1.init("http://" + testString + ".org",
"http://" + testString + ".org", null,
testString, testString, testString, testString);
utfUser2.init("http://realm.check.net", null, "realm " + testString + " test",
"user", "pass", "", "");
storage.addLogin(utfUser1);
storage.addLogin(utfUser2);
storage.setLoginSavingEnabled(utfHost, false);
LoginTest.checkStorageData(storage, [utfHost], [utfUser1, utfUser2]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-451155.txt");
LoginTest.checkStorageData(storage, [utfHost], [utfUser1, utfUser2]);
/*
* ---------------------- Bug 454708 ----------------------
* Check that previous saved entries that are not valid UTF8
* are read without blowing up.
*/
/* ========== 16 ========== */
testnum++;
testdesc = "ensure bogus UTF8 strings don't cause failures."
var badHost = "https://FcK" + String.fromCharCode(0x8a) + ".jp";
var bad8User = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
bad8User.init(badHost, badHost, null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
storage = LoginTest.initStorage(INDIR, "signons-454708.txt",
OUTDIR, "output-454708.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
// The output file should contain valid UTF8 now, but the resulting
// JS string value remains the same.
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-454708.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
/*
* ---------------------- Bug 457358 ----------------------
* need to reset UTF8 converter after it encounters invalid input
* (pwmgr problems in FF3.0.3)
*/
/* ========== 17 ========== */
testnum++;
testdesc = "ensure UTF8 converter isn't left in bad state."
var utfRealm = "Acc" +
String.fromCharCode(0xe8) +
"s reserv" +
String.fromCharCode(0xe9);
bad8User.init("https://bugzilla.mozilla.org", null, utfRealm,
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-457358-1.txt",
OUTDIR, "output-457358-1.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
// The output file should contain valid UTF8 now, but the resulting
// JS string value remains the same.
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-457358-1.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
/* ========== 18 ========== */
testnum++;
testdesc = "ensure UTF8 converter isn't left in bad state."
// The username field here is "Acc" + String.fromCharCode(0xe8), but the last
// character is invalid UTF8 -- it's the beginning of a multibyte sequence,
// but at the end of the input. The unicode converter silently truncates the
// string, and will throw when we feed it the next chunk of input (the
// encrypted username)
//
// Test for an expected login -- everthing fine except for the truncated field
// name (which we don't use anyway)
bad8User.init("https://bugzilla.mozilla.org", "https://bugzilla.mozilla.org", null,
"dummydude", "itsasecret", "Acc", "pass");
storage = LoginTest.initStorage(INDIR, "signons-457358-2.txt",
OUTDIR, "output-457358-2.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
// The output file should contain valid UTF8 now, but the resulting
// JS string value remains the same.
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-457358-2.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
/* ========== 19 ========== */
testnum++;
testdesc = "ensure UTF8 converter isn't left in bad state."
// As with previous test, but triggered with both field names.
bad8User.init("https://bugzilla.mozilla.org", "https://bugzilla.mozilla.org", null,
"dummydude", "itsasecret", "u-Acc", "p-Acc");
storage = LoginTest.initStorage(INDIR, "signons-457358-3.txt",
OUTDIR, "output-457358-3.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
// The output file should contain valid UTF8 now, but the resulting
// JS string value remains the same.
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-457358-3.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
/* ========== 20 ========== */
testnum++;
testdesc = "ensure UTF8 converter isn't left in bad state."
// Last character in the realm, this time. Not trunated, because the
// "http://site.com (realm)" format means there's always a trailing character,
// so the conversino throws.
bad8User.init("https://bugzilla.mozilla.org", null, "Acc" + String.fromCharCode(0xe8),
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-457358-4.txt",
OUTDIR, "output-457358-4.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
// The output file should contain valid UTF8 now, but the resulting
// JS string value remains the same.
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-457358-4.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
/* ========== 21 ========== */
testnum++;
testdesc = "ensure UTF8 converter isn't left in bad state."
// Like last test, but try adding and removing a login too.
bad8User.init("https://bugzilla.mozilla.org", null, "Acc" + String.fromCharCode(0xe8),
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-457358-4.txt",
OUTDIR, "output-457358-4b.txt");
var anotherUser = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
anotherUser.init("http://mozilla.org", null,
String.fromCharCode(0xe8) + "xtra user " + String.fromCharCode(0x0163) + "est",
"dummydude", "itsasecret", "", "");
storage.addLogin(anotherUser);
LoginTest.checkStorageData(storage, [], [bad8User, anotherUser]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-457358-4b.txt");
LoginTest.checkStorageData(storage, [], [bad8User, anotherUser]);
storage.removeLogin(anotherUser);
LoginTest.checkStorageData(storage, [], [bad8User]);
testdesc = "[flush and reload for verification 2]"
storage = LoginTest.reloadStorage(OUTDIR, "output-457358-4b.txt");
LoginTest.checkStorageData(storage, [], [bad8User]);
/* ========== 22 ========== */
testnum++;
testdesc = "ensure UTF8 converter isn't left in bad state."
// The first login's username (plaintext) is invalid UTF8. It's handled as a
// bad decryption so we don't see the login, but make sure the other login in
// the file is ok.
// This is the first login:
//bad8User.init("https://www.google.com", "https://www.google.com", null,
// "Acc" + String.fromCharCode(0xe8) + "ss", "passw", "un", "pw");
anotherUser.init("https://bugzilla.mozilla.org", null, "extra user test",
"dummydude", "itsasecret", "", "");
storage = LoginTest.initStorage(INDIR, "signons-457358-5.txt",
OUTDIR, "output-457358-5.txt");
LoginTest.checkStorageData(storage, [], [anotherUser]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-457358-5.txt");
LoginTest.checkStorageData(storage, [], [anotherUser]);
/* ========== end ========== */
} catch (e) {
throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
}
};

View File

@ -1,166 +0,0 @@
/*
* Test suite for storage-Legacy.js -- mailnews specific tests.
*
* This test interfaces directly with the legacy login storage module,
* bypassing the normal login manager usage.
*
*/
const Cm = Components.manager;
const BASE_CONTRACTID = "@mozilla.org/network/protocol;1?name=";
const LDAPPH_CID = Components.ID("{08eebb58-8d1a-4ab5-9fca-e35372697828}");
const MAILBOXPH_CID = Components.ID("{edb1dea3-b226-405a-b93d-2a678a68a198}");
const NEWSBOXPH_CID = Components.ID("{939fe896-8961-49d0-b0e0-4ae779bdef36}");
const STORAGE_TYPE = "legacy";
function genericProtocolHandler(scheme, defaultPort) {
this.scheme = scheme;
this.defaultPort = defaultPort;
}
genericProtocolHandler.prototype = {
scheme: "",
defaultPort: 0,
QueryInterface: function gph_QueryInterface(aIID) {
if (!aIID.equals(Ci.nsISupports) &&
!aIID.equals(Ci.nsIProtocolHandler)) {
throw Cr.NS_ERROR_NO_INTERFACE;
}
return this;
},
get protocolFlags() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
newURI: function gph_newURI(aSpec, anOriginalCharset, aBaseURI) {
var uri = Components.classes["@mozilla.org/network/standard-url;1"].
createInstance(Ci.nsIStandardURL);
uri.init(Ci.nsIStandardURL.URLTYPE_STANDARD, this.defaultPort, aSpec,
anOriginalCharset, aBaseURI);
return uri;
},
newChannel: function gph_newChannel(aUri) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
allowPort: function gph_allowPort(aPort, aScheme) {
return false;
}
}
function generateFactory(protocol, defaultPort)
{
return {
createInstance: function (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return (new genericProtocolHandler(protocol, defaultPort)).
QueryInterface(iid);
}
};
}
function run_test() {
// News is set up as an external protocol in Firefox's prefs, for this test
// to work, we need it to be internal.
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("network.protocol-handler.external.news", false);
Cm.nsIComponentRegistrar.registerFactory(LDAPPH_CID, "LDAPProtocolFactory",
BASE_CONTRACTID + "ldap",
generateFactory("ldap", 389));
Cm.nsIComponentRegistrar.registerFactory(MAILBOXPH_CID,
"MailboxProtocolFactory",
BASE_CONTRACTID + "mailbox",
generateFactory("mailbox", 0));
Cm.nsIComponentRegistrar.registerFactory(NEWSBOXPH_CID,
"NewsProtocolFactory",
BASE_CONTRACTID + "news",
generateFactory("news", 119));
try {
/* ========== 0 ========== */
var testnum = 0;
var testdesc = "Initial connection to storage module";
var storage = Cc["@mozilla.org/login-manager/storage/legacy;1"].
createInstance(Ci.nsILoginManagerStorage);
if (!storage)
throw "Couldn't create storage instance.";
// Create a couple of dummy users to match what we expect to be translated
// from the input file.
var dummyuser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser4 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser5 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser6 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
dummyuser1.init("mailbox://localhost", null, "mailbox://localhost",
"bugzilla", "testpass1", "", "");
dummyuser2.init("ldap://localhost1", null,
"ldap://localhost1/dc=test",
"", "testpass2", "", "");
dummyuser3.init("mailbox://localhost", null, "mailbox://localhost",
"test+pop3", "pop3test", "", "");
dummyuser4.init("http://dummyhost.mozilla.org", "", null,
"testuser1", "testpass1", "put_user_here", "put_pw_here");
dummyuser5.init("news://localhost", null, "news://localhost/#password",
"", "newstest", "", "");
dummyuser6.init("news://localhost", null, "news://localhost/#username",
"", "testnews", "", "");
/*
* ---------------------- Bug 403790 ----------------------
* Migrating mailnews style username/passwords
*/
/* ========== 1 ========== */
testnum++;
testdesc = "checking reading of mailnews-like old logins";
storage = LoginTest.initStorage(INDIR, "signons-403790.txt",
OUTDIR, "output-403790.txt");
// signons-403790.txt has one extra login that is invalid, and hence isn't
// shown here.
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3,
dummyuser5, dummyuser6]);
storage.addLogin(dummyuser4); // trigger a write
LoginTest.checkStorageData(storage, [],
[dummyuser1, dummyuser2, dummyuser3, dummyuser4,
dummyuser5, dummyuser6]);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-403790.txt");
LoginTest.checkStorageData(storage, [],
[dummyuser1, dummyuser2, dummyuser3, dummyuser4,
dummyuser5, dummyuser6]);
/* ========== end ========== */
} catch (e) {
throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
}
};

View File

@ -1,155 +0,0 @@
/*
* Test suite for storage-Legacy.js -- IE Migration Helper.
*
* This test exercises the migrateAndAddLogin helper interface.
* Although in the real-world it would only be invoked on Windows
* platforms, there's no point in limiting what platforms run
* this test.
*
*/
const STORAGE_TYPE = "legacy";
function cloneLogin(src, dst) {
dst.hostname = src.hostname;
dst.formSubmitURL = src.formSubmitURL;
dst.httpRealm = src.httpRealm;
dst.username = src.username;
dst.password = src.password;
dst.usernameField = src.usernameField;
dst.passwordField = src.passwordField;
}
function run_test() {
try {
/* ========== 0 ========== */
var testnum = 0;
var testdesc = "Initial connection to storage module"
var storage = Cc["@mozilla.org/login-manager/storage/legacy;1"].
getService(Ci.nsILoginManagerIEMigrationHelper);
if (!storage)
throw "Couldn't create storage instance.";
var pwmgr = Cc["@mozilla.org/login-manager;1"].
getService(Ci.nsILoginManager);
if (!pwmgr)
throw "Couldn't create pwmgr instance.";
// Start with a clean slate
pwmgr.removeAllLogins();
var hosts = pwmgr.getAllDisabledHosts();
hosts.forEach(function(h) pwmgr.setLoginSavingEnabled(h, true));
/* ========== 1 ========== */
testnum++;
var testdesc = "Create nsILoginInfo instances for testing with"
var testlogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var reflogin = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var reflogin2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
/* ========== 2 ========== */
testnum++;
testdesc = "http auth, port 80";
testlogin.init("example.com:80", null, "Port 80",
"username", "password", "", "");
cloneLogin(testlogin, reflogin);
reflogin.hostname = "http://example.com";
storage.migrateAndAddLogin(testlogin);
do_check_eq(testlogin.hostname, "http://example.com");
LoginTest.checkStorageData(pwmgr, [], [reflogin]);
pwmgr.removeAllLogins();
/* ========== 3 ========== */
testnum++;
testdesc = "http auth, port 443";
testlogin.init("example.com:443", null, "Port 443",
"username", "password", "", "");
cloneLogin(testlogin, reflogin);
reflogin.hostname = "https://example.com";
storage.migrateAndAddLogin(testlogin);
do_check_eq(testlogin.hostname, "https://example.com");
LoginTest.checkStorageData(pwmgr, [], [reflogin]);
pwmgr.removeAllLogins();
/* ========== 4 ========== */
testnum++;
testdesc = "http auth, port 4242";
testlogin.init("example.com:4242", null, "Port 4242",
"username", "password", "", "");
cloneLogin(testlogin, reflogin);
cloneLogin(testlogin, reflogin2);
reflogin.hostname = "http://example.com:4242";
reflogin2.hostname = "https://example.com:4242";
storage.migrateAndAddLogin(testlogin);
// scheme is ambigious, so 2 logins are created.
LoginTest.checkStorageData(pwmgr, [], [reflogin, reflogin2]);
pwmgr.removeAllLogins();
/* ========== 5 ========== */
testnum++;
testdesc = "http auth, port 80, no realm";
testlogin.init("example.com:80", null, "",
"username", "password", "", "");
cloneLogin(testlogin, reflogin);
reflogin.hostname = "http://example.com";
reflogin.httpRealm = "http://example.com";
storage.migrateAndAddLogin(testlogin);
do_check_eq(testlogin.httpRealm, "http://example.com");
LoginTest.checkStorageData(pwmgr, [], [reflogin]);
pwmgr.removeAllLogins();
/* ========== 6 ========== */
testnum++;
testdesc = "form auth, http";
testlogin.init("http://example.com", "", null,
"username", "password", "uname", "");
cloneLogin(testlogin, reflogin);
// nothing changes, so no need to edit reflogin
storage.migrateAndAddLogin(testlogin);
LoginTest.checkStorageData(pwmgr, [], [reflogin]);
pwmgr.removeAllLogins();
/* ========== 7 ========== */
testnum++;
testdesc = "form auth, https";
testlogin.init("https://example.com", "", null,
"username", "password", "uname", "");
cloneLogin(testlogin, reflogin);
// nothing changes, so no need to edit reflogin
storage.migrateAndAddLogin(testlogin);
LoginTest.checkStorageData(pwmgr, [], [reflogin]);
pwmgr.removeAllLogins();
/* ========== end ========== */
} catch (e) {
throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
}
};

View File

@ -1,300 +0,0 @@
/*
* Test suite for storage-mozStorage.js -- exercises reading from on-disk storage.
*
* This test interfaces directly with the mozStorage password storage module,
* bypassing the normal password manager usage.
*
*/
const STORAGE_TYPE = "mozStorage";
function run_test() {
try {
var testnum = 0;
var testdesc = "Setup of nsLoginInfo test-users";
var nsLoginInfo = new Components.Constructor(
"@mozilla.org/login-manager/loginInfo;1",
Components.interfaces.nsILoginInfo);
do_check_true(nsLoginInfo != null);
var testuser1 = new nsLoginInfo;
testuser1.init("http://dummyhost.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
var testuser2 = new nsLoginInfo;
testuser2.init("http://dummyhost.mozilla.org", "", null,
"dummydude2", "itsasecret2", "put_user2_here", "put_pw2_here");
/* ========== 1 ========== */
var testnum = 1;
var testdesc = "Initial connection to storage module"
var storage;
storage = LoginTest.initStorage(INDIR, "signons-empty.txt", OUTDIR, "signons-empty.sqlite");
storage.getAllLogins();
var testdesc = "[ensuring file exists]"
var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(OUTDIR);
file.append("signons-empty.sqlite");
do_check_true(file.exists());
LoginTest.deleteFile(OUTDIR, "signons-empty.sqlite");
/* ========== 2 ========== */
testnum++;
testdesc = "[ensuring file doesn't exist]";
var filename="this-file-does-not-exist.pwmgr.sqlite";
file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(OUTDIR);
file.append(filename);
if(file.exists())
file.remove(false);
testdesc = "Initialize with a nonexistent data file";
storage = LoginTest.reloadStorage(OUTDIR, filename);
LoginTest.checkStorageData(storage, [], []);
try {
if (file.exists())
file.remove(false);
} catch (e) { }
/* ========== 3 ========== */
testnum++;
testdesc = "Initialize with signons-02.txt (valid, but empty)";
storage = LoginTest.initStorage(INDIR, "signons-02.txt", OUTDIR, "signons-02.sqlite");
LoginTest.checkStorageData(storage, [], []);
LoginTest.deleteFile(OUTDIR, "signons-02.sqlite");
/* ========== 4 ========== */
testnum++;
testdesc = "Initialize with signons-03.txt (1 disabled, 0 logins)";
storage = LoginTest.initStorage(INDIR, "signons-03.txt", OUTDIR, "signons-03.sqlite");
LoginTest.checkStorageData(storage, ["http://www.disabled.com"], []);
LoginTest.deleteFile(OUTDIR, "signons-03.sqlite");
/* ========== 5 ========== */
testnum++;
testdesc = "Initialize with signons-04.txt (1 disabled, 0 logins, extra '.')";
// Mozilla code should never have generated the extra ".", but it's possible
// someone writing an external utility might have generated it, since it
// would seem consistant with the format.
storage = LoginTest.initStorage(INDIR, "signons-04.txt", OUTDIR, "signons-04.sqlite");
LoginTest.checkStorageData(storage, ["http://www.disabled.com"], []);
LoginTest.deleteFile(OUTDIR, "signons-04.sqlite");
/* ========== 6 ========== */
testnum++;
testdesc = "Initialize with signons-05.txt (0 disabled, 1 login)";
storage = LoginTest.initStorage(INDIR, "signons-05.txt", OUTDIR, "signons-05.sqlite");
LoginTest.checkStorageData(storage, [], [testuser1]);
// counting logins matching host
do_check_eq(1, storage.countLogins("http://dummyhost.mozilla.org", "", null));
// counting logins matching host (login has blank actionURL)
do_check_eq(1, storage.countLogins("http://dummyhost.mozilla.org", "foo", null));
// counting logins (don't match form login for HTTP search)
do_check_eq(0, storage.countLogins("http://dummyhost.mozilla.org", null, ""));
// counting logins (don't match a bogus hostname)
do_check_eq(0, storage.countLogins("blah", "", ""));
// counting all logins (empty hostname)
do_check_eq(1, storage.countLogins("", "", null));
// counting all logins (empty hostname)
do_check_eq(1, storage.countLogins("", "foo", null));
// counting no logins (null hostname)
do_check_eq(0, storage.countLogins(null, "", null));
do_check_eq(0, storage.countLogins(null, null, ""));
do_check_eq(0, storage.countLogins(null, "", ""));
do_check_eq(0, storage.countLogins(null, null, null));
LoginTest.deleteFile(OUTDIR, "signons-05.sqlite");
/* ========== 7 ========== */
testnum++;
testdesc = "Initialize with signons-06.txt (1 disabled, 1 login)";
storage = LoginTest.initStorage(INDIR, "signons-06.txt", OUTDIR, "signons-06.sqlite");
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
LoginTest.deleteFile(OUTDIR, "signons-06.sqlite");
/* ========== 8 ========== */
testnum++;
testdesc = "Initialize with signons-07.txt (0 disabled, 2 logins on same host)";
storage = LoginTest.initStorage(INDIR, "signons-07.txt", OUTDIR, "signons-07.sqlite");
LoginTest.checkStorageData(storage, [], [testuser1, testuser2]);
// counting logins matching host
do_check_eq(2, storage.countLogins("http://dummyhost.mozilla.org", "", null));
// counting logins matching host (login has blank actionURL)
do_check_eq(2, storage.countLogins("http://dummyhost.mozilla.org", "foo", null));
// counting logins (don't match form login for HTTP search)
do_check_eq(0, storage.countLogins("http://dummyhost.mozilla.org", null, ""));
// counting logins (don't match a bogus hostname)
do_check_eq(0, storage.countLogins("blah", "", ""));
LoginTest.deleteFile(OUTDIR, "signons-07.sqlite");
/* ========== 9 ========== */
testnum++;
testdesc = "Initialize with signons-08.txt (500 disabled, 500 logins)";
storage = LoginTest.initStorage(INDIR, "signons-08.txt", OUTDIR, "signons-08.sqlite");
var disabledHosts = [];
for (var i = 1; i <= 500; i++) {
disabledHosts.push("http://host-" + i + ".site.com");
}
var bulkLogin, logins = [];
for (i = 1; i <= 250; i++) {
bulkLogin = new nsLoginInfo;
bulkLogin.init("http://dummyhost.site.org", "http://cgi.site.org", null,
"dummydude", "itsasecret", "usernameField-" + i, "passwordField-" + i);
logins.push(bulkLogin);
}
for (i = 1; i <= 250; i++) {
bulkLogin = new nsLoginInfo;
bulkLogin.init("http://dummyhost-" + i + ".site.org", "http://cgi.site.org", null,
"dummydude", "itsasecret", "usernameField", "passwordField");
logins.push(bulkLogin);
}
LoginTest.checkStorageData(storage, disabledHosts, logins);
// counting all logins for dummyhost
do_check_eq(250, storage.countLogins("http://dummyhost.site.org", "", ""));
do_check_eq(250, storage.countLogins("http://dummyhost.site.org", "", null));
do_check_eq(0, storage.countLogins("http://dummyhost.site.org", null, ""));
// counting all logins for dummyhost-1
do_check_eq(1, storage.countLogins("http://dummyhost-1.site.org", "", ""));
do_check_eq(1, storage.countLogins("http://dummyhost-1.site.org", "", null));
do_check_eq(0, storage.countLogins("http://dummyhost-1.site.org", null, ""));
// counting logins for all hosts
do_check_eq(500, storage.countLogins("", "", ""));
do_check_eq(500, storage.countLogins("", "http://cgi.site.org", ""));
do_check_eq(500, storage.countLogins("", "http://cgi.site.org", null));
do_check_eq(0, storage.countLogins("", "blah", ""));
do_check_eq(0, storage.countLogins("", "", "blah"));
// counting logins for no hosts
do_check_eq(0, storage.countLogins(null, "", ""));
do_check_eq(0, storage.countLogins(null, "http://cgi.site.org", ""));
do_check_eq(0, storage.countLogins(null, "http://cgi.site.org", null));
do_check_eq(0, storage.countLogins(null, null, null));
LoginTest.deleteFile(OUTDIR, "signons-08.sqlite");
/* ========== 10 ========== */
testnum++;
testdesc = "Initialize with signons-06.txt (1 disabled, 1 login); test removeLogin";
storage = LoginTest.initStorage(INDIR, "signons-06.txt", OUTDIR, "signons-06-2.sqlite");
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
storage.removeLogin(testuser1);
LoginTest.checkStorageData(storage, ["https://www.site.net"], []);
LoginTest.deleteFile(OUTDIR, "signons-06-2.sqlite");
/* ========== 11 ========== */
testnum++;
testdesc = "Initialize with signons-06.txt (1 disabled, 1 login); test modifyLogin";
storage = LoginTest.initStorage(INDIR, "signons-06.txt", OUTDIR, "signons-06-3.sqlite");
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
// Try modifying a nonexistent login
var err = null;
try {
storage.modifyLogin(testuser2, testuser1);
} catch (e) {
err = e;
}
LoginTest.checkExpectedError(/No matching logins/, err);
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
// Really modify the login.
storage.modifyLogin(testuser1, testuser2);
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser2]);
LoginTest.deleteFile(OUTDIR, "signons-06-3.sqlite");
/*
* ---------------------- Bug 427033 ----------------------
* Check migration of logins stored with a JS formSubmitURL
*/
/* ========== 12 ========== */
testnum++;
testdesc = "checking import of JS formSubmitURL entries"
testuser1.init("http://jstest.site.org", "javascript:", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
storage = LoginTest.initStorage(INDIR, "signons-427033-1.txt",
OUTDIR, "signons-427033-1.sqlite");
LoginTest.checkStorageData(storage, [], [testuser1]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "signons-427033-1.sqlite");
LoginTest.checkStorageData(storage, [], [testuser1]);
LoginTest.deleteFile(OUTDIR, "signons-427033-1.sqlite");
/*
* ---------------------- Bug 500822 ----------------------
* Importing passwords to mozstorage can fail when signons3.txt is corrupted.
*/
/* ========== 13 ========== */
testnum++;
testdesc = "checking import of partially corrupted signons3.txt"
testuser1.init("http://dummyhost.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
storage = LoginTest.initStorage(INDIR, "signons-500822-1.txt",
OUTDIR, "signons-500822-1.sqlite");
// Using searchLogins to check that we have the correct first entry. Tests for
// searchLogin are in test_storage_mozStorage_7.js. Other entries may be
// corrupted, but we need to check for one valid login.
let matchData = Cc["@mozilla.org/hash-property-bag;1"].createInstance(Ci.nsIWritablePropertyBag2);
matchData.setPropertyAsAString("hostname", "http://dummyhost.mozilla.org");
matchData.setPropertyAsAString("usernameField", "put_user_here");
logins = storage.searchLogins({}, matchData);
do_check_eq(1, logins.length, "should match 1 login");
LoginTest.deleteFile(OUTDIR, "signons-500822-1.sqlite");
} catch (e) {
throw "FAILED in test #" + testnum + " -- " + testdesc + ": " + e;
}
};

View File

@ -1,262 +0,0 @@
/*
* Test suite for storage-mozStorage.js -- exercises writing to on-disk storage.
*
* This test interfaces directly with the mozStorage login storage module,
* bypassing the normal login manager usage.
*
*/
const STORAGE_TYPE = "mozStorage";
function run_test() {
try {
var storage, testnum = 0;
/* ========== 1 ========== */
testnum++;
var testdesc = "Create nsILoginInfo instances for testing with"
var dummyuser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
dummyuser1.init( "http://dummyhost.mozilla.org", "", null,
"dummydude", "itsasecret", "put_user_here", "put_pw_here");
dummyuser2.init("http://dummyhost2.mozilla.org", "http://cgi.site.com", null,
"dummydude2", "itsasecret2", "put_user2_here", "put_pw2_here");
dummyuser3.init("http://dummyhost2.mozilla.org", "http://cgi.site.com", null,
"dummydude3", "itsasecret3", "put_user3_here", "put_pw3_here");
/* ========== 2 ========== */
testnum++;
testdesc = "[ensuring file doesn't exist]";
var filename="nonexistent-file-pwmgr.sqlite";
var file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
file.initWithPath(OUTDIR);
file.append(filename);
if(file.exists())
file.remove(false);
testdesc = "Initialize with no existing file";
storage = LoginTest.reloadStorage(OUTDIR, filename);
LoginTest.checkStorageData(storage, [], []);
testdesc = "Add 1 disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], []);
// Can't reliably delete the DB on Windows, so ignore failures.
try {
file.remove(false);
} catch (e) { }
/* ========== 3 ========== */
testnum++;
testdesc = "Initialize with existing file (valid, but empty)";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-01.sqlite");
LoginTest.checkStorageData(storage, [], []);
testdesc = "Add 1 disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], []);
testdesc = "Remove disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", true);
LoginTest.checkStorageData(storage, [], []);
LoginTest.deleteFile(OUTDIR, "output-01.sqlite");
/* ========== 4 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-02.sqlite");
// Previous tests made sure we can write to an existing file, so now just
// tweak component to output elsewhere.
testdesc = "Add 1 login only";
storage.addLogin(dummyuser1);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-02.sqlite");
testdesc = "Verify output-02.sqlite";
LoginTest.checkStorageData(storage, [], [dummyuser1]);
LoginTest.deleteFile(OUTDIR, "output-02.sqlite");
/* ========== 5 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-03.sqlite");
testdesc = "Add 1 disabled host only";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-03.sqlite");
testdesc = "Verify output-03.sqlite";
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], []);
LoginTest.deleteFile(OUTDIR, "output-03.sqlite");
/* ========== 6 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-04.sqlite");
testdesc = "Add 1 disabled host and 1 login";
storage.setLoginSavingEnabled("http://www.nsa.gov", false);
storage.addLogin(dummyuser1);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-04.sqlite");
testdesc = "Verify output-04.sqlite";
LoginTest.checkStorageData(storage, ["http://www.nsa.gov"], [dummyuser1]);
LoginTest.deleteFile(OUTDIR, "output-04.sqlite");
/* ========== 7 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-03-2.sqlite");
testdesc = "Add 2 logins (to different hosts)";
storage.addLogin(dummyuser1);
storage.addLogin(dummyuser2);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-03-2.sqlite");
testdesc = "Verify output-03-2.sqlite";
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser1]);
LoginTest.deleteFile(OUTDIR, "output-03-2.sqlite");
/* ========== 8 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-04-2.sqlite");
testdesc = "Add 2 logins (to same host)";
storage.addLogin(dummyuser2);
storage.addLogin(dummyuser3);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-04-2.sqlite");
testdesc = "Verify output-04-2.sqlite";
LoginTest.checkStorageData(storage, [], [dummyuser3, dummyuser2]);
LoginTest.deleteFile(OUTDIR, "output-04-2.sqlite");
/* ========== 9 ========== */
testnum++;
testdesc = "[clear data and reinitialize with signons-empty.txt]";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-05.sqlite");
testdesc = "Add 3 logins (2 to same host)";
storage.addLogin(dummyuser3);
storage.addLogin(dummyuser1);
storage.addLogin(dummyuser2);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-05.sqlite");
testdesc = "Verify output-05.sqlite";
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
// count dummyhost2 logins
do_check_eq(2, storage.countLogins("http://dummyhost2.mozilla.org", "", ""));
// count dummyhost logins
do_check_eq(1, storage.countLogins("http://dummyhost.mozilla.org", "", ""));
// count dummyhost2 logins w/ specific formSubmitURL
do_check_eq(2, storage.countLogins("http://dummyhost2.mozilla.org", "http://cgi.site.com", ""));
LoginTest.deleteFile(OUTDIR, "output-05.sqlite");
/* ========== 10 ========== */
testnum++;
testdesc = "[init with 1 login, 1 disabled host]";
storage = LoginTest.initStorage(INDIR, "signons-06.txt",
OUTDIR, "output-06.sqlite");
// storage.removeAllLogins();
var oldfile1 = PROFDIR.clone();
oldfile1.append("signons.txt");
// Shouldn't exist, but if a previous run failed it could be left over
if (oldfile1.exists())
oldfile1.remove(false);
oldfile1.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
do_check_true(oldfile1.exists());
var oldfile2 = PROFDIR.clone();
oldfile2.append("signons2.txt");
// Shouldn't exist, but if a previous run failed it could be left over
if (oldfile2.exists())
oldfile2.remove(false);
oldfile2.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
do_check_true(oldfile2.exists());
var oldfile3 = PROFDIR.clone();
oldfile3.append("signons3.txt");
// Shouldn't exist, but if a previous run failed it could be left over
if (oldfile3.exists())
oldfile3.remove(false);
oldfile3.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0600);
do_check_true(oldfile3.exists());
testdesc = "Ensure old files are deleted when removeAllLogins is called";
storage.removeAllLogins();
LoginTest.checkStorageData(storage, ["https://www.site.net"], []);
do_check_false(oldfile1.exists());
do_check_false(oldfile2.exists());
do_check_false(oldfile3.exists());
LoginTest.deleteFile(OUTDIR, "output-06.sqlite");
} catch (e) {
throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
}
};

View File

@ -7,7 +7,6 @@
*/
const STORAGE_TYPE = "mozStorage";
const ENCTYPE_BASE64 = 0;
const ENCTYPE_SDR = 1;
@ -17,15 +16,6 @@ try {
var storage, testnum = 0;
function countBase64Logins(conn) {
let stmt = conn.createStatement("SELECT COUNT(1) as numBase64 FROM moz_logins " +
"WHERE encType = " + ENCTYPE_BASE64);
do_check_true(stmt.executeStep());
let numBase64 = stmt.row.numBase64;
stmt.finalize();
return numBase64;
}
/* ========== 1 ========== */
testnum++;
@ -56,58 +46,6 @@ dummyuser4.init("http://dummyhost4.mozilla.org", "", null,
LoginTest.deleteFile(OUTDIR, "signons.sqlite");
/*
* ---------------------- Bug 380961 ----------------------
* Need to support decoding the mime64-obscured format still
* used by SeaMonkey.
*/
/* ========== 2 ========== */
testnum++;
testdesc = "checking import of mime64-obscured entries"
storage = LoginTest.initStorage(INDIR, "signons-380961-1.txt",
OUTDIR, "output-380961-1.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-380961-1.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
LoginTest.deleteFile(OUTDIR, "output-380961-1.sqlite");
/* ========== 3 ========== */
testnum++;
testdesc = "testing import of multiple mime-64 entries for a host"
storage = LoginTest.initStorage(INDIR, "signons-380961-2.txt",
OUTDIR, "output-380961-2.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser3]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-380961-2.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser2, dummyuser3]);
LoginTest.deleteFile(OUTDIR, "output-380961-2.sqlite");
/* ========== 4 ========== */
testnum++;
testdesc = "testing import of mixed encrypted and mime-64 entries."
storage = LoginTest.initStorage(INDIR, "signons-380961-3.txt",
OUTDIR, "output-380961-3.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-380961-3.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
LoginTest.deleteFile(OUTDIR, "output-380961-3.sqlite");
/*
* ---------------------- Bug 381262 ----------------------
* The SecretDecoderRing can't handle UCS2, failure to
@ -117,7 +55,7 @@ LoginTest.deleteFile(OUTDIR, "output-380961-3.sqlite");
* garbage, whereas the "bad" UCS2 looks ok!
*/
/* ========== 5 ========== */
/* ========== 2 ========== */
testnum++;
testdesc = "initializing login with non-ASCII data."
@ -136,27 +74,11 @@ dummyuser4.formSubmitURL = "https://site.org";
dummyuser4.httpRealm = null;
/* ========== 6 ========== */
testnum++;
testdesc = "testing import of non-ascii username and password."
storage = LoginTest.initStorage(INDIR, "signons-381262.txt",
OUTDIR, "output-381262-1.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser4]);
testdesc = "[flush and reload for verification]"
storage = LoginTest.reloadStorage(OUTDIR, "output-381262-1.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser4]);
LoginTest.deleteFile(OUTDIR, "output-381262-1.sqlite");
/* ========== 7 ========== */
/* ========== 3 ========== */
testnum++;
testdesc = "testing storage of non-ascii username and password."
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-381262-2.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-381262-2.sqlite");
LoginTest.checkStorageData(storage, [], []);
storage.addLogin(dummyuser4);
LoginTest.checkStorageData(storage, [], [dummyuser4]);
@ -168,52 +90,14 @@ LoginTest.checkStorageData(storage, [], [dummyuser4]);
LoginTest.deleteFile(OUTDIR, "output-381262-2.sqlite");
/*
* ---------------------- Bug 400751 ----------------------
* Migrating from existing mime64 encoded format causes
* errors in storage legacy's code
*/
/* ========== 8 ========== */
testnum++;
testdesc = "checking double reading of mime64-obscured entries";
storage = LoginTest.initStorage(INDIR, "signons-380961-1.txt",
OUTDIR, "output-400751-0.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
testdesc = "checking double reading of mime64-obscured entries part 2";
LoginTest.checkStorageData(storage, [], [dummyuser1]);
LoginTest.deleteFile(OUTDIR, "output-400751-0.sqlite");
/* ========== 9 ========== */
testnum++;
testdesc = "checking correct storage of mime64 converted entries";
storage = LoginTest.initStorage(INDIR, "signons-380961-1.txt",
OUTDIR, "output-400751-1.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser1]);
LoginTest.checkStorageData(storage, [], [dummyuser1]);
storage.addLogin(dummyuser2); // trigger a write
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2]);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-400751-1.sqlite");
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2]);
LoginTest.deleteFile(OUTDIR, "output-400751-1.sqlite");
/*
* ---------------------- Bug 394610 ----------------------
* Ensure input which might mess with the format or structure of
* the store file is appropriately filtered.
* The ancient signons.txt format needed some input sanitation
* to avoid causing parse errors. We continuted to enforce this
* with sqlite, even though it's not strictly needed.
*/
/* ========== 10 ========== */
/* ========== 4 ========== */
testnum++;
function tryAddUser(storage, aUser, aExpectedError) {
@ -228,8 +112,7 @@ function tryAddUser(storage, aUser, aExpectedError) {
}
testdesc = "preparting to try logins with bogus values";
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-1.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-394610-1.sqlite");
LoginTest.checkStorageData(storage, [], []);
@ -330,12 +213,11 @@ failUser.password = "password";
LoginTest.deleteFile(OUTDIR, "output-394610-1.sqlite");
/* ========== 11 ========== */
/* ========== 5 ========== */
testnum++;
testdesc = "storing data values with special period-only value"
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-2.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-394610-2.sqlite");
LoginTest.checkStorageData(storage, [], []);
@ -370,13 +252,12 @@ LoginTest.checkStorageData(storage, [], []);
LoginTest.deleteFile(OUTDIR, "output-394610-2.sqlite");
/* ========== 12 ========== */
/* ========== 6 ========== */
testnum++;
testdesc = "create logins with parens in host/httpRealm"
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-3.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-394610-3.sqlite");
LoginTest.checkStorageData(storage, [], []);
var parenUser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
@ -450,7 +331,7 @@ LoginTest.checkStorageData(storage, [], parenLogins);
LoginTest.deleteFile(OUTDIR, "output-394610-3.sqlite");
/* ========== 13 ========== */
/* ========== 7 ========== */
testnum++;
testdesc = "storing data values with embedded nulls."
@ -459,8 +340,7 @@ testdesc = "storing data values with embedded nulls."
do_check_eq( "foo\0bar", "foo\0bar");
do_check_neq("foo\0bar", "foobar");
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-394610-4.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-394610-4.sqlite");
LoginTest.checkStorageData(storage, [], []);
var nullUser = Cc["@mozilla.org/login-manager/loginInfo;1"].
@ -545,12 +425,11 @@ LoginTest.deleteFile(OUTDIR, "output-394610-4.sqlite");
* UCS2 characters above U+00FF.
*/
/* ========== 14 ========== */
/* ========== 8 ========== */
testnum++;
testdesc = "ensure UCS2 strings don't get mangled."
storage = LoginTest.initStorage(INDIR, "signons-empty.txt",
OUTDIR, "output-451155.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-451155.sqlite");
LoginTest.checkStorageData(storage, [], []);
var testString = String.fromCharCode(355, 277, 349, 357, 533, 537, 101, 345, 185);
@ -580,76 +459,6 @@ LoginTest.checkStorageData(storage, [utfHost], [utfUser1, utfUser2]);
LoginTest.deleteFile(OUTDIR, "output-451155.sqlite");
/*
* ---------------------- Bug 316984 ----------------------
* Ensure that base64 logins are reencrypted upon call to
* getAllLogins
*/
/* ========== 15 ========== */
testnum++;
testdesc = "ensure base64 logins are reencrypted on first call to getAllLogins"
// signons-380961-3.txt contains 2 base64 logins & 1 normal
storage = LoginTest.initStorage(INDIR, "signons-380961-3.txt",
OUTDIR, "output-316984-1.sqlite");
// Check that we do have 2 base64 logins here.
let dbConnection = LoginTest.openDB("output-316984-1.sqlite");
do_check_eq(countBase64Logins(dbConnection), 2);
// This makes a call to getAllLogins which should reencrypt
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3]);
// Check that there are 0 base64 logins remaining
do_check_eq(countBase64Logins(dbConnection), 0);
LoginTest.deleteFile(OUTDIR, "output-316984-1.sqlite");
/* ========== 16 ========== */
testnum++;
testdesc = "ensure base64 logins are reencrypted when first new login is added"
// signons-380961-3.txt contains 2 base64 logins & 1 normal
storage = LoginTest.initStorage(INDIR, "signons-380961-3.txt",
OUTDIR, "output-316984-2.sqlite");
// Check that we do have 2 base64 logins here.
dbConnection = LoginTest.openDB("output-316984-2.sqlite");
do_check_eq(countBase64Logins(dbConnection), 2);
// Adding a new user should reencrypt the first time
storage.addLogin(dummyuser4)
// Check that there are 0 base64 logins remaining
do_check_eq(countBase64Logins(dbConnection), 0);
LoginTest.deleteFile(OUTDIR, "output-316984-2.sqlite");
/* ========== 17 ========== */
testnum++;
testdesc = "ensure base64 logins are NOT reencrypted on call to countLogins"
// signons-380961-3.txt contains 2 base64 logins & 1 normal
storage = LoginTest.initStorage(INDIR, "signons-380961-3.txt",
OUTDIR, "output-316984-3.sqlite");
// Check that we do have 2 base64 logins here.
dbConnection = LoginTest.openDB("output-316984-3.sqlite");
do_check_eq(countBase64Logins(dbConnection), 2);
// countLogins should NOT reencrypt logins
storage.countLogins("", "", "")
// Check that there are still 2 base64 logins here
do_check_eq(countBase64Logins(dbConnection), 2);
LoginTest.deleteFile(OUTDIR, "output-316984-3.sqlite");
/* ========== end ========== */
} catch (e) {
throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);

View File

@ -1,162 +0,0 @@
/*
* Test suite for storage-mozStorage.js -- mailnews specific tests.
*
* This test interfaces directly with the mozStorage login storage module,
* bypassing the normal login manager usage.
*
*/
const Cm = Components.manager;
const BASE_CONTRACTID = "@mozilla.org/network/protocol;1?name=";
const LDAPPH_CID = Components.ID("{08eebb58-8d1a-4ab5-9fca-e35372697828}");
const MAILBOXPH_CID = Components.ID("{edb1dea3-b226-405a-b93d-2a678a68a198}");
const NEWSBOXPH_CID = Components.ID("{939fe896-8961-49d0-b0e0-4ae779bdef36}");
const STORAGE_TYPE = "mozStorage";
function genericProtocolHandler(scheme, defaultPort) {
this.scheme = scheme;
this.defaultPort = defaultPort;
}
genericProtocolHandler.prototype = {
scheme: "",
defaultPort: 0,
QueryInterface: function gph_QueryInterface(aIID) {
if (!aIID.equals(Ci.nsISupports) &&
!aIID.equals(Ci.nsIProtocolHandler)) {
throw Cr.NS_ERROR_NO_INTERFACE;
}
return this;
},
get protocolFlags() {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
newURI: function gph_newURI(aSpec, anOriginalCharset, aBaseURI) {
var uri = Components.classes["@mozilla.org/network/standard-url;1"].
createInstance(Ci.nsIStandardURL);
uri.init(Ci.nsIStandardURL.URLTYPE_STANDARD, this.defaultPort, aSpec,
anOriginalCharset, aBaseURI);
return uri;
},
newChannel: function gph_newChannel(aUri) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
},
allowPort: function gph_allowPort(aPort, aScheme) {
return false;
}
}
function generateFactory(protocol, defaultPort)
{
return {
createInstance: function (outer, iid) {
if (outer != null)
throw Components.results.NS_ERROR_NO_AGGREGATION;
return (new genericProtocolHandler(protocol, defaultPort)).
QueryInterface(iid);
}
};
}
function run_test() {
// News is set up as an external protocol in Firefox's prefs, for this test
// to work, we need it to be internal.
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
prefBranch.setBoolPref("network.protocol-handler.external.news", false);
Cm.nsIComponentRegistrar.registerFactory(LDAPPH_CID, "LDAPProtocolFactory",
BASE_CONTRACTID + "ldap",
generateFactory("ldap", 389));
Cm.nsIComponentRegistrar.registerFactory(MAILBOXPH_CID,
"MailboxProtocolFactory",
BASE_CONTRACTID + "mailbox",
generateFactory("mailbox", 0));
Cm.nsIComponentRegistrar.registerFactory(NEWSBOXPH_CID,
"NewsProtocolFactory",
BASE_CONTRACTID + "news",
generateFactory("news", 119));
try {
var storage, testnum = 0;
// Create a couple of dummy users to match what we expect to be translated
// from the input file.
var dummyuser1 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser2 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser3 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser4 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser5 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
var dummyuser6 = Cc["@mozilla.org/login-manager/loginInfo;1"].
createInstance(Ci.nsILoginInfo);
dummyuser1.init("mailbox://localhost", null, "mailbox://localhost",
"bugzilla", "testpass1", "", "");
dummyuser2.init("ldap://localhost1", null,
"ldap://localhost1/dc=test",
"", "testpass2", "", "");
dummyuser3.init("mailbox://localhost", null, "mailbox://localhost",
"test+pop3", "pop3test", "", "");
dummyuser4.init("http://dummyhost.mozilla.org", "", null,
"testuser1", "testpass1", "put_user_here", "put_pw_here");
dummyuser5.init("news://localhost", null, "news://localhost/#password",
"", "newstest", "", "");
dummyuser6.init("news://localhost", null, "news://localhost/#username",
"", "testnews", "", "");
/*
* ---------------------- Bug 403790 ----------------------
* Migrating mailnews style username/passwords
*/
/* ========== 1 ========== */
testnum++;
var testdesc = "checking reading of mailnews-like old logins";
storage = LoginTest.initStorage(INDIR, "signons-403790.txt",
OUTDIR, "output-403790.sqlite");
// signons-403790.txt has one extra login that is invalid, and hence isn't
// shown here.
LoginTest.checkStorageData(storage, [], [dummyuser1, dummyuser2, dummyuser3,
dummyuser5, dummyuser6]);
storage.addLogin(dummyuser4); // trigger a write
LoginTest.checkStorageData(storage, [],
[dummyuser1, dummyuser2, dummyuser3, dummyuser4,
dummyuser5, dummyuser6]);
testdesc = "[flush and reload for verification]";
storage = LoginTest.reloadStorage(OUTDIR, "output-403790.sqlite");
LoginTest.checkStorageData(storage, [],
[dummyuser1, dummyuser2, dummyuser3, dummyuser4,
dummyuser5, dummyuser6]);
LoginTest.deleteFile(OUTDIR, "output-403790.sqlite");
/* ========== end ========== */
} catch (e) {
throw ("FAILED in test #" + testnum + " -- " + testdesc + ": " + e);
}
};

View File

@ -7,8 +7,6 @@
*
*/
const STORAGE_TYPE = "mozStorage";
function run_test() {
try {
@ -30,28 +28,11 @@ testuser1.init("http://dummyhost.mozilla.org", "", null,
LoginTest.deleteFile(OUTDIR, "signons.sqlite");
/*
* ---------------------- Initialization ----------------------
* Pass in a legacy file that has problems (bad header). Initialization should
* throw "Initialization failed". We replace the bad file with a good one,
* and call getAllLogins again, which will attempt to import again and should
* succeed because it has a good file now.
*/
/* ========== 2 ========== */
testnum++;
var testdesc = "Initialization, reinitialization, & importing"
var storage;
storage = LoginTest.initStorage(INDIR, "signons-00.txt", null, null, /Initialization failed/);
// Since initWithFile will not replace the DB if not passed one, we can just
// call LoginTest.initStorage with with signons-06.txt (1 disabled, 1 login).
// storage is already defined, so this is acceptable use (a bit hacky though)
storage = LoginTest.initStorage(INDIR, "signons-06.txt");
LoginTest.checkStorageData(storage, ["https://www.site.net"], [testuser1]);
LoginTest.deleteFile(OUTDIR, "signons.sqlite");
// (obsolete test removed)
/*

View File

@ -7,8 +7,6 @@
*/
const STORAGE_TYPE = "mozStorage";
function run_test() {
try {
@ -56,7 +54,7 @@ var testdesc = "Initial connection to storage module"
LoginTest.deleteFile(OUTDIR, "signons-unittest6.sqlite");
var storage;
storage = LoginTest.initStorage(INDIR, "signons-empty.txt", OUTDIR, "signons-unittest6.sqlite");
storage = LoginTest.initStorage(OUTDIR, "signons-unittest6.sqlite");
var logins = storage.getAllLogins();
do_check_eq(logins.length, 0, "Checking for no initial logins");
var disabledHosts = storage.getAllDisabledHosts();

View File

@ -7,8 +7,6 @@
*/
const STORAGE_TYPE = "mozStorage";
function run_test() {
try {
@ -46,8 +44,7 @@ dummyuser4.init("http://dummyhost3.mozilla.org", null, null,
testnum++;
testdesc = "checking that searchLogins works with values passed"
storage = LoginTest.initStorage(INDIR, null,
OUTDIR, "output-searchLogins-1.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-searchLogins-1.sqlite");
storage.addLogin(dummyuser1);
storage.addLogin(dummyuser2);
@ -109,8 +106,7 @@ LoginTest.deleteFile(OUTDIR, "output-searchLogins-1.sqlite");
testnum++;
testdesc = "checking that searchLogins works as findLogins"
storage = LoginTest.initStorage(INDIR, null,
OUTDIR, "output-searchLogins-3.sqlite");
storage = LoginTest.initStorage(OUTDIR, "output-searchLogins-3.sqlite");
storage.addLogin(dummyuser1);
storage.addLogin(dummyuser2);

View File

@ -8,7 +8,6 @@
*/
const STORAGE_TYPE = "mozStorage";
const ENCTYPE_BASE64 = 0;
const ENCTYPE_SDR = 1;
@ -191,9 +190,10 @@ for (let i = 0; i < encTypes.length; i++)
do_check_eq(encTypes[i], getEncTypeForID(dbConnection, i + 1));
dbConnection.close();
// Ensure that call to getAllLogins will reencrypt
// There are 4 logins, but 3 will be invalid because we can no longer decrypt
// base64-encoded items. (testuser1/4/5)
LoginTest.checkStorageData(storage, ["https://disabled.net"],
[testuser1, testuser2, testuser4, testuser5]);
[testuser2]);
LoginTest.deleteFile(OUTDIR, "signons-v2.sqlite");
@ -221,9 +221,10 @@ for (let i = 0; i < encTypes.length; i++)
do_check_eq(encTypes[i], getEncTypeForID(dbConnection, i + 1));
// Sanity check that the data gets migrated
LoginTest.checkStorageData(storage, ["https://disabled.net"],
[testuser1, testuser2, testuser4, testuser5, testuser3]);
encTypes = [ENCTYPE_SDR, ENCTYPE_SDR, ENCTYPE_SDR, ENCTYPE_SDR, ENCTYPE_SDR];
// There are 5 logins, but 3 will be invalid because we can no longer decrypt
// base64-encoded items. (testuser1/4/5). We no longer reencrypt with SDR.
LoginTest.checkStorageData(storage, ["https://disabled.net"], [testuser2, testuser3]);
encTypes = [ENCTYPE_BASE64, ENCTYPE_SDR, ENCTYPE_BASE64, ENCTYPE_BASE64, ENCTYPE_SDR];
for (let i = 0; i < encTypes.length; i++)
do_check_eq(encTypes[i], getEncTypeForID(dbConnection, i + 1));
dbConnection.close();

View File

@ -6,8 +6,6 @@
*/
const STORAGE_TYPE = "mozStorage";
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var expectedNotification;
@ -92,7 +90,7 @@ var testdesc = "Initial connection to storage module"
LoginTest.deleteFile(OUTDIR, "signons-unittest-notify.sqlite");
var storage;
storage = LoginTest.initStorage(INDIR, "signons-empty.txt", OUTDIR, "signons-unittest-notify.sqlite");
storage = LoginTest.initStorage(OUTDIR, "signons-unittest-notify.sqlite");
var logins = storage.getAllLogins();
do_check_eq(logins.length, 0);
var disabledHosts = storage.getAllDisabledHosts();

View File

@ -4,15 +4,7 @@ tail =
support-files = data/**
[test_access_db_connection.js]
[test_storage_legacy_1.js]
[test_storage_legacy_2.js]
[test_storage_legacy_3.js]
[test_storage_legacy_4.js]
[test_storage_legacy_5.js]
[test_storage_mozStorage_1.js]
[test_storage_mozStorage_2.js]
[test_storage_mozStorage_3.js]
[test_storage_mozStorage_4.js]
[test_storage_mozStorage_5.js]
[test_storage_mozStorage_6.js]
[test_storage_mozStorage_7.js]

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