Merge mozilla-central to mozilla-inbound
@ -54,13 +54,9 @@ endif
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,unicharutil_external_s,$(LIBXUL_DIST)/lib)
|
||||
|
||||
# migration requires mozreg
|
||||
LOCAL_INCLUDES += -I$(srcdir)/../migration/src
|
||||
SHARED_LIBRARY_LIBS += ../migration/src/$(LIB_PREFIX)migration_s.$(LIB_SUFFIX)
|
||||
EXTRA_DSO_LDOPTS += $(LIBXUL_DIST)/lib/$(LIB_PREFIX)mozreg_s.$(LIB_SUFFIX)
|
||||
|
||||
# This has to come after the above chunk, because mozreg_s has dependencies on
|
||||
# stuff in MOZ_COMPONENT_LIBS.
|
||||
EXTRA_DSO_LDOPTS += \
|
||||
$(LIBXUL_DIST)/lib/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
|
@ -56,7 +56,6 @@
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "NSReg.h"
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#ifdef XP_WIN
|
||||
@ -69,18 +68,6 @@
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#ifndef MAXPATHLEN
|
||||
#ifdef PATH_MAX
|
||||
#define MAXPATHLEN PATH_MAX
|
||||
#elif defined(_MAX_PATH)
|
||||
#define MAXPATHLEN _MAX_PATH
|
||||
#elif defined(CCHMAXPATH)
|
||||
#define MAXPATHLEN CCHMAXPATH
|
||||
#else
|
||||
#define MAXPATHLEN 1024
|
||||
#endif
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsIProfileMigrator
|
||||
|
||||
@ -144,15 +131,6 @@ nsProfileMigrator::Migrate(nsIProfileStartup* aStartup)
|
||||
getter_AddRefs(migrateWizard));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsProfileMigrator::Import()
|
||||
{
|
||||
if (ImportRegistryProfiles(NS_LITERAL_CSTRING("Firefox")))
|
||||
return NS_OK;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// nsProfileMigrator
|
||||
|
||||
@ -267,110 +245,3 @@ nsProfileMigrator::GetDefaultBrowserMigratorKey(nsACString& aKey,
|
||||
#endif
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsProfileMigrator::ImportRegistryProfiles(const nsACString& aAppName)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIToolkitProfileService> profileSvc
|
||||
(do_GetService(NS_PROFILESERVICE_CONTRACTID));
|
||||
NS_ENSURE_TRUE(profileSvc, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsIProperties> dirService
|
||||
(do_GetService("@mozilla.org/file/directory_service;1"));
|
||||
NS_ENSURE_TRUE(dirService, PR_FALSE);
|
||||
|
||||
nsCOMPtr<nsILocalFile> regFile;
|
||||
#ifdef XP_WIN
|
||||
rv = dirService->Get(NS_WIN_APPDATA_DIR, NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(regFile));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
regFile->AppendNative(aAppName);
|
||||
regFile->AppendNative(NS_LITERAL_CSTRING("registry.dat"));
|
||||
#elif defined(XP_MACOSX)
|
||||
rv = dirService->Get(NS_MAC_USER_LIB_DIR, NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(regFile));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
regFile->AppendNative(aAppName);
|
||||
regFile->AppendNative(NS_LITERAL_CSTRING("Application Registry"));
|
||||
#elif defined(XP_OS2)
|
||||
rv = dirService->Get(NS_OS2_HOME_DIR, NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(regFile));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
regFile->AppendNative(aAppName);
|
||||
regFile->AppendNative(NS_LITERAL_CSTRING("registry.dat"));
|
||||
#else
|
||||
rv = dirService->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile),
|
||||
getter_AddRefs(regFile));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
nsCAutoString dotAppName;
|
||||
ToLowerCase(aAppName, dotAppName);
|
||||
dotAppName.Insert('.', 0);
|
||||
|
||||
regFile->AppendNative(dotAppName);
|
||||
regFile->AppendNative(NS_LITERAL_CSTRING("appreg"));
|
||||
#endif
|
||||
|
||||
nsCAutoString path;
|
||||
rv = regFile->GetNativePath(path);
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
if (NR_StartupRegistry())
|
||||
return PR_FALSE;
|
||||
|
||||
PRBool migrated = PR_FALSE;
|
||||
HREG reg = nsnull;
|
||||
RKEY profiles = 0;
|
||||
REGENUM enumstate = 0;
|
||||
char profileName[MAXREGNAMELEN];
|
||||
|
||||
if (NR_RegOpen(path.get(), ®))
|
||||
goto cleanup;
|
||||
|
||||
if (NR_RegGetKey(reg, ROOTKEY_COMMON, "Profiles", &profiles))
|
||||
goto cleanup;
|
||||
|
||||
while (!NR_RegEnumSubkeys(reg, profiles, &enumstate,
|
||||
profileName, MAXREGNAMELEN, REGENUM_CHILDREN)) {
|
||||
#ifdef DEBUG_bsmedberg
|
||||
printf("Found profile %s.\n", profileName);
|
||||
#endif
|
||||
|
||||
RKEY profile = 0;
|
||||
if (NR_RegGetKey(reg, profiles, profileName, &profile)) {
|
||||
NS_ERROR("Could not get the key that was enumerated.");
|
||||
continue;
|
||||
}
|
||||
|
||||
char profilePath[MAXPATHLEN];
|
||||
if (NR_RegGetEntryString(reg, profile, "directory",
|
||||
profilePath, MAXPATHLEN))
|
||||
continue;
|
||||
|
||||
nsCOMPtr<nsILocalFile> profileFile
|
||||
(do_CreateInstance("@mozilla.org/file/local;1"));
|
||||
if (!profileFile)
|
||||
continue;
|
||||
|
||||
#if defined (XP_MACOSX)
|
||||
rv = profileFile->SetPersistentDescriptor(nsDependentCString(profilePath));
|
||||
#else
|
||||
NS_ConvertUTF8toUTF16 widePath(profilePath);
|
||||
rv = profileFile->InitWithPath(widePath);
|
||||
#endif
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
||||
nsCOMPtr<nsIToolkitProfile> tprofile;
|
||||
profileSvc->CreateProfile(profileFile, nsnull,
|
||||
nsDependentCString(profileName),
|
||||
getter_AddRefs(tprofile));
|
||||
migrated = PR_TRUE;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (reg)
|
||||
NR_RegClose(reg);
|
||||
NR_ShutdownRegistry();
|
||||
return migrated;
|
||||
}
|
||||
|
@ -58,12 +58,6 @@ protected:
|
||||
|
||||
nsresult GetDefaultBrowserMigratorKey(nsACString& key,
|
||||
nsCOMPtr<nsIBrowserProfileMigrator>& bpm);
|
||||
|
||||
/**
|
||||
* Import profiles from ~/.firefox/
|
||||
* @return PR_TRUE if any profiles imported.
|
||||
*/
|
||||
PRBool ImportRegistryProfiles(const nsACString& aAppName);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -956,11 +956,11 @@ toolbar[iconsize="small"] #feed-button {
|
||||
|
||||
#urlbar-icons {
|
||||
-moz-box-align: center;
|
||||
-moz-padding-end: 2px;
|
||||
}
|
||||
|
||||
.urlbar-icon {
|
||||
cursor: pointer;
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
#urlbar-search-splitter {
|
||||
@ -1315,83 +1315,37 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
border-top: 1px solid GrayText;
|
||||
}
|
||||
|
||||
/* Go button */
|
||||
/* Combined go/reload/stop button in location bar */
|
||||
|
||||
#go-button {
|
||||
padding: 3px 2px 2px 2px;
|
||||
list-style-image: url("chrome://browser/skin/Go-arrow.png");
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
/* Combined go/reload/stop button in location bar */
|
||||
|
||||
#urlbar > toolbarbutton {
|
||||
-moz-appearance: none;
|
||||
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
|
||||
margin: -1px;
|
||||
-moz-margin-start: 0;
|
||||
padding: 0 3px;
|
||||
background-origin: border-box;
|
||||
padding: 0;
|
||||
border: none;
|
||||
-moz-border-start: 1px solid rgba(0,0,0,.35);
|
||||
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset,
|
||||
-1px -1px 1px rgba(255,255,255,.2) inset;
|
||||
}
|
||||
|
||||
#urlbar:-moz-locale-dir(ltr) > toolbarbutton {
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
}
|
||||
|
||||
#urlbar:-moz-locale-dir(rtl) > toolbarbutton {
|
||||
border-top-left-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
}
|
||||
|
||||
#urlbar > toolbarbutton:not([disabled]):active:hover,
|
||||
#urlbar-reload-button:not(:hover) {
|
||||
-moz-border-start-style: none;
|
||||
-moz-padding-start: 4px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#urlbar > toolbarbutton:not([disabled]):active:hover {
|
||||
box-shadow: 0 0 6.5px rgba(0,0,0,.4) inset,
|
||||
0 0 2px rgba(0,0,0,.4) inset;
|
||||
cursor: pointer;
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
#go-button,
|
||||
#urlbar-go-button {
|
||||
-moz-image-region: rect(0px, 56px, 14px, 42px);
|
||||
background-image: -moz-linear-gradient(rgb(143,219,69), rgb(115,177,57));
|
||||
list-style-image: url("chrome://browser/skin/Go-arrow.png");
|
||||
}
|
||||
|
||||
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
|
||||
#urlbar-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#urlbar-go-button:hover {
|
||||
background-image: -moz-linear-gradient(rgb(163,232,92), rgb(137,196,81));
|
||||
}
|
||||
|
||||
#urlbar-reload-button {
|
||||
-moz-image-region: rect(0px, 14px, 14px, 0px);
|
||||
}
|
||||
|
||||
#urlbar-reload-button:not([disabled]):hover {
|
||||
-moz-image-region: rect(0px, 28px, 14px, 14px);
|
||||
background-image: -moz-linear-gradient(rgb(137,183,233), rgb(79,130,195));
|
||||
list-style-image: url("moz-icon://stock/gtk-refresh?size=menu");
|
||||
}
|
||||
|
||||
#urlbar-stop-button {
|
||||
-moz-image-region: rect(0px, 42px, 14px, 28px);
|
||||
background-image: -moz-linear-gradient(rgb(226,99,99), rgb(199,68,68));
|
||||
}
|
||||
|
||||
#urlbar-stop-button:hover {
|
||||
background-image: -moz-linear-gradient(rgb(237,120,120), rgb(216,92,92));
|
||||
list-style-image: url("moz-icon://stock/gtk-stop?size=menu");
|
||||
}
|
||||
|
||||
/* Popup blocker button */
|
||||
|
@ -27,7 +27,6 @@ browser.jar:
|
||||
skin/classic/browser/page-livemarks.png
|
||||
skin/classic/browser/Privacy-16.png
|
||||
skin/classic/browser/Privacy-48.png
|
||||
skin/classic/browser/reload-stop-go.png
|
||||
skin/classic/browser/searchbar.css (searchbar.css)
|
||||
skin/classic/browser/section_collapsed.png
|
||||
skin/classic/browser/section_collapsed-rtl.png
|
||||
|
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.2 KiB |
@ -836,13 +836,10 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
}
|
||||
|
||||
#urlbar {
|
||||
-moz-padding-end: 4px;
|
||||
border-radius: @toolbarbuttonCornerRadius@;
|
||||
}
|
||||
|
||||
#urlbar-container:not([combined]) > #urlbar {
|
||||
-moz-padding-end: 3px;
|
||||
}
|
||||
|
||||
#identity-box {
|
||||
background-image: -moz-linear-gradient(hsl(0,0%,98%), hsl(0,0%,92%));
|
||||
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset;
|
||||
@ -910,10 +907,31 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
padding: 3px 0 2px;
|
||||
}
|
||||
|
||||
.urlbar-history-dropmarker {
|
||||
padding: 0 3px;
|
||||
list-style-image: url("chrome://browser/skin/urlbar-history-dropmarker.png");
|
||||
-moz-image-region: rect(0px, 11px, 14px, 0px);
|
||||
}
|
||||
|
||||
.urlbar-history-dropmarker[open="true"],
|
||||
.urlbar-history-dropmarker:hover:active {
|
||||
-moz-image-region: rect(0px, 22px, 14px, 11px);
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
|
||||
}
|
||||
|
||||
#urlbar-icons {
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
.urlbar-icon {
|
||||
padding: 2px 3px;
|
||||
}
|
||||
|
||||
.urlbar-icon[open="true"],
|
||||
.urlbar-icon:hover:active {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
|
||||
}
|
||||
|
||||
#urlbar-search-splitter {
|
||||
min-width: 8px;
|
||||
width: 8px;
|
||||
@ -975,9 +993,8 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
|
||||
.ac-result-type-bookmark,
|
||||
.autocomplete-treebody::-moz-tree-image(bookmark, treecolAutoCompleteImage) {
|
||||
list-style-image: url("chrome://browser/skin/places/pageStarred.png");
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
list-style-image: url("chrome://browser/skin/places/star-icons.png");
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
.ac-result-type-keyword,
|
||||
@ -991,7 +1008,7 @@ toolbar[mode="icons"] #zoom-in-button {
|
||||
richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
|
||||
.autocomplete-treebody::-moz-tree-image(selected, current, bookmark, treecolAutoCompleteImage) {
|
||||
list-style-image: url("chrome://browser/skin/places/star-icons.png");
|
||||
-moz-image-region: rect(32px, 16px, 48px, 0px);
|
||||
-moz-image-region: rect(0, 64px, 16px, 48px);
|
||||
}
|
||||
|
||||
.ac-result-type-tag,
|
||||
@ -1036,81 +1053,59 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
border-top: 1px solid GrayText;
|
||||
}
|
||||
|
||||
/* ----- GO BUTTON ----- */
|
||||
|
||||
#go-button {
|
||||
list-style-image: url("chrome://browser/skin/Go-arrow.png");
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
}
|
||||
|
||||
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#go-button:hover {
|
||||
-moz-image-region: rect(0px, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
#go-button:hover:active {
|
||||
-moz-image-region: rect(0px, 48px, 16px, 32px);
|
||||
}
|
||||
|
||||
/* ----- COMBINED GO/RELOAD/STOP BUTTON IN LOCATION BAR ----- */
|
||||
|
||||
#go-button,
|
||||
#urlbar > toolbarbutton {
|
||||
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
|
||||
margin: 0;
|
||||
-moz-margin-start: 2px;
|
||||
padding: 0 3px;
|
||||
-moz-padding-start: 2px;
|
||||
-moz-padding-end: 1px;
|
||||
background-origin: border-box;
|
||||
border: none;
|
||||
-moz-border-start: 1px solid rgba(0,0,0,.25);
|
||||
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset,
|
||||
-1px -1px 1px rgba(255,255,255,.15) inset;
|
||||
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
|
||||
}
|
||||
|
||||
#urlbar:-moz-locale-dir(ltr) > toolbarbutton {
|
||||
border-top-right-radius: 2px;
|
||||
border-bottom-right-radius: 2px;
|
||||
#urlbar > toolbarbutton:not([disabled]):hover:active {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
|
||||
}
|
||||
|
||||
#urlbar:-moz-locale-dir(rtl) > toolbarbutton {
|
||||
border-top-left-radius: 2px;
|
||||
border-bottom-left-radius: 2px;
|
||||
}
|
||||
|
||||
#urlbar > toolbarbutton:not([disabled]):active:hover,
|
||||
#urlbar-reload-button:not(:hover) {
|
||||
-moz-border-start-style: none;
|
||||
-moz-padding-start: 4px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#urlbar > toolbarbutton:not([disabled]):active:hover {
|
||||
box-shadow: @toolbarbuttonPressedInnerShadow@;
|
||||
#go-button {
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
#go-button,
|
||||
#urlbar-go-button {
|
||||
-moz-image-region: rect(0px, 56px, 14px, 42px);
|
||||
background-image: -moz-linear-gradient(rgb(184,221,142), rgb(154,201,111) 49%, rgb(130,187,92) 51%, rgb(114,171,79));
|
||||
-moz-image-region: rect(0, 42px, 14px, 28px);
|
||||
}
|
||||
|
||||
#go-button:hover:active,
|
||||
#urlbar-go-button:hover:active {
|
||||
-moz-image-region: rect(14px, 42px, 28px, 28px);
|
||||
}
|
||||
|
||||
#go-button:-moz-locale-dir(rtl),
|
||||
#urlbar-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#urlbar-reload-button {
|
||||
-moz-image-region: rect(0px, 14px, 14px, 0px);
|
||||
-moz-image-region: rect(0, 14px, 14px, 0);
|
||||
}
|
||||
|
||||
#urlbar-reload-button:not([disabled]):hover {
|
||||
-moz-image-region: rect(0px, 28px, 14px, 14px);
|
||||
background-image: -moz-linear-gradient(rgb(162,207,241), rgb(111,178,225) 49%, rgb(91,159,217) 51%, rgb(62,138,200));
|
||||
#urlbar-reload-button:not([disabled]):hover:active {
|
||||
-moz-image-region: rect(14px, 14px, 28px, 0);
|
||||
}
|
||||
|
||||
#urlbar-reload-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#urlbar-stop-button {
|
||||
-moz-image-region: rect(0px, 42px, 14px, 28px);
|
||||
background-image: -moz-linear-gradient(rgb(231,162,140), rgb(209,119,100) 49%, rgb(193,92,78) 51%, rgb(173,72,58));
|
||||
-moz-image-region: rect(0, 28px, 14px, 14px);
|
||||
}
|
||||
|
||||
#urlbar-stop-button:hover:active {
|
||||
-moz-image-region: rect(14px, 28px, 28px, 14px);
|
||||
}
|
||||
|
||||
/* POPUP BLOCKER BUTTON */
|
||||
@ -1119,41 +1114,24 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
#page-report-button:hover {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
#page-report-button:hover:active,
|
||||
#page-report-button[open="true"] {
|
||||
-moz-image-region: rect(0, 48px, 16px, 32px);
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
/* STAR BUTTON */
|
||||
#star-button {
|
||||
padding: 1px;
|
||||
-moz-padding-start: 4px;
|
||||
list-style-image: url("chrome://browser/skin/places/star-icons.png");
|
||||
-moz-image-region: rect(0, 16px, 16px, 0);
|
||||
}
|
||||
|
||||
#star-button:hover {
|
||||
#star-button:hover:active,
|
||||
#star-button[starred="true"] {
|
||||
-moz-image-region: rect(0, 32px, 16px, 16px);
|
||||
}
|
||||
|
||||
#star-button:hover:active {
|
||||
-moz-image-region: rect(0, 48px, 16px, 32px);
|
||||
}
|
||||
|
||||
#star-button[starred="true"] {
|
||||
-moz-image-region: rect(16px, 16px, 32px, 0);
|
||||
}
|
||||
|
||||
#star-button:hover[starred="true"] {
|
||||
-moz-image-region: rect(16px, 32px, 32px, 16px);
|
||||
}
|
||||
|
||||
#star-button:hover:active[starred="true"] {
|
||||
-moz-image-region: rect(16px, 48px, 32px, 32px);
|
||||
-moz-image-region: rect(0, 48px, 16px, 32px);
|
||||
}
|
||||
|
||||
/* BOOKMARKING PANEL */
|
||||
|
@ -14,7 +14,6 @@ browser.jar:
|
||||
skin/classic/browser/fullscreen-video.css
|
||||
skin/classic/browser/Geolocation-16.png
|
||||
skin/classic/browser/Geolocation-64.png
|
||||
skin/classic/browser/Go-arrow.png
|
||||
skin/classic/browser/home.png
|
||||
skin/classic/browser/hud-style-check-box-checked.png
|
||||
skin/classic/browser/hud-style-check-box-empty.png
|
||||
@ -45,6 +44,7 @@ browser.jar:
|
||||
skin/classic/browser/keyhole-circle.png
|
||||
skin/classic/browser/Toolbar.png
|
||||
skin/classic/browser/toolbarbutton-dropmarker.png
|
||||
skin/classic/browser/urlbar-history-dropmarker.png
|
||||
skin/classic/browser/urlbar-arrow.png
|
||||
skin/classic/browser/urlbar-popup-blocked.png
|
||||
skin/classic/browser/feeds/subscribe.css (feeds/subscribe.css)
|
||||
@ -76,7 +76,6 @@ browser.jar:
|
||||
skin/classic/browser/places/plus.png (places/plus.png)
|
||||
skin/classic/browser/places/plus-active.png (places/plus-active.png)
|
||||
skin/classic/browser/places/starPage.png (places/starPage.png)
|
||||
skin/classic/browser/places/pageStarred.png (places/pageStarred.png)
|
||||
skin/classic/browser/places/searching_16.png (places/searching_16.png)
|
||||
skin/classic/browser/places/starred48.png (places/starred48.png)
|
||||
skin/classic/browser/places/unstarred48.png (places/unstarred48.png)
|
||||
|
Before Width: | Height: | Size: 708 B |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 912 B |
BIN
browser/themes/pinstripe/browser/urlbar-history-dropmarker.png
Normal file
After Width: | Height: | Size: 389 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 758 B |
Before Width: | Height: | Size: 922 B |
Before Width: | Height: | Size: 665 B |
@ -1183,21 +1183,22 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
|
||||
|
||||
/* ::::: Location Bar ::::: */
|
||||
|
||||
#urlbar {
|
||||
width: 7em;
|
||||
min-width: 7em;
|
||||
}
|
||||
|
||||
#urlbar,
|
||||
.searchbar-textbox {
|
||||
-moz-appearance: none;
|
||||
margin: 1px 3px;
|
||||
padding: 2px;
|
||||
padding: 0;
|
||||
background-clip: padding-box;
|
||||
border: 1px solid ThreeDShadow;
|
||||
border-radius: 2.5px;
|
||||
}
|
||||
|
||||
#urlbar {
|
||||
width: 7em;
|
||||
min-width: 7em;
|
||||
-moz-padding-end: 2px;
|
||||
}
|
||||
|
||||
@media all and (-moz-windows-default-theme) {
|
||||
#urlbar,
|
||||
.searchbar-textbox {
|
||||
@ -1232,12 +1233,16 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
}
|
||||
|
||||
#urlbar-icons {
|
||||
height: 18px;
|
||||
-moz-box-align: center;
|
||||
}
|
||||
|
||||
.urlbar-icon {
|
||||
padding: 0 2px !important;
|
||||
padding: 3px 3px;
|
||||
}
|
||||
|
||||
.searchbar-engine-button,
|
||||
.search-go-container {
|
||||
padding: 2px 2px;
|
||||
}
|
||||
|
||||
.urlbar-icon:-moz-system-metric(touch-enabled) {
|
||||
@ -1245,6 +1250,15 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
padding: 0 3px !important;
|
||||
}
|
||||
|
||||
.urlbar-icon:hover {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,70%,.3), hsla(200,100%,70%,0));
|
||||
}
|
||||
|
||||
.urlbar-icon[open="true"],
|
||||
.urlbar-icon:hover:active {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,70%,.1), hsla(200,100%,70%,0));
|
||||
}
|
||||
|
||||
#urlbar-search-splitter {
|
||||
min-width: 6px;
|
||||
-moz-margin-start: -3px;
|
||||
@ -1258,8 +1272,6 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
}
|
||||
|
||||
#urlbar-display-box {
|
||||
margin-top: -2px;
|
||||
margin-bottom: -2px;
|
||||
-moz-border-end: 1px solid #AAA;
|
||||
-moz-margin-end: 3px;
|
||||
}
|
||||
@ -1277,8 +1289,6 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
box-shadow: 0 1px 0 hsla(0,0%,0%,.05) inset;
|
||||
-moz-border-end: 1px solid hsla(0,0%,0%,.1);
|
||||
padding: 2px;
|
||||
margin: -2px;
|
||||
-moz-margin-end: 0;
|
||||
}
|
||||
|
||||
#identity-box:-moz-locale-dir(ltr) {
|
||||
@ -1352,21 +1362,27 @@ html|*.urlbar-input:-moz-lwtheme:-moz-placeholder,
|
||||
|
||||
.urlbar-history-dropmarker {
|
||||
-moz-appearance: none;
|
||||
padding: 0 1px;
|
||||
padding: 0 3px;
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
width: auto;
|
||||
list-style-image: url(mainwindow-dropdown-arrow.png);
|
||||
-moz-image-region: rect(0, 13px, 11px, 0);
|
||||
list-style-image: url("chrome://browser/skin/urlbar-history-dropmarker.png");
|
||||
-moz-image-region: rect(0px, 11px, 14px, 0px);
|
||||
}
|
||||
|
||||
.urlbar-history-dropmarker:-moz-system-metric(touch-enabled) {
|
||||
min-width: 6.4mozmm;
|
||||
}
|
||||
|
||||
.urlbar-history-dropmarker:hover {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.3), hsla(205,100%,70%,0));
|
||||
-moz-image-region: rect(0px, 22px, 14px, 11px);
|
||||
}
|
||||
|
||||
.urlbar-history-dropmarker:hover:active,
|
||||
.urlbar-history-dropmarker[open="true"] {
|
||||
-moz-image-region: rect(0, 26px, 11px, 13px);
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(205,100%,70%,.1), hsla(205,100%,70%,0));
|
||||
-moz-image-region: rect(0px, 33px, 14px, 22px);
|
||||
}
|
||||
|
||||
/* page proxy icon */
|
||||
@ -1469,87 +1485,73 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
border-top: 1px solid GrayText;
|
||||
}
|
||||
|
||||
/* go button */
|
||||
/* combined go/reload/stop button in location bar */
|
||||
|
||||
#go-button {
|
||||
list-style-image: url("chrome://browser/skin/Go-arrow.png");
|
||||
-moz-image-region: rect(0px, 16px, 16px, 0px);
|
||||
#go-button,
|
||||
#urlbar > toolbarbutton {
|
||||
-moz-appearance: none;
|
||||
padding: 0 2px;
|
||||
background-origin: border-box;
|
||||
border: none;
|
||||
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
|
||||
}
|
||||
|
||||
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
#go-button {
|
||||
padding: 0 3px;
|
||||
}
|
||||
|
||||
#urlbar-reload-button {
|
||||
-moz-image-region: rect(0, 14px, 14px, 0);
|
||||
}
|
||||
|
||||
#urlbar-reload-button:not([disabled]):hover {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,70%,.2), hsla(200,100%,70%,0));
|
||||
-moz-image-region: rect(14px, 14px, 28px, 0);
|
||||
}
|
||||
|
||||
#urlbar-reload-button:not([disabled]):hover:active {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(200,100%,60%,.1), hsla(200,100%,60%,0));
|
||||
-moz-image-region: rect(28px, 14px, 42px, 0);
|
||||
}
|
||||
|
||||
#urlbar-reload-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#go-button:hover {
|
||||
-moz-image-region: rect(16px, 16px, 32px, 0px);
|
||||
}
|
||||
|
||||
/* combined go/reload/stop button in location bar */
|
||||
|
||||
#urlbar > toolbarbutton {
|
||||
-moz-appearance: none;
|
||||
list-style-image: url("chrome://browser/skin/reload-stop-go.png");
|
||||
margin: -2px;
|
||||
-moz-margin-start: 0;
|
||||
padding: 0 3px;
|
||||
background-origin: border-box;
|
||||
border: none;
|
||||
-moz-border-start: 1px solid rgba(0,0,0,.25);
|
||||
box-shadow: 0 1px 0 rgba(0,0,0,.1) inset,
|
||||
-1px -1px 1px rgba(255,255,255,.25) inset;
|
||||
}
|
||||
|
||||
#urlbar:-moz-locale-dir(ltr) > toolbarbutton {
|
||||
border-top-right-radius: 1.5px;
|
||||
border-bottom-right-radius: 1.5px;
|
||||
}
|
||||
|
||||
#urlbar:-moz-locale-dir(rtl) > toolbarbutton {
|
||||
border-top-left-radius: 1.5px;
|
||||
border-bottom-left-radius: 1.5px;
|
||||
}
|
||||
|
||||
#urlbar > toolbarbutton:not([disabled]):active:hover,
|
||||
#urlbar-reload-button:not(:hover) {
|
||||
-moz-border-start-style: none;
|
||||
-moz-padding-start: 4px;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
#urlbar > toolbarbutton:not([disabled]):active:hover {
|
||||
box-shadow: 0 0 6.5px rgba(0,0,0,.4) inset,
|
||||
0 0 2px rgba(0,0,0,.4) inset;
|
||||
}
|
||||
|
||||
#go-button,
|
||||
#urlbar-go-button {
|
||||
-moz-image-region: rect(0px, 56px, 14px, 42px);
|
||||
background-image: -moz-linear-gradient(rgb(115,213,115), rgb(96,190,96) 49%, rgb(82,174,82) 51%, rgb(79,155,79));
|
||||
-moz-image-region: rect(0, 42px, 14px, 28px);
|
||||
}
|
||||
|
||||
#go-button:hover,
|
||||
#urlbar-go-button:hover {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(110,70%,50%,.2), hsla(110,70%,50%,0));
|
||||
-moz-image-region: rect(14px, 42px, 28px, 28px);
|
||||
}
|
||||
|
||||
#go-button:hover:active,
|
||||
#urlbar-go-button:hover:active {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(110,70%,50%,.1), hsla(110,70%,50%,0));
|
||||
-moz-image-region: rect(28px, 42px, 42px, 28px);
|
||||
}
|
||||
|
||||
#go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon,
|
||||
#urlbar-go-button:-moz-locale-dir(rtl) > .toolbarbutton-icon {
|
||||
-moz-transform: scaleX(-1);
|
||||
}
|
||||
|
||||
#urlbar-go-button:hover {
|
||||
background-image: -moz-linear-gradient(rgb(96,221,96), rgb(71,191,71) 49%, rgb(54,171,54) 51%, rgb(50,147,50));
|
||||
}
|
||||
|
||||
#urlbar-reload-button {
|
||||
-moz-image-region: rect(0px, 14px, 14px, 0px);
|
||||
}
|
||||
|
||||
#urlbar-reload-button:not([disabled]):hover {
|
||||
-moz-image-region: rect(0px, 28px, 14px, 14px);
|
||||
background-image: -moz-linear-gradient(rgb(162,207,241), rgb(111,178,225) 49%, rgb(91,159,217) 51%, rgb(62,138,200));
|
||||
}
|
||||
|
||||
#urlbar-stop-button {
|
||||
-moz-image-region: rect(0px, 42px, 14px, 28px);
|
||||
background-image: -moz-linear-gradient(rgb(231,162,140), rgb(209,119,100) 49%, rgb(193,92,78) 51%, rgb(173,72,58));
|
||||
-moz-image-region: rect(0, 28px, 14px, 14px);
|
||||
}
|
||||
|
||||
#urlbar-stop-button:hover {
|
||||
background-image: -moz-linear-gradient(rgb(244,156,128), rgb(215,101,77) 49%, rgb(194,66,48) 51%, rgb(170,41,23));
|
||||
#urlbar-stop-button:not([disabled]):hover {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(5,100%,75%,.3), hsla(5,100%,75%,0));
|
||||
-moz-image-region: rect(14px, 28px, 28px, 14px);
|
||||
}
|
||||
|
||||
#urlbar-stop-button:hover:active {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(5,100%,75%,.1), hsla(5,100%,75%,0));
|
||||
-moz-image-region: rect(28px, 28px, 42px, 14px);
|
||||
}
|
||||
|
||||
/* popup blocker button */
|
||||
@ -1576,10 +1578,12 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
|
||||
}
|
||||
|
||||
#star-button:hover {
|
||||
-moz-image-region: rect(0px 32px 16px 16px);
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(45,100%,73%,.3), hsla(45,100%,73%,0));
|
||||
-moz-image-region: rect(0px 32px 16px 16px);
|
||||
}
|
||||
|
||||
#star-button:hover:active {
|
||||
background-image: -moz-radial-gradient(center, circle closest-side, hsla(45,100%,73%,.1), hsla(45,100%,73%,0));
|
||||
-moz-image-region: rect(0px 48px 16px 32px);
|
||||
}
|
||||
|
||||
@ -2225,8 +2229,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
|
||||
border-radius: 2.5px 0 0 2.5px;
|
||||
-moz-border-image: url("chrome://browser/skin/urlbar-arrow.png") 0 8 0 0 / 0 8px 0 0;
|
||||
-moz-margin-end: -8px;
|
||||
margin-top: -2px;
|
||||
margin-bottom: -2px;
|
||||
}
|
||||
|
||||
#notification-popup-box:not([hidden]) + #identity-box {
|
||||
|
@ -37,7 +37,6 @@ browser.jar:
|
||||
skin/classic/browser/Secure24.png (Secure24.png)
|
||||
skin/classic/browser/Toolbar.png (Toolbar.png)
|
||||
skin/classic/browser/Toolbar-inverted.png
|
||||
skin/classic/browser/Go-arrow.png (Go-arrow.png)
|
||||
* skin/classic/browser/searchbar.css (searchbar.css)
|
||||
skin/classic/browser/section_collapsed.png
|
||||
skin/classic/browser/section_collapsed-rtl.png
|
||||
@ -49,6 +48,7 @@ browser.jar:
|
||||
skin/classic/browser/monitor_16-10.png
|
||||
skin/classic/browser/urlbar-arrow.png
|
||||
skin/classic/browser/urlbar-popup-blocked.png
|
||||
skin/classic/browser/urlbar-history-dropmarker.png
|
||||
skin/classic/browser/feeds/feedIcon.png (feeds/feedIcon.png)
|
||||
skin/classic/browser/feeds/feedIcon16.png (feeds/feedIcon16.png)
|
||||
skin/classic/browser/feeds/audioFeedIcon.png (feeds/audioFeedIcon.png)
|
||||
@ -159,7 +159,6 @@ browser.jar:
|
||||
skin/classic/aero/browser/Secure24.png (Secure24-aero.png)
|
||||
skin/classic/aero/browser/Toolbar.png
|
||||
skin/classic/aero/browser/Toolbar-inverted.png
|
||||
skin/classic/aero/browser/Go-arrow.png (Go-arrow-aero.png)
|
||||
* skin/classic/aero/browser/searchbar.css (searchbar.css)
|
||||
skin/classic/aero/browser/section_collapsed.png
|
||||
skin/classic/aero/browser/section_collapsed-rtl.png
|
||||
@ -171,6 +170,7 @@ browser.jar:
|
||||
skin/classic/aero/browser/monitor_16-10.png
|
||||
skin/classic/aero/browser/urlbar-arrow.png
|
||||
skin/classic/aero/browser/urlbar-popup-blocked.png
|
||||
skin/classic/aero/browser/urlbar-history-dropmarker.png
|
||||
skin/classic/aero/browser/feeds/feedIcon.png (feeds/feedIcon-aero.png)
|
||||
skin/classic/aero/browser/feeds/feedIcon16.png (feeds/feedIcon16-aero.png)
|
||||
skin/classic/aero/browser/feeds/audioFeedIcon.png (feeds/audioFeedIcon-aero.png)
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
browser/themes/winstripe/browser/urlbar-history-dropmarker.png
Normal file
After Width: | Height: | Size: 480 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 745 B |
@ -1060,14 +1060,24 @@ sub makeUniversalInternal($$$$) {
|
||||
return 1;
|
||||
}
|
||||
elsif($aSourceFile->lIsRegularFile()) {
|
||||
my ($machPPC, $machX86);
|
||||
my ($machPPC, $machX86, $fileName);
|
||||
if (!defined($filePPC) || !defined($fileX86)) {
|
||||
# One of the source files isn't present. The right thing to do is
|
||||
# to just copy what does exist straight over, so skip Mach-O checks.
|
||||
$machPPC = 0;
|
||||
$machX86 = 0;
|
||||
if (defined($filePPC)) {
|
||||
$fileName = $filePPC;
|
||||
} elsif (defined($fileX86)) {
|
||||
$fileName = $fileX86;
|
||||
} else {
|
||||
complain(1, "The file must exist in at least one directory");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
# both files exist, pick the name of one.
|
||||
$fileName = $fileX86;
|
||||
if (!defined($machPPC=$filePPC->isMachO())) {
|
||||
return complain(1, 'makeUniversal: isFileMachO ppc failed for:',
|
||||
$filePPC->path());
|
||||
@ -1089,7 +1099,7 @@ sub makeUniversalInternal($$$$) {
|
||||
return makeUniversalFile($filePPC, $fileX86, $fileTargetPath);
|
||||
}
|
||||
|
||||
if (grep { $filePPC->path() =~ m/$_/; } @gSortMatches) {
|
||||
if (grep { $fileName->path() =~ m/$_/; } @gSortMatches) {
|
||||
# Regular files, but should be compared with sorting first.
|
||||
# copyIfIdenticalWhenSorted will print an error if it fails.
|
||||
return copyIfIdenticalWhenSorted($filePPC, $fileX86, $fileTargetPath);
|
||||
|
@ -40,7 +40,6 @@ asm/signal.h
|
||||
ASRegistry.h
|
||||
assert.h
|
||||
atk/atk.h
|
||||
atlbase.h
|
||||
atlcom.h
|
||||
atlconv.h
|
||||
atlctl.cpp
|
||||
|
20
configure.in
@ -2316,13 +2316,6 @@ ia64*-hpux*)
|
||||
cygwin*|msvc*|mks*)
|
||||
AC_MSG_ERROR([Using a Cygwin build environment is unsupported. Configure cannot check for presence of necessary headers. Please upgrade to MozillaBuild; see https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_HEADERS(oleacc.idl)
|
||||
AC_LANG_SAVE
|
||||
AC_LANG_CPLUSPLUS
|
||||
MOZ_CHECK_HEADERS(atlbase.h)
|
||||
AC_LANG_RESTORE
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
@ -5254,19 +5247,6 @@ if test "$ACCESSIBILITY"; then
|
||||
AC_DEFINE(ACCESSIBILITY)
|
||||
fi
|
||||
|
||||
if test -n "$ACCESSIBILITY" -a "$COMPILE_ENVIRONMENT" = "1"; then
|
||||
case "$target" in
|
||||
*-mingw*)
|
||||
if test "$ac_cv_header_atlbase_h" = "no"; then
|
||||
AC_MSG_ERROR([System header atlbase.h is not available. See http://developer.mozilla.org/en/docs/atlbase.h for details on fixing this problem.])
|
||||
fi
|
||||
if test "$ac_cv_header_oleacc_idl" = "no"; then
|
||||
AC_MSG_ERROR([System header oleacc.idl is not available. See http://developer.mozilla.org/en/docs/oleacc.idl for details on fixing this problem.])
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Disable printing
|
||||
dnl ========================================================
|
||||
|
20
content/base/crashtests/682463.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
|
||||
function boom()
|
||||
{
|
||||
var j = document.createTextNode("j");
|
||||
var r = document.createRange();
|
||||
r.setEnd(j, 1);
|
||||
j.splitText(0);
|
||||
r.setEnd(j, 0);
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="boom();"></body>
|
||||
|
||||
</html>
|
@ -95,3 +95,4 @@ load 658845-1.svg
|
||||
load 667336-1.html
|
||||
load 679459.html
|
||||
load 679689-1.html
|
||||
load 682463.html
|
||||
|
@ -1902,6 +1902,7 @@ GK_ATOM(_moz_maemo_classic, "-moz-maemo-classic")
|
||||
GK_ATOM(_moz_menubar_drag, "-moz-menubar-drag")
|
||||
GK_ATOM(_moz_device_pixel_ratio, "-moz-device-pixel-ratio")
|
||||
GK_ATOM(_moz_device_orientation, "-moz-device-orientation")
|
||||
GK_ATOM(_moz_is_resource_document, "-moz-is-resource-document")
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
GK_ATOM(anonid, "anonid")
|
||||
|
@ -271,6 +271,12 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
|
||||
{
|
||||
NS_ASSERTION(mIsPositioned, "shouldn't be notified if not positioned");
|
||||
|
||||
nsINode* newRoot = nsnull;
|
||||
nsINode* newStartNode = nsnull;
|
||||
nsINode* newEndNode = nsnull;
|
||||
PRUint32 newStartOffset = 0;
|
||||
PRUint32 newEndOffset = 0;
|
||||
|
||||
// If the changed node contains our start boundary and the change starts
|
||||
// before the boundary we'll need to adjust the offset.
|
||||
if (aContent == mStartParent &&
|
||||
@ -282,8 +288,11 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
|
||||
"only a split can start before the end");
|
||||
NS_ASSERTION(static_cast<PRUint32>(mStartOffset) <= aInfo->mChangeEnd,
|
||||
"mStartOffset is beyond the end of this node");
|
||||
mStartOffset = static_cast<PRUint32>(mStartOffset) - aInfo->mChangeStart;
|
||||
mStartParent = aInfo->mDetails->mNextSibling;
|
||||
newStartOffset = static_cast<PRUint32>(mStartOffset) - aInfo->mChangeStart;
|
||||
newStartNode = aInfo->mDetails->mNextSibling;
|
||||
if (NS_UNLIKELY(aContent == mRoot)) {
|
||||
newRoot = IsValidBoundary(newStartNode);
|
||||
}
|
||||
} else {
|
||||
// If boundary is inside changed text, position it before change
|
||||
// else adjust start offset for the change in length.
|
||||
@ -294,17 +303,20 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
|
||||
}
|
||||
}
|
||||
|
||||
// Do the same thing for the end boundary.
|
||||
if (aContent == mEndParent && aInfo->mChangeStart < static_cast<PRUint32>(mEndOffset)) {
|
||||
if (aInfo->mDetails) {
|
||||
// Do the same thing for the end boundary, except for splitText of a node
|
||||
// with no parent then only switch to the new node if the start boundary
|
||||
// did so too (otherwise the range would end up with disconnected nodes).
|
||||
if (aContent == mEndParent &&
|
||||
aInfo->mChangeStart < static_cast<PRUint32>(mEndOffset)) {
|
||||
if (aInfo->mDetails && (aContent->GetParent() || newStartNode)) {
|
||||
// splitText(), aInfo->mDetails->mNextSibling is the new text node
|
||||
NS_ASSERTION(aInfo->mDetails->mType ==
|
||||
CharacterDataChangeInfo::Details::eSplit,
|
||||
"only a split can start before the end");
|
||||
NS_ASSERTION(static_cast<PRUint32>(mEndOffset) <= aInfo->mChangeEnd,
|
||||
"mEndOffset is beyond the end of this node");
|
||||
mEndOffset = static_cast<PRUint32>(mEndOffset) - aInfo->mChangeStart;
|
||||
mEndParent = aInfo->mDetails->mNextSibling;
|
||||
newEndOffset = static_cast<PRUint32>(mEndOffset) - aInfo->mChangeStart;
|
||||
newEndNode = aInfo->mDetails->mNextSibling;
|
||||
} else {
|
||||
mEndOffset = static_cast<PRUint32>(mEndOffset) <= aInfo->mChangeEnd ?
|
||||
aInfo->mChangeStart :
|
||||
@ -319,14 +331,36 @@ nsRange::CharacterDataChanged(nsIDocument* aDocument,
|
||||
// that will be removed
|
||||
nsIContent* removed = aInfo->mDetails->mNextSibling;
|
||||
if (removed == mStartParent) {
|
||||
mStartOffset = static_cast<PRUint32>(mStartOffset) + aInfo->mChangeStart;
|
||||
mStartParent = aContent;
|
||||
newStartOffset = static_cast<PRUint32>(mStartOffset) + aInfo->mChangeStart;
|
||||
newStartNode = aContent;
|
||||
if (NS_UNLIKELY(removed == mRoot)) {
|
||||
newRoot = IsValidBoundary(newStartNode);
|
||||
}
|
||||
}
|
||||
if (removed == mEndParent) {
|
||||
mEndOffset = static_cast<PRUint32>(mEndOffset) + aInfo->mChangeStart;
|
||||
mEndParent = aContent;
|
||||
newEndOffset = static_cast<PRUint32>(mEndOffset) + aInfo->mChangeStart;
|
||||
newEndNode = aContent;
|
||||
if (NS_UNLIKELY(removed == mRoot)) {
|
||||
newRoot = IsValidBoundary(newEndNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (newStartNode || newEndNode) {
|
||||
if (!newStartNode) {
|
||||
newStartNode = mStartParent;
|
||||
newStartOffset = mStartOffset;
|
||||
}
|
||||
if (!newEndNode) {
|
||||
newEndNode = mEndParent;
|
||||
newEndOffset = mEndOffset;
|
||||
}
|
||||
DoSetRange(newStartNode, newStartOffset, newEndNode, newEndOffset,
|
||||
newRoot ? newRoot : mRoot.get()
|
||||
#ifdef DEBUG
|
||||
, !newEndNode->GetParent()
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -473,12 +507,16 @@ static PRUint32 GetNodeLength(nsINode *aNode)
|
||||
void
|
||||
nsRange::DoSetRange(nsINode* aStartN, PRInt32 aStartOffset,
|
||||
nsINode* aEndN, PRInt32 aEndOffset,
|
||||
nsINode* aRoot)
|
||||
nsINode* aRoot
|
||||
#ifdef DEBUG
|
||||
, bool aNotInsertedYet
|
||||
#endif
|
||||
)
|
||||
{
|
||||
NS_PRECONDITION((aStartN && aEndN && aRoot) ||
|
||||
(!aStartN && !aEndN && !aRoot),
|
||||
"Set all or none");
|
||||
NS_PRECONDITION(!aRoot ||
|
||||
NS_PRECONDITION(!aRoot || aNotInsertedYet ||
|
||||
(nsContentUtils::ContentIsDescendantOf(aStartN, aRoot) &&
|
||||
nsContentUtils::ContentIsDescendantOf(aEndN, aRoot) &&
|
||||
aRoot == IsValidBoundary(aStartN) &&
|
||||
|
@ -149,7 +149,13 @@ public:
|
||||
protected:
|
||||
void DoSetRange(nsINode* aStartN, PRInt32 aStartOffset,
|
||||
nsINode* aEndN, PRInt32 aEndOffset,
|
||||
nsINode* aRoot);
|
||||
nsINode* aRoot
|
||||
#ifdef DEBUG
|
||||
// CharacterDataChanged use this to disable an assertion since
|
||||
// the new text node of a splitText hasn't been inserted yet.
|
||||
, bool aNotInsertedYet = false
|
||||
#endif
|
||||
);
|
||||
};
|
||||
|
||||
// Make a new nsIDOMRange object
|
||||
|
@ -418,18 +418,20 @@ NS_IMPL_RELEASE_INHERITED(nsXMLHttpRequestUpload, nsXHREventTarget)
|
||||
/////////////////////////////////////////////
|
||||
|
||||
nsXMLHttpRequest::nsXMLHttpRequest()
|
||||
: mResponseType(XML_HTTP_RESPONSE_TYPE_DEFAULT),
|
||||
: mResponseBodyDecodedPos(0),
|
||||
mResponseType(XML_HTTP_RESPONSE_TYPE_DEFAULT),
|
||||
mRequestObserver(nsnull), mState(XML_HTTP_REQUEST_UNSENT),
|
||||
mUploadTransferred(0), mUploadTotal(0), mUploadComplete(PR_TRUE),
|
||||
mProgressSinceLastProgressEvent(PR_FALSE),
|
||||
mUploadProgress(0), mUploadProgressMax(0),
|
||||
mErrorLoad(PR_FALSE), mTimerIsActive(PR_FALSE),
|
||||
mProgressEventWasDelayed(PR_FALSE),
|
||||
mLoadLengthComputable(PR_FALSE), mLoadTotal(0),
|
||||
mFirstStartRequestSeen(PR_FALSE),
|
||||
mResultArrayBuffer(nsnull),
|
||||
mResultJSON(JSVAL_VOID)
|
||||
mInLoadProgressEvent(PR_FALSE),
|
||||
mResultJSON(JSVAL_VOID),
|
||||
mResultArrayBuffer(nsnull)
|
||||
{
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
nsLayoutStatics::AddRef();
|
||||
}
|
||||
|
||||
@ -554,6 +556,19 @@ nsXMLHttpRequest::Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::ResetResponse()
|
||||
{
|
||||
mResponseXML = nsnull;
|
||||
mResponseBody.Truncate();
|
||||
mResponseText.Truncate();
|
||||
mResponseBlob = nsnull;
|
||||
mResultArrayBuffer = nsnull;
|
||||
mResultJSON = JSVAL_VOID;
|
||||
mLoadTransferred = 0;
|
||||
mResponseBodyDecodedPos = 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::SetRequestObserver(nsIRequestObserver* aObserver)
|
||||
{
|
||||
@ -702,162 +717,168 @@ nsXMLHttpRequest::GetResponseXML(nsIDOMDocument **aResponseXML)
|
||||
* from HTTP headers.
|
||||
*/
|
||||
nsresult
|
||||
nsXMLHttpRequest::DetectCharset(nsACString& aCharset)
|
||||
nsXMLHttpRequest::DetectCharset()
|
||||
{
|
||||
aCharset.Truncate();
|
||||
nsresult rv;
|
||||
nsCAutoString charsetVal;
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(mReadRequest));
|
||||
mResponseCharset.Truncate();
|
||||
mDecoder = nsnull;
|
||||
|
||||
if (mResponseType != XML_HTTP_RESPONSE_TYPE_DEFAULT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_TEXT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_JSON &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel = do_QueryInterface(mReadRequest);
|
||||
if (!channel) {
|
||||
channel = mChannel;
|
||||
if (!channel) {
|
||||
// There will be no mChannel when we got a necko error in
|
||||
// OnStopRequest or if we were never sent.
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsCAutoString charsetVal;
|
||||
nsresult rv = channel ? channel->GetContentCharset(charsetVal) :
|
||||
NS_ERROR_FAILURE;
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsICharsetAlias> calias =
|
||||
do_GetService(NS_CHARSETALIAS_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv) && calias) {
|
||||
rv = calias->GetPreferred(charsetVal, mResponseCharset);
|
||||
}
|
||||
}
|
||||
|
||||
rv = channel->GetContentCharset(charsetVal);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsICharsetAlias> calias(do_GetService(NS_CHARSETALIAS_CONTRACTID,&rv));
|
||||
if(NS_SUCCEEDED(rv) && calias) {
|
||||
rv = calias->GetPreferred(charsetVal, aCharset);
|
||||
}
|
||||
if (NS_FAILED(rv) || mResponseCharset.IsEmpty()) {
|
||||
// MS documentation states UTF-8 is default for responseText
|
||||
mResponseCharset.AssignLiteral("UTF-8");
|
||||
}
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return ccm->GetUnicodeDecoderRaw(mResponseCharset.get(),
|
||||
getter_AddRefs(mDecoder));
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXMLHttpRequest::ConvertBodyToText(nsAString& aOutBuffer)
|
||||
nsXMLHttpRequest::AppendToResponseText(const char * aSrcBuffer,
|
||||
PRUint32 aSrcBufferLen)
|
||||
{
|
||||
NS_ENSURE_STATE(mDecoder);
|
||||
|
||||
PRInt32 destBufferLen;
|
||||
nsresult rv = mDecoder->GetMaxLength(aSrcBuffer, aSrcBufferLen,
|
||||
&destBufferLen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!mResponseText.SetCapacity(mResponseText.Length() + destBufferLen)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
PRUnichar* destBuffer = mResponseText.BeginWriting() + mResponseText.Length();
|
||||
|
||||
PRInt32 totalChars = mResponseText.Length();
|
||||
|
||||
// This code here is basically a copy of a similar thing in
|
||||
// nsScanner::Append(const char* aBuffer, PRUint32 aLen).
|
||||
// If we get illegal characters in the input we replace
|
||||
// them and don't just fail.
|
||||
if (!mResponseBodyUnicode.IsVoid()) {
|
||||
aOutBuffer = mResponseBodyUnicode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRInt32 dataLen = mResponseBody.Length();
|
||||
if (!dataLen) {
|
||||
mResponseBodyUnicode.SetIsVoid(PR_FALSE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsCAutoString dataCharset;
|
||||
nsCOMPtr<nsIDocument> document(do_QueryInterface(mResponseXML));
|
||||
if (document) {
|
||||
dataCharset = document->GetDocumentCharacterSet();
|
||||
} else {
|
||||
if (NS_FAILED(DetectCharset(dataCharset)) || dataCharset.IsEmpty()) {
|
||||
// MS documentation states UTF-8 is default for responseText
|
||||
dataCharset.AssignLiteral("UTF-8");
|
||||
}
|
||||
}
|
||||
|
||||
// XXXbz is the charset ever "ASCII" as opposed to "us-ascii"?
|
||||
if (dataCharset.EqualsLiteral("ASCII")) {
|
||||
CopyASCIItoUTF16(mResponseBody, mResponseBodyUnicode);
|
||||
aOutBuffer = mResponseBodyUnicode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// can't fast-path UTF-8 using CopyUTF8toUTF16, since above we assumed UTF-8
|
||||
// by default and CopyUTF8toUTF16 will stop if it encounters bytes that aren't
|
||||
// valid UTF-8. So we have to do the whole unicode decoder thing.
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIUnicodeDecoder> decoder;
|
||||
rv = ccm->GetUnicodeDecoderRaw(dataCharset.get(),
|
||||
getter_AddRefs(decoder));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
const char * inBuffer = mResponseBody.get();
|
||||
PRInt32 outBufferLength;
|
||||
rv = decoder->GetMaxLength(inBuffer, dataLen, &outBufferLength);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsStringBuffer* buf =
|
||||
nsStringBuffer::Alloc((outBufferLength + 1) * sizeof(PRUnichar));
|
||||
if (!buf) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
PRUnichar* outBuffer = static_cast<PRUnichar*>(buf->Data());
|
||||
|
||||
PRInt32 totalChars = 0,
|
||||
outBufferIndex = 0,
|
||||
outLen = outBufferLength;
|
||||
|
||||
do {
|
||||
PRInt32 inBufferLength = dataLen;
|
||||
rv = decoder->Convert(inBuffer,
|
||||
&inBufferLength,
|
||||
&outBuffer[outBufferIndex],
|
||||
&outLen);
|
||||
totalChars += outLen;
|
||||
PRInt32 srclen = (PRInt32)aSrcBufferLen;
|
||||
PRInt32 destlen = (PRInt32)destBufferLen;
|
||||
rv = mDecoder->Convert(aSrcBuffer,
|
||||
&srclen,
|
||||
destBuffer,
|
||||
&destlen);
|
||||
if (NS_FAILED(rv)) {
|
||||
// We consume one byte, replace it with U+FFFD
|
||||
// and try the conversion again.
|
||||
outBuffer[outBufferIndex + outLen++] = (PRUnichar)0xFFFD;
|
||||
outBufferIndex += outLen;
|
||||
outLen = outBufferLength - (++totalChars);
|
||||
|
||||
decoder->Reset();
|
||||
destBuffer[destlen] = (PRUnichar)0xFFFD; // add replacement character
|
||||
destlen++; // skip written replacement character
|
||||
destBuffer += destlen;
|
||||
destBufferLen -= destlen;
|
||||
|
||||
if((inBufferLength + 1) > dataLen) {
|
||||
inBufferLength = dataLen;
|
||||
} else {
|
||||
inBufferLength++;
|
||||
if (srclen < (PRInt32)aSrcBufferLen) {
|
||||
srclen++; // Consume the invalid character
|
||||
}
|
||||
aSrcBuffer += srclen;
|
||||
aSrcBufferLen -= srclen;
|
||||
|
||||
inBuffer = &inBuffer[inBufferLength];
|
||||
dataLen -= inBufferLength;
|
||||
mDecoder->Reset();
|
||||
}
|
||||
} while ( NS_FAILED(rv) && (dataLen > 0) );
|
||||
|
||||
// Use the string buffer if it is small, or doesn't contain
|
||||
// too much extra data.
|
||||
if (outBufferLength < 127 ||
|
||||
(outBufferLength * 0.9) < totalChars) {
|
||||
outBuffer[totalChars] = PRUnichar(0);
|
||||
// Move ownership to mResponseBodyUnicode.
|
||||
buf->ToString(totalChars, mResponseBodyUnicode, PR_TRUE);
|
||||
} else {
|
||||
mResponseBodyUnicode.Assign(outBuffer, totalChars);
|
||||
buf->Release();
|
||||
}
|
||||
aOutBuffer = mResponseBodyUnicode;
|
||||
totalChars += destlen;
|
||||
|
||||
} while (NS_FAILED(rv) && aSrcBufferLen > 0);
|
||||
|
||||
mResponseText.SetLength(totalChars);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* readonly attribute AString responseText; */
|
||||
NS_IMETHODIMP nsXMLHttpRequest::GetResponseText(nsAString& aResponseText)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
aResponseText.Truncate();
|
||||
|
||||
if (mResponseType != XML_HTTP_RESPONSE_TYPE_DEFAULT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_TEXT) {
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_TEXT &&
|
||||
mResponseType != XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
|
||||
if (mState & (XML_HTTP_REQUEST_DONE |
|
||||
XML_HTTP_REQUEST_LOADING)) {
|
||||
rv = ConvertBodyToText(aResponseText);
|
||||
if (mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT &&
|
||||
!mInLoadProgressEvent) {
|
||||
aResponseText.SetIsVoid(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
if (!(mState & (XML_HTTP_REQUEST_DONE | XML_HTTP_REQUEST_LOADING))) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// We only decode text lazily if we're also parsing to a doc.
|
||||
// Also, if we've decoded all current data already, then no need to decode
|
||||
// more.
|
||||
if (!mResponseXML ||
|
||||
mResponseBodyDecodedPos == mResponseBody.Length()) {
|
||||
aResponseText = mResponseText;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(mResponseXML);
|
||||
if (mResponseCharset != document->GetDocumentCharacterSet()) {
|
||||
mResponseCharset == document->GetDocumentCharacterSet();
|
||||
mResponseText.Truncate();
|
||||
mResponseBodyDecodedPos = 0;
|
||||
|
||||
nsCOMPtr<nsICharsetConverterManager> ccm =
|
||||
do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = ccm->GetUnicodeDecoderRaw(mResponseCharset.get(),
|
||||
getter_AddRefs(mDecoder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
NS_ASSERTION(mResponseBodyDecodedPos < mResponseBody.Length(),
|
||||
"Unexpected mResponseBodyDecodedPos");
|
||||
rv = AppendToResponseText(mResponseBody.get() + mResponseBodyDecodedPos,
|
||||
mResponseBody.Length() - mResponseBodyDecodedPos);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mResponseBodyDecodedPos = mResponseBody.Length();
|
||||
|
||||
if (mState & XML_HTTP_REQUEST_DONE) {
|
||||
// Free memory buffer which we no longer need
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyDecodedPos = 0;
|
||||
}
|
||||
|
||||
aResponseText = mResponseText;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -867,11 +888,9 @@ nsXMLHttpRequest::CreateResponseParsedJSON(JSContext* aCx)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsString bodyString;
|
||||
ConvertBodyToText(bodyString);
|
||||
if (!JS_ParseJSON(aCx,
|
||||
(jschar*)PromiseFlatString(bodyString).get(),
|
||||
bodyString.Length(), &mResultJSON)) {
|
||||
(jschar*)mResponseText.get(),
|
||||
mResponseText.Length(), &mResultJSON)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
@ -923,6 +942,12 @@ NS_IMETHODIMP nsXMLHttpRequest::GetResponseType(nsAString& aResponseType)
|
||||
case XML_HTTP_RESPONSE_TYPE_JSON:
|
||||
aResponseType.AssignLiteral("moz-json");
|
||||
break;
|
||||
case XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT:
|
||||
aResponseType.AssignLiteral("moz-chunked-text");
|
||||
break;
|
||||
case XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER:
|
||||
aResponseType.AssignLiteral("moz-chunked-arraybuffer");
|
||||
break;
|
||||
default:
|
||||
NS_ERROR("Should not happen");
|
||||
}
|
||||
@ -952,6 +977,16 @@ NS_IMETHODIMP nsXMLHttpRequest::SetResponseType(const nsAString& aResponseType)
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_TEXT;
|
||||
} else if (aResponseType.EqualsLiteral("moz-json")) {
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_JSON;
|
||||
} else if (aResponseType.EqualsLiteral("moz-chunked-text")) {
|
||||
if (!(mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT;
|
||||
} else if (aResponseType.EqualsLiteral("moz-chunked-arraybuffer")) {
|
||||
if (!(mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
mResponseType = XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER;
|
||||
}
|
||||
// If the given value is not the empty string, "arraybuffer",
|
||||
// "blob", "document", or "text" terminate these steps.
|
||||
@ -979,20 +1014,29 @@ NS_IMETHODIMP nsXMLHttpRequest::GetResponse(JSContext *aCx, jsval *aResult)
|
||||
switch (mResponseType) {
|
||||
case XML_HTTP_RESPONSE_TYPE_DEFAULT:
|
||||
case XML_HTTP_RESPONSE_TYPE_TEXT:
|
||||
case XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT:
|
||||
{
|
||||
nsString str;
|
||||
rv = GetResponseText(str);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsStringBuffer* buf;
|
||||
*aResult = XPCStringConvert::ReadableToJSVal(aCx, str, &buf);
|
||||
if (buf) {
|
||||
str.ForgetSharedBuffer();
|
||||
if (str.IsVoid()) {
|
||||
*aResult = JSVAL_NULL;
|
||||
} else {
|
||||
nsStringBuffer* buf;
|
||||
*aResult = XPCStringConvert::ReadableToJSVal(aCx, str, &buf);
|
||||
if (buf) {
|
||||
str.ForgetSharedBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER:
|
||||
if (mState & XML_HTTP_REQUEST_DONE) {
|
||||
case XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER:
|
||||
if ((mResponseType == XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER &&
|
||||
mState & XML_HTTP_REQUEST_DONE) ||
|
||||
(mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER &&
|
||||
mInLoadProgressEvent)) {
|
||||
if (!mResultArrayBuffer) {
|
||||
rv = CreateResponseArrayBuffer(aCx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1029,8 +1073,7 @@ NS_IMETHODIMP nsXMLHttpRequest::GetResponse(JSContext *aCx, jsval *aResult)
|
||||
rv = CreateResponseParsedJSON(aCx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
mResponseText.Truncate();
|
||||
}
|
||||
*aResult = mResultJSON;
|
||||
} else {
|
||||
@ -1125,14 +1168,9 @@ nsXMLHttpRequest::Abort()
|
||||
if (mCORSPreflightChannel) {
|
||||
mCORSPreflightChannel->Cancel(NS_BINDING_ABORTED);
|
||||
}
|
||||
mResponseXML = nsnull;
|
||||
PRUint32 responseLength = mResponseBody.Length();
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
mResponseBlob = nsnull;
|
||||
ResetResponse();
|
||||
mState |= XML_HTTP_REQUEST_ABORTED;
|
||||
mResultArrayBuffer = nsnull;
|
||||
mResultJSON = JSVAL_VOID;
|
||||
|
||||
if (!(mState & (XML_HTTP_REQUEST_UNSENT |
|
||||
XML_HTTP_REQUEST_OPENED |
|
||||
@ -1327,7 +1365,9 @@ nsXMLHttpRequest::DispatchProgressEvent(nsDOMEventTargetHelper* aTarget,
|
||||
PRUint64 aPosition, PRUint64 aTotalSize)
|
||||
{
|
||||
NS_ASSERTION(aTarget, "null target");
|
||||
if (aType.IsEmpty() ||
|
||||
NS_ASSERTION(!aType.IsEmpty(), "missing event type");
|
||||
|
||||
if (NS_FAILED(CheckInnerWindowCorrectness()) ||
|
||||
(!AllowUploadProgress() &&
|
||||
(aTarget == mUpload || aType.EqualsLiteral(UPLOADPROGRESS_STR)))) {
|
||||
return;
|
||||
@ -1591,19 +1631,28 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
|
||||
|
||||
if (xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB &&
|
||||
xmlHttpRequest->mResponseBlob) {
|
||||
xmlHttpRequest->ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
*writeCount = count;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (xmlHttpRequest->mResponseType != XML_HTTP_RESPONSE_TYPE_DOCUMENT) {
|
||||
if ((xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT &&
|
||||
xmlHttpRequest->mResponseXML) ||
|
||||
xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_ARRAYBUFFER ||
|
||||
xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_BLOB ||
|
||||
xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER) {
|
||||
// Copy for our own use
|
||||
PRUint32 previousLength = xmlHttpRequest->mResponseBody.Length();
|
||||
xmlHttpRequest->mResponseBody.Append(fromRawSegment,count);
|
||||
if (count > 0 && xmlHttpRequest->mResponseBody.Length() == previousLength) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
xmlHttpRequest->mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
} else if (xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||
|
||||
xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_TEXT ||
|
||||
xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_JSON ||
|
||||
xmlHttpRequest->mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT) {
|
||||
NS_ASSERTION(!xmlHttpRequest->mResponseXML,
|
||||
"We shouldn't be parsing a doc here");
|
||||
xmlHttpRequest->AppendToResponseText(fromRawSegment, count);
|
||||
}
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
@ -1632,8 +1681,6 @@ nsXMLHttpRequest::StreamReaderFunc(nsIInputStream* in,
|
||||
}
|
||||
}
|
||||
|
||||
xmlHttpRequest->ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*writeCount = count;
|
||||
} else {
|
||||
@ -1666,13 +1713,15 @@ void nsXMLHttpRequest::CreateResponseBlob(nsIRequest *request)
|
||||
mResponseBlob =
|
||||
new nsDOMFileFile(file, NS_ConvertASCIItoUTF16(contentType), cacheToken);
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* void onDataAvailable (in nsIRequest request, in nsISupports ctxt, in nsIInputStream inStr, in unsigned long sourceOffset, in unsigned long count); */
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInputStream *inStr, PRUint32 sourceOffset, PRUint32 count)
|
||||
nsXMLHttpRequest::OnDataAvailable(nsIRequest *request,
|
||||
nsISupports *ctxt,
|
||||
nsIInputStream *inStr,
|
||||
PRUint32 sourceOffset,
|
||||
PRUint32 count)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(inStr);
|
||||
|
||||
@ -1682,8 +1731,20 @@ nsXMLHttpRequest::OnDataAvailable(nsIRequest *request, nsISupports *ctxt, nsIInp
|
||||
CreateResponseBlob(request);
|
||||
}
|
||||
|
||||
mProgressSinceLastProgressEvent = PR_TRUE;
|
||||
|
||||
PRUint32 totalRead;
|
||||
return inStr->ReadSegments(nsXMLHttpRequest::StreamReaderFunc, (void*)this, count, &totalRead);
|
||||
nsresult rv = inStr->ReadSegments(nsXMLHttpRequest::StreamReaderFunc,
|
||||
(void*)this, count, &totalRead);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mLoadTransferred += totalRead;
|
||||
|
||||
ChangeState(XML_HTTP_REQUEST_LOADING);
|
||||
|
||||
MaybeDispatchProgressEvents(PR_FALSE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
@ -1743,6 +1804,22 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
|
||||
channel->SetOwner(documentPrincipal);
|
||||
|
||||
nsresult status;
|
||||
request->GetStatus(&status);
|
||||
mErrorLoad = mErrorLoad || NS_FAILED(status);
|
||||
|
||||
if (mUpload && !mUploadComplete && !mErrorLoad &&
|
||||
(mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
if (mTimerIsActive) {
|
||||
mTimerIsActive = PR_FALSE;
|
||||
mProgressNotifier->Cancel();
|
||||
}
|
||||
MaybeDispatchProgressEvents(PR_TRUE);
|
||||
mUploadComplete = PR_TRUE;
|
||||
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(LOAD_STR),
|
||||
PR_TRUE, mUploadTotal, mUploadTotal);
|
||||
}
|
||||
|
||||
mReadRequest = request;
|
||||
mContext = ctxt;
|
||||
mState |= XML_HTTP_REQUEST_PARSEBODY;
|
||||
@ -1756,22 +1833,13 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
}
|
||||
}
|
||||
|
||||
nsresult status;
|
||||
request->GetStatus(&status);
|
||||
mErrorLoad = mErrorLoad || NS_FAILED(status);
|
||||
ResetResponse();
|
||||
|
||||
if (mUpload && !mUploadComplete && !mErrorLoad &&
|
||||
(mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
mUploadComplete = PR_TRUE;
|
||||
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(LOAD_STR),
|
||||
PR_TRUE, mUploadTotal, mUploadTotal);
|
||||
if (!mOverrideMimeType.IsEmpty()) {
|
||||
channel->SetContentType(mOverrideMimeType);
|
||||
}
|
||||
|
||||
// Reset responseBody
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
mResponseBlob = nsnull;
|
||||
mResultArrayBuffer = nsnull;
|
||||
DetectCharset();
|
||||
|
||||
// Set up responseXML
|
||||
PRBool parseBody = mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||
|
||||
@ -1784,10 +1852,6 @@ nsXMLHttpRequest::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
|
||||
}
|
||||
|
||||
if (parseBody && NS_SUCCEEDED(status)) {
|
||||
if (!mOverrideMimeType.IsEmpty()) {
|
||||
channel->SetContentType(mOverrideMimeType);
|
||||
}
|
||||
|
||||
// We can gain a huge performance win by not even trying to
|
||||
// parse non-XML data. This also protects us from the situation
|
||||
// where we have an XML document and sink, but HTML (or other)
|
||||
@ -1918,6 +1982,10 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
||||
mReadRequest = nsnull;
|
||||
mContext = nsnull;
|
||||
|
||||
// If we're received data since the last progress event, make sure to fire
|
||||
// an event for it.
|
||||
MaybeDispatchProgressEvents(PR_TRUE);
|
||||
|
||||
nsCOMPtr<nsIChannel> channel(do_QueryInterface(request));
|
||||
NS_ENSURE_TRUE(channel, NS_ERROR_UNEXPECTED);
|
||||
|
||||
@ -1942,8 +2010,7 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
||||
NS_ConvertASCIItoUTF16(contentType));
|
||||
mResponseBody.Truncate();
|
||||
}
|
||||
NS_ASSERTION(mResponseBodyUnicode.IsVoid(),
|
||||
"mResponseBodyUnicode should be empty");
|
||||
NS_ASSERTION(mResponseText.IsEmpty(), "mResponseText should be empty");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1987,14 +2054,13 @@ nsXMLHttpRequest::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult
|
||||
|
||||
ChangeState(XML_HTTP_REQUEST_DONE, PR_TRUE);
|
||||
|
||||
PRUint32 responseLength = mResponseBody.Length();
|
||||
NS_NAMED_LITERAL_STRING(errorStr, ERROR_STR);
|
||||
NS_NAMED_LITERAL_STRING(loadStr, LOAD_STR);
|
||||
DispatchProgressEvent(this,
|
||||
mErrorLoad ? errorStr : loadStr,
|
||||
!mErrorLoad,
|
||||
responseLength,
|
||||
mErrorLoad ? 0 : responseLength);
|
||||
mLoadTransferred,
|
||||
mErrorLoad ? 0 : mLoadTransferred);
|
||||
if (mErrorLoad && mUpload && !mUploadComplete) {
|
||||
DispatchProgressEvent(mUpload, errorStr, PR_TRUE,
|
||||
mUploadTransferred, mUploadTotal);
|
||||
@ -2392,13 +2458,7 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
|
||||
}
|
||||
}
|
||||
|
||||
// Reset responseBody
|
||||
mResponseBody.Truncate();
|
||||
mResponseBodyUnicode.SetIsVoid(PR_TRUE);
|
||||
mResponseBlob = nsnull;
|
||||
|
||||
// Reset responseXML
|
||||
mResponseXML = nsnull;
|
||||
ResetResponse();
|
||||
|
||||
rv = CheckChannelForCrossSiteRequest(mChannel);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -2924,6 +2984,64 @@ nsXMLHttpRequest::OnRedirectVerifyCallback(nsresult result)
|
||||
// nsIProgressEventSink methods:
|
||||
//
|
||||
|
||||
void
|
||||
nsXMLHttpRequest::MaybeDispatchProgressEvents(PRBool aFinalProgress)
|
||||
{
|
||||
if (aFinalProgress && mTimerIsActive) {
|
||||
mTimerIsActive = PR_FALSE;
|
||||
mProgressNotifier->Cancel();
|
||||
}
|
||||
|
||||
if (mTimerIsActive ||
|
||||
!mProgressSinceLastProgressEvent ||
|
||||
mErrorLoad ||
|
||||
!(mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!aFinalProgress) {
|
||||
StartProgressEventTimer();
|
||||
}
|
||||
|
||||
// We're uploading if our state is XML_HTTP_REQUEST_OPENED or
|
||||
// XML_HTTP_REQUEST_SENT
|
||||
if ((XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT) & mState) {
|
||||
if (aFinalProgress) {
|
||||
mUploadTotal = mUploadTransferred;
|
||||
mUploadProgressMax = mUploadProgress;
|
||||
mUploadLengthComputable = PR_TRUE;
|
||||
}
|
||||
DispatchProgressEvent(this, NS_LITERAL_STRING(UPLOADPROGRESS_STR),
|
||||
PR_TRUE, mUploadLengthComputable, mUploadTransferred,
|
||||
mUploadTotal, mUploadProgress,
|
||||
mUploadProgressMax);
|
||||
if (mUpload && !mUploadComplete) {
|
||||
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(PROGRESS_STR),
|
||||
PR_TRUE, mUploadLengthComputable, mUploadTransferred,
|
||||
mUploadTotal, mUploadProgress,
|
||||
mUploadProgressMax);
|
||||
}
|
||||
} else {
|
||||
if (aFinalProgress) {
|
||||
mLoadTotal = mLoadTransferred;
|
||||
mLoadLengthComputable = PR_TRUE;
|
||||
}
|
||||
mInLoadProgressEvent = PR_TRUE;
|
||||
DispatchProgressEvent(this, NS_LITERAL_STRING(PROGRESS_STR),
|
||||
PR_TRUE, mLoadLengthComputable, mLoadTransferred,
|
||||
mLoadTotal, mLoadTransferred, mLoadTotal);
|
||||
mInLoadProgressEvent = PR_FALSE;
|
||||
if (mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT ||
|
||||
mResponseType == XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER) {
|
||||
mResponseBody.Truncate();
|
||||
mResponseText.Truncate();
|
||||
mResultArrayBuffer = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
mProgressSinceLastProgressEvent = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::OnProgress(nsIRequest *aRequest, nsISupports *aContext, PRUint64 aProgress, PRUint64 aProgressMax)
|
||||
{
|
||||
@ -2937,44 +3055,30 @@ nsXMLHttpRequest::OnProgress(nsIRequest *aRequest, nsISupports *aContext, PRUint
|
||||
// We're uploading if our state is XML_HTTP_REQUEST_OPENED or
|
||||
// XML_HTTP_REQUEST_SENT
|
||||
PRBool upload = !!((XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT) & mState);
|
||||
PRUint64 loaded = aProgress;
|
||||
PRUint64 total = aProgressMax;
|
||||
// When uploading, OnProgress reports also headers in aProgress and aProgressMax.
|
||||
// So, try to remove the headers, if possible.
|
||||
PRBool lengthComputable = (aProgressMax != LL_MAXUINT);
|
||||
if (upload) {
|
||||
if (lengthComputable) {
|
||||
PRUint64 loaded = aProgress;
|
||||
PRUint64 total = aProgressMax;
|
||||
if (lengthComputable) {
|
||||
PRUint64 headerSize = aProgressMax - mUploadTotal;
|
||||
loaded -= headerSize;
|
||||
total -= headerSize;
|
||||
}
|
||||
mUploadLengthComputable = lengthComputable;
|
||||
mUploadTransferred = loaded;
|
||||
mUploadProgress = aProgress;
|
||||
mUploadProgressMax = aProgressMax;
|
||||
mProgressSinceLastProgressEvent = PR_TRUE;
|
||||
|
||||
MaybeDispatchProgressEvents(PR_FALSE);
|
||||
} else {
|
||||
mLoadLengthComputable = lengthComputable;
|
||||
mLoadTotal = mLoadLengthComputable ? total : 0;
|
||||
}
|
||||
|
||||
if (mTimerIsActive) {
|
||||
// The progress event will be dispatched when the notifier calls Notify().
|
||||
mProgressEventWasDelayed = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (!mErrorLoad && (mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
StartProgressEventTimer();
|
||||
NS_NAMED_LITERAL_STRING(progress, PROGRESS_STR);
|
||||
NS_NAMED_LITERAL_STRING(uploadprogress, UPLOADPROGRESS_STR);
|
||||
DispatchProgressEvent(this, upload ? uploadprogress : progress, PR_TRUE,
|
||||
lengthComputable, loaded, lengthComputable ? total : 0,
|
||||
aProgress, aProgressMax);
|
||||
|
||||
if (upload && mUpload && !mUploadComplete) {
|
||||
NS_WARN_IF_FALSE(mUploadTotal == total, "Wrong upload total?");
|
||||
DispatchProgressEvent(mUpload, progress, PR_TRUE, lengthComputable, loaded,
|
||||
lengthComputable ? total : 0, aProgress, aProgressMax);
|
||||
}
|
||||
mLoadTotal = lengthComputable ? aProgressMax : 0;
|
||||
|
||||
// Don't dispatch progress events here. OnDataAvailable will take care
|
||||
// of that.
|
||||
}
|
||||
|
||||
if (mProgressEventSink) {
|
||||
@ -3090,35 +3194,10 @@ NS_IMETHODIMP
|
||||
nsXMLHttpRequest::Notify(nsITimer* aTimer)
|
||||
{
|
||||
mTimerIsActive = PR_FALSE;
|
||||
if (NS_SUCCEEDED(CheckInnerWindowCorrectness()) && !mErrorLoad &&
|
||||
(mState & XML_HTTP_REQUEST_ASYNC)) {
|
||||
if (mProgressEventWasDelayed) {
|
||||
mProgressEventWasDelayed = PR_FALSE;
|
||||
if (!(XML_HTTP_REQUEST_MPART_HEADERS & mState)) {
|
||||
StartProgressEventTimer();
|
||||
// We're uploading if our state is XML_HTTP_REQUEST_OPENED or
|
||||
// XML_HTTP_REQUEST_SENT
|
||||
if ((XML_HTTP_REQUEST_OPENED | XML_HTTP_REQUEST_SENT) & mState) {
|
||||
DispatchProgressEvent(this, NS_LITERAL_STRING(UPLOADPROGRESS_STR),
|
||||
PR_TRUE, PR_TRUE, mUploadTransferred,
|
||||
mUploadTotal, mUploadProgress,
|
||||
mUploadProgressMax);
|
||||
if (mUpload && !mUploadComplete) {
|
||||
DispatchProgressEvent(mUpload, NS_LITERAL_STRING(PROGRESS_STR),
|
||||
PR_TRUE, PR_TRUE, mUploadTransferred,
|
||||
mUploadTotal, mUploadProgress,
|
||||
mUploadProgressMax);
|
||||
}
|
||||
} else {
|
||||
DispatchProgressEvent(this, NS_LITERAL_STRING(PROGRESS_STR),
|
||||
mLoadLengthComputable, mResponseBody.Length(),
|
||||
mLoadTotal);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (mProgressNotifier) {
|
||||
mProgressNotifier->Cancel();
|
||||
if (!(XML_HTTP_REQUEST_MPART_HEADERS & mState)) {
|
||||
MaybeDispatchProgressEvents(PR_FALSE);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,7 @@
|
||||
|
||||
class nsILoadGroup;
|
||||
class AsyncVerifyRedirectCallbackForwarder;
|
||||
class nsIUnicodeDecoder;
|
||||
|
||||
class nsXHREventTarget : public nsDOMEventTargetWrapperCache,
|
||||
public nsIXMLHttpRequestEventTarget
|
||||
@ -188,6 +189,11 @@ public:
|
||||
aLoaded, aLengthComputable ? aTotal : LL_MAXUINT);
|
||||
}
|
||||
|
||||
// Dispatch the "progress" event on the XHR or XHR.upload object if we've
|
||||
// received data since the last "progress" event. Also dispatches
|
||||
// "uploadprogress" as needed.
|
||||
void MaybeDispatchProgressEvents(PRBool aFinalProgress);
|
||||
|
||||
// This is called by the factory constructor.
|
||||
nsresult Init();
|
||||
|
||||
@ -201,8 +207,8 @@ public:
|
||||
protected:
|
||||
friend class nsMultipartProxyListener;
|
||||
|
||||
nsresult DetectCharset(nsACString& aCharset);
|
||||
nsresult ConvertBodyToText(nsAString& aOutBuffer);
|
||||
nsresult DetectCharset();
|
||||
nsresult AppendToResponseText(const char * aBuffer, PRUint32 aBufferLen);
|
||||
static NS_METHOD StreamReaderFunc(nsIInputStream* in,
|
||||
void* closure,
|
||||
const char* fromRawSegment,
|
||||
@ -268,15 +274,30 @@ protected:
|
||||
nsCString mHeaders;
|
||||
};
|
||||
|
||||
// The bytes of our response body
|
||||
// The bytes of our response body. Only used for DEFAULT, ARRAYBUFFER and
|
||||
// BLOB responseTypes
|
||||
nsCString mResponseBody;
|
||||
|
||||
// The Unicode version of our response body. This is just a cache; if the
|
||||
// string is not void, we have a cached value. This works because we only
|
||||
// allow looking at this value once state is INTERACTIVE, and at that
|
||||
// point our charset can only change due to more data coming in, which
|
||||
// will cause us to clear the cached value anyway.
|
||||
nsString mResponseBodyUnicode;
|
||||
// The text version of our response body. This is incrementally decoded into
|
||||
// as we receive network data. However for the DEFAULT responseType we
|
||||
// lazily decode into this from mResponseBody only when .responseText is
|
||||
// accessed.
|
||||
// Only used for DEFAULT and TEXT responseTypes.
|
||||
nsString mResponseText;
|
||||
|
||||
// For DEFAULT responseType we use this to keep track of how far we've
|
||||
// lazily decoded from mResponseBody to mResponseText
|
||||
PRUint32 mResponseBodyDecodedPos;
|
||||
|
||||
// Decoder used for decoding into mResponseText
|
||||
// Only used for DEFAULT, TEXT and JSON responseTypes.
|
||||
// In cases where we've only received half a surrogate, the decoder itself
|
||||
// carries the state to remember this. Next time we receive more data we
|
||||
// simply feed the new data into the decoder which will handle the second
|
||||
// part of the surrogate.
|
||||
nsCOMPtr<nsIUnicodeDecoder> mDecoder;
|
||||
|
||||
nsCString mResponseCharset;
|
||||
|
||||
enum {
|
||||
XML_HTTP_RESPONSE_TYPE_DEFAULT,
|
||||
@ -284,7 +305,9 @@ protected:
|
||||
XML_HTTP_RESPONSE_TYPE_BLOB,
|
||||
XML_HTTP_RESPONSE_TYPE_DOCUMENT,
|
||||
XML_HTTP_RESPONSE_TYPE_TEXT,
|
||||
XML_HTTP_RESPONSE_TYPE_JSON
|
||||
XML_HTTP_RESPONSE_TYPE_JSON,
|
||||
XML_HTTP_RESPONSE_TYPE_CHUNKED_TEXT,
|
||||
XML_HTTP_RESPONSE_TYPE_CHUNKED_ARRAYBUFFER
|
||||
} mResponseType;
|
||||
|
||||
nsCOMPtr<nsIDOMBlob> mResponseBlob;
|
||||
@ -313,7 +336,9 @@ protected:
|
||||
nsRefPtr<nsXMLHttpRequestUpload> mUpload;
|
||||
PRUint64 mUploadTransferred;
|
||||
PRUint64 mUploadTotal;
|
||||
PRPackedBool mUploadLengthComputable;
|
||||
PRPackedBool mUploadComplete;
|
||||
PRPackedBool mProgressSinceLastProgressEvent;
|
||||
PRUint64 mUploadProgress; // For legacy
|
||||
PRUint64 mUploadProgressMax; // For legacy
|
||||
|
||||
@ -323,9 +348,11 @@ protected:
|
||||
PRPackedBool mProgressEventWasDelayed;
|
||||
PRPackedBool mLoadLengthComputable;
|
||||
PRUint64 mLoadTotal; // 0 if not known.
|
||||
PRUint64 mLoadTransferred;
|
||||
nsCOMPtr<nsITimer> mProgressNotifier;
|
||||
|
||||
PRPackedBool mFirstStartRequestSeen;
|
||||
PRPackedBool mInLoadProgressEvent;
|
||||
|
||||
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
|
||||
nsCOMPtr<nsIChannel> mNewRedirectChannel;
|
||||
@ -333,6 +360,8 @@ protected:
|
||||
jsval mResultJSON;
|
||||
JSObject* mResultArrayBuffer;
|
||||
|
||||
void ResetResponse();
|
||||
|
||||
struct RequestHeader
|
||||
{
|
||||
nsCString header;
|
||||
|
@ -266,6 +266,7 @@ _TEST_FILES1 = \
|
||||
test_bug587931.html \
|
||||
test_bug592829.html \
|
||||
test_bug518104.html \
|
||||
test_bug682463.html \
|
||||
bug457746.sjs \
|
||||
test_CrossSiteXHR.html \
|
||||
test_CrossSiteXHR_origin.html \
|
||||
@ -498,6 +499,8 @@ _TEST_FILES2 = \
|
||||
accesscontrol.resource^headers^ \
|
||||
invalid_accesscontrol.resource \
|
||||
invalid_accesscontrol.resource^headers^ \
|
||||
test_xhr_progressevents.html \
|
||||
progressserver.sjs \
|
||||
somedatas.resource \
|
||||
somedatas.resource^headers^ \
|
||||
delayedServerEvents.sjs \
|
||||
|
51
content/base/test/progressserver.sjs
Normal file
@ -0,0 +1,51 @@
|
||||
const CC = Components.Constructor;
|
||||
const BinaryInputStream = CC("@mozilla.org/binaryinputstream;1",
|
||||
"nsIBinaryInputStream",
|
||||
"setInputStream");
|
||||
|
||||
function setReq(req) {
|
||||
setObjectState("content/base/test/progressserver", req);
|
||||
}
|
||||
|
||||
function getReq() {
|
||||
var req;
|
||||
getObjectState("content/base/test/progressserver", function(v) {
|
||||
req = v;
|
||||
});
|
||||
return req;
|
||||
}
|
||||
|
||||
function handleRequest(request, response)
|
||||
{
|
||||
var pairs = request.queryString.split('&');
|
||||
var command = pairs.shift();
|
||||
|
||||
var bodyStream = new BinaryInputStream(request.bodyInputStream);
|
||||
var body = "";
|
||||
var bodyAvail;
|
||||
while ((bodyAvail = bodyStream.available()) > 0)
|
||||
body += String.fromCharCode.apply(null, bodyStream.readByteArray(bodyAvail));
|
||||
|
||||
if (command == "open") {
|
||||
response.processAsync();
|
||||
setReq(response);
|
||||
|
||||
response.setHeader("Cache-Control", "no-cache", false);
|
||||
pairs.forEach(function (val) {
|
||||
var [name, value] = val.split('=');
|
||||
response.setHeader(name, unescape(value), false);
|
||||
});
|
||||
response.write(body);
|
||||
return;
|
||||
}
|
||||
|
||||
if (command == "send") {
|
||||
getReq().write(body);
|
||||
}
|
||||
else if (command == "close") {
|
||||
getReq().finish();
|
||||
setReq(null);
|
||||
}
|
||||
response.setHeader("Content-Type", "text/plain");
|
||||
response.write("ok");
|
||||
}
|
@ -14,41 +14,6 @@
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// test receiving as JSON
|
||||
function testJSON(aJsonStr, invalid) {
|
||||
var errorThrown = false;
|
||||
var anotherErrorThrown = false;
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
||||
var didthrow = false;
|
||||
try { xhr.responseType = 'moz-json'; } catch (e) { didthrow = true; }
|
||||
ok(didthrow,
|
||||
"should have thrown when setting responseType to moz-json before open");
|
||||
|
||||
xhr.open("POST", 'responseIdentical.sjs', false);
|
||||
xhr.responseType = 'moz-json';
|
||||
xhr.send(aJsonStr);
|
||||
|
||||
if (!invalid) {
|
||||
is(JSON.stringify(xhr.response), aJsonStr);
|
||||
is(xhr.response, xhr.response, "returning the same object on each access");
|
||||
}
|
||||
else {
|
||||
var didThrow = false;
|
||||
try { xhr.response } catch(ex) { didThrow = true; }
|
||||
ok(didThrow, "accessing response should throw");
|
||||
|
||||
didThrow = false;
|
||||
try { xhr.response } catch(ex) { didThrow = true; }
|
||||
ok(didThrow, "accessing response should throw");
|
||||
}
|
||||
}
|
||||
|
||||
var jsonStr = '{"title":"aBook","author":"john"}';
|
||||
testJSON(jsonStr, false);
|
||||
var invalidJson = '{ "abc": }'
|
||||
testJSON(invalidJson, true);
|
||||
|
||||
var path = "/tests/content/base/test/";
|
||||
|
||||
var passFiles = [['file_XHR_pass1.xml', 'GET'],
|
||||
@ -109,18 +74,25 @@ function checkResponseXMLAccessThrows(xhr) {
|
||||
try { xhr.responseXML } catch (e) { didthrow = true; }
|
||||
ok(didthrow, "should have thrown when accessing responseXML");
|
||||
}
|
||||
function checkSetResponseTypeThrows(xhr) {
|
||||
function checkResponseAccessThrows(xhr) {
|
||||
var didthrow = false;
|
||||
try { xhr.responseType = 'document'; } catch (e) { didthrow = true; }
|
||||
ok(didthrow, "should have thrown when accessing responseType");
|
||||
try { xhr.response } catch (e) { didthrow = true; }
|
||||
ok(didthrow, "should have thrown when accessing response");
|
||||
}
|
||||
function checkSetResponseTypeThrows(xhr, type) {
|
||||
var didthrow = false;
|
||||
try { xhr.responseType = type; } catch (e) { didthrow = true; }
|
||||
ok(didthrow, "should have thrown when setting responseType");
|
||||
}
|
||||
|
||||
xhr = new XMLHttpRequest();
|
||||
checkSetResponseTypeThrows(xhr);
|
||||
checkSetResponseTypeThrows(xhr, "document");
|
||||
xhr.open("GET", 'file_XHR_pass1.xml', false);
|
||||
checkSetResponseTypeThrows(xhr, "moz-chunked-text");
|
||||
checkSetResponseTypeThrows(xhr, "moz-chunked-arraybuffer");
|
||||
xhr.responseType = 'document';
|
||||
xhr.send(null);
|
||||
checkSetResponseTypeThrows(xhr);
|
||||
checkSetResponseTypeThrows(xhr, "document");
|
||||
is(xhr.status, 200, "wrong status");
|
||||
checkResponseTextAccessThrows(xhr);
|
||||
is((new XMLSerializer()).serializeToString(xhr.response.documentElement),
|
||||
@ -178,16 +150,30 @@ checkResponseXMLAccessThrows(xhr);
|
||||
ab = xhr.response;
|
||||
ok(ab != null, "should have a non-null arraybuffer");
|
||||
arraybuffer_equals_to(ab, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb");
|
||||
is(xhr.response, xhr.response, "returns the same ArrayBuffer");
|
||||
|
||||
// test array buffer GetResult returns the same object
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", 'file_XHR_binary1.bin', false);
|
||||
xhr.responseType = 'arraybuffer';
|
||||
xhr.send(null)
|
||||
// test response (responseType='moz-json')
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", 'responseIdentical.sjs', false);
|
||||
xhr.responseType = 'moz-json';
|
||||
jsonObjStr = JSON.stringify({title: "aBook", author: "john"});
|
||||
xhr.send(jsonObjStr);
|
||||
is(xhr.status, 200, "wrong status");
|
||||
checkResponseTextAccessThrows(xhr);
|
||||
checkResponseXMLAccessThrows(xhr);
|
||||
is(xhr.response, xhr.response, "returns the same ArrayBuffer");
|
||||
is(JSON.stringify(xhr.response), jsonObjStr, "correct result");
|
||||
is(xhr.response, xhr.response, "returning the same object on each access");
|
||||
|
||||
// with invalid json
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", 'responseIdentical.sjs', false);
|
||||
xhr.responseType = 'moz-json';
|
||||
xhr.send("{");
|
||||
is(xhr.status, 200, "wrong status");
|
||||
checkResponseTextAccessThrows(xhr);
|
||||
checkResponseXMLAccessThrows(xhr);
|
||||
checkResponseAccessThrows(xhr);
|
||||
checkResponseAccessThrows(xhr); // Check twice to ensure that we still throw
|
||||
|
||||
// test response (responseType='blob')
|
||||
var onloadCount = 0;
|
||||
|
156
content/base/test/test_bug682463.html
Normal file
@ -0,0 +1,156 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=682463
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 682463</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=682463">Mozilla Bug 682463</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 682463 **/
|
||||
|
||||
function text(s) {
|
||||
return document.createTextNode(s);
|
||||
}
|
||||
function div(l,r) {
|
||||
var div = document.createElement("DIV");
|
||||
if (l) div.appendChild(l);
|
||||
if (r) div.appendChild(r);
|
||||
return div;
|
||||
}
|
||||
function createRange(sn,so,en,eo) {
|
||||
var r = document.createRange();
|
||||
r.setStart(sn,so);
|
||||
r.setEnd(en,eo);
|
||||
return r;
|
||||
}
|
||||
function verifyRange(msg,r,sn,so,en,eo) {
|
||||
ok(r.startContainer == sn && r.startOffset == so &&
|
||||
r.endContainer == en && r.endOffset == eo, msg);
|
||||
}
|
||||
function showRange(r,msg) {
|
||||
var s = "" + r.startContainer + ": " + r.startOffset;
|
||||
s+= '\n';
|
||||
s += "" + r.endContainer + ": " + r.endOffset;
|
||||
alert(msg + ':\n' + s)
|
||||
}
|
||||
|
||||
var tests = [
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var r = createRange(t,2,t,t.length);
|
||||
var t2 = t.splitText(1);
|
||||
verifyRange("split before, no parent",r,t2,1,t2,5);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var r = createRange(t,0,t,t.length);
|
||||
var t2 = t.splitText(3);
|
||||
verifyRange("split middle, no parent",r,t,0,t,3);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var r = createRange(t,0,t,t.length);
|
||||
var n = t.length;
|
||||
var t2 = t.splitText(n);
|
||||
verifyRange("split after, no parent",r,t,0,t,n);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var parent = div(t);
|
||||
var r = createRange(t,0,t,t.length);
|
||||
var t2 = t.splitText(3);
|
||||
verifyRange("split middle, parent",r,t,0,t2,3);
|
||||
parent.removeChild(t);
|
||||
verifyRange("removed left, parent",r,parent,0,t2,3);
|
||||
var t2b = t2.splitText(1);
|
||||
verifyRange("split middle, parent, end",r,parent,0,t2b,2);
|
||||
},
|
||||
function() {
|
||||
var t0 = text("x");
|
||||
var t = text("foobar");
|
||||
var parent = div(t0,t);
|
||||
var r = createRange(t,0,t,t.length);
|
||||
var t2 = t.splitText(3);
|
||||
parent.removeChild(t);
|
||||
verifyRange("removed left, text sibling",r,parent,1,t2,3);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var parent = div(t);
|
||||
var r = createRange(t,2,t,t.length);
|
||||
var t2 = t.splitText(1);
|
||||
verifyRange("split before, parent",r,t2,1,t2,5);
|
||||
parent.removeChild(t2);
|
||||
verifyRange("removed right, parent",r,parent,1,parent,1);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var parent = div(t);
|
||||
var r = createRange(t,0,t,t.length);
|
||||
var n = t.length;
|
||||
var t2 = t.splitText(n);
|
||||
verifyRange("split after, parent",r,t,0,t,n);
|
||||
r.setEnd(t2,0);
|
||||
verifyRange("split after, parent, extend",r,t,0,t2,0);
|
||||
t2.splitText(0);
|
||||
verifyRange("split after, parent, extend, split end",r,t,0,t2,0);
|
||||
t2.textContent = "baz";
|
||||
t2.splitText(2);
|
||||
verifyRange("split after, parent, extend, split after end",r,t,0,t2,0);
|
||||
r.setEnd(t2,2);
|
||||
var t2b = t2.splitText(1);
|
||||
verifyRange("split after, parent, split end",r,t,0,t2b,1);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var parent = div(t);
|
||||
document.body.appendChild(parent);
|
||||
var r = createRange(t,0,t,t.length);
|
||||
var t2 = t.splitText(3);
|
||||
verifyRange("split middle, in document",r,t,0,t2,3);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var parent = div(t);
|
||||
document.body.appendChild(parent);
|
||||
var r = createRange(t,2,t,t.length);
|
||||
var t2 = t.splitText(1);
|
||||
verifyRange("split before, in document",r,t2,1,t2,5);
|
||||
},
|
||||
function() {
|
||||
var t = text("foobar");
|
||||
var parent = div(t);
|
||||
document.body.appendChild(parent);
|
||||
var r = createRange(t,0,t,t.length);
|
||||
var n = t.length;
|
||||
var t2 = t.splitText(n);
|
||||
verifyRange("split after, in document",r,t,0,t,n);
|
||||
}
|
||||
];
|
||||
|
||||
function runTests() {
|
||||
var len = tests.length;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
tests[i]();
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
addLoadEvent(runTests);
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
282
content/base/test/test_xhr_progressevents.html
Normal file
@ -0,0 +1,282 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for XMLHttpRequest Progress Events</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body onload="gen.next();">
|
||||
<pre id=l></pre>
|
||||
<script type="application/javascript;version=1.7">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var gen = runTests();
|
||||
|
||||
function log(s) {
|
||||
//document.getElementById("l").textContent += s + "\n";
|
||||
}
|
||||
|
||||
function getEvent(e) {
|
||||
log("got event: " + e.type + " (" + e.target.readyState + ")");
|
||||
gen.send(e);
|
||||
}
|
||||
|
||||
function startsWith(a, b) {
|
||||
return a.substr(0, b.length) === b;
|
||||
}
|
||||
|
||||
function updateProgress(e, data, testName) {
|
||||
var test = " while running " + testName;
|
||||
is(e.type, "progress", "event type" + test);
|
||||
|
||||
let response;
|
||||
if (data.nodata) {
|
||||
is(e.target.response, null, "response should be null" + test);
|
||||
response = null;
|
||||
}
|
||||
else if (data.text) {
|
||||
is(typeof e.target.response, "string", "response should be a string" + test);
|
||||
response = e.target.response;
|
||||
}
|
||||
else {
|
||||
ok(e.target.response instanceof ArrayBuffer, "response should be a ArrayBuffer" + test);
|
||||
response = bufferToString(e.target.response);
|
||||
}
|
||||
|
||||
if (!data.nodata && !data.encoded) {
|
||||
if (!data.chunked) {
|
||||
is(e.loaded, response.length, "event.loaded matches response size" + test);
|
||||
}
|
||||
else {
|
||||
is(e.loaded - data.receivedBytes, response.length,
|
||||
"event.loaded grew by response size" + test);
|
||||
}
|
||||
}
|
||||
ok(e.loaded > data.receivedBytes, "event.loaded increased" + test);
|
||||
ok(e.loaded - data.receivedBytes <= data.pendingBytes,
|
||||
"event.loaded didn't increase too much" + test);
|
||||
|
||||
if (!data.nodata) {
|
||||
var newData;
|
||||
ok(startsWith(response, data.receivedResult),
|
||||
"response strictly grew" + test);
|
||||
newData = response.substr(data.receivedResult.length);
|
||||
|
||||
if (!data.encoded) {
|
||||
ok(newData.length > 0, "sanity check for progress" + test);
|
||||
}
|
||||
ok(startsWith(data.pendingResult, newData), "new data matches expected" + test);
|
||||
}
|
||||
|
||||
is(e.lengthComputable, "total" in data, "lengthComputable" + test);
|
||||
if ("total" in data) {
|
||||
is(e.total, data.total, "total" + test);
|
||||
}
|
||||
|
||||
if (!data.nodata) {
|
||||
data.pendingResult = data.pendingResult.substr(newData.length);
|
||||
}
|
||||
data.pendingBytes -= e.loaded - data.receivedBytes;
|
||||
data.receivedResult = response;
|
||||
data.receivedBytes = e.loaded;
|
||||
}
|
||||
|
||||
function sendData(s) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "progressserver.sjs?send");
|
||||
xhr.sendAsBinary(s);
|
||||
}
|
||||
|
||||
function closeConn() {
|
||||
log("in closeConn");
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "progressserver.sjs?close");
|
||||
xhr.send();
|
||||
}
|
||||
|
||||
var longString = "long";
|
||||
while(longString.length < 65536)
|
||||
longString += longString;
|
||||
|
||||
function utf8encode(s) {
|
||||
return unescape(encodeURIComponent(s));
|
||||
}
|
||||
|
||||
function bufferToString(buffer) {
|
||||
return String.fromCharCode.apply(String, new Uint8Array(buffer));
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onprogress = xhr.onload = xhr.onerror = xhr.onreadystatechange = xhr.onloadend = getEvent;
|
||||
|
||||
var responseTypes = [{ type: "text", text: true },
|
||||
{ type: "arraybuffer", text: false, nodata: true },
|
||||
{ type: "blob", text: false, nodata: true },
|
||||
{ type: "document", text: true, nodata: true },
|
||||
{ type: "moz-json", text: true, nodata: true },
|
||||
{ type: "", text: true },
|
||||
{ type: "moz-chunked-text", text: true, chunked: true },
|
||||
{ type: "moz-chunked-arraybuffer", text: false, chunked: true },
|
||||
];
|
||||
var responseType;
|
||||
while (responseType = responseTypes.shift()) {
|
||||
let tests = [{ open: "Content-Type=text/plain", name: "simple test" },
|
||||
{ data: "hello world" },
|
||||
{ data: "\u0000\u0001\u0002\u0003" },
|
||||
{ data: longString },
|
||||
{ data: "x" },
|
||||
{ close: true },
|
||||
{ open: "Content-Type=text/plain&Content-Length=20", name: "with length", total: 20 },
|
||||
// 5 bytes from the "ready" in the open step
|
||||
{ data: "abcde" },
|
||||
{ data: "0123456789" },
|
||||
{ close: true },
|
||||
{ open: "Content-Type=application/xml", data: "ready", name: "without length, as xml" },
|
||||
{ data: "<out>" },
|
||||
{ data: "text" },
|
||||
{ data: "</foo>invalid" },
|
||||
{ close: true },
|
||||
{ open: "Content-Type=text/plain;charset%3dutf-8", name: "utf8 data", encoded: true },
|
||||
{ data: utf8encode("räksmörgås"), utf16: "räksmörgås" },
|
||||
{ data: utf8encode("Å").substr(0,1), utf16: "" },
|
||||
{ data: utf8encode("Å").substr(1), utf16: "Å" },
|
||||
{ data: utf8encode("aöb").substr(0,2), utf16: "a" },
|
||||
{ data: utf8encode("aöb").substr(2), utf16: "öb" },
|
||||
{ data: utf8encode("a\u867Eb").substr(0,3), utf16: "a" },
|
||||
{ data: utf8encode("a\u867Eb").substr(3,1), utf16: "\u867E" },
|
||||
{ data: utf8encode("a\u867Eb").substr(4), utf16: "b" },
|
||||
{ close: true },
|
||||
];
|
||||
let testState = { index: 0 };
|
||||
|
||||
for (let i = 0; i < tests.length; ++i) {
|
||||
let test = tests[i];
|
||||
testState.index++;
|
||||
if ("open" in test) {
|
||||
log("opening " + testState.name);
|
||||
testState = { name: test.name + " for " + responseType.type,
|
||||
index: 0,
|
||||
pendingResult: "ready",
|
||||
pendingBytes: 5,
|
||||
receivedResult: "",
|
||||
receivedBytes: 0,
|
||||
total: test.total,
|
||||
encoded: test.encoded,
|
||||
nodata: responseType.nodata,
|
||||
chunked: responseType.chunked,
|
||||
text: responseType.text };
|
||||
|
||||
xhr.onreadystatechange = null;
|
||||
xhr.open("POST", "progressserver.sjs?open&" + test.open);
|
||||
xhr.responseType = responseType.type;
|
||||
xhr.send("ready");
|
||||
xhr.onreadystatechange = getEvent;
|
||||
|
||||
let e = yield;
|
||||
is(e.type, "readystatechange", "should readystate to headers-received starting " + testState.name);
|
||||
is(xhr.readyState, xhr.HEADERS_RECEIVED, "should be in state HEADERS_RECEIVED starting " + testState.name);
|
||||
|
||||
e = yield;
|
||||
is(e.type, "readystatechange", "should readystate to loading starting " + testState.name);
|
||||
is(xhr.readyState, xhr.LOADING, "should be in state LOADING starting " + testState.name);
|
||||
if (typeof testState.total == "undefined")
|
||||
delete testState.total;
|
||||
}
|
||||
else if ("close" in test) {
|
||||
log("closing");
|
||||
closeConn();
|
||||
|
||||
e = yield;
|
||||
is(e.type, "readystatechange", "should readystate to done closing " + testState.name);
|
||||
is(xhr.readyState, xhr.DONE, "should be in state DONE closing " + testState.name);
|
||||
log("readystate to 4");
|
||||
|
||||
if (responseType.chunked) {
|
||||
xhr.responseType;
|
||||
is(xhr.response, null, "chunked data has null response for " + testState.name);
|
||||
}
|
||||
|
||||
e = yield;
|
||||
is(e.type, "load", "should fire load closing " + testState.name);
|
||||
is(e.lengthComputable, true, "length should be computable during load closing " + testState.name);
|
||||
log("got load");
|
||||
|
||||
if (responseType.chunked) {
|
||||
is(xhr.response, null, "chunked data has null response for " + testState.name);
|
||||
}
|
||||
|
||||
e = yield;
|
||||
is(e.type, "loadend", "should fire loadend closing " + testState.name);
|
||||
is(e.lengthComputable, true, "length should be computable during loadend closing " + testState.name);
|
||||
log("got loadend");
|
||||
|
||||
if (responseType.chunked) {
|
||||
is(xhr.response, null, "chunked data has null response for " + testState.name);
|
||||
}
|
||||
|
||||
if (!testState.nodata || responseType.chunked) {
|
||||
// This branch intentionally left blank
|
||||
// Under these conditions we check the response during updateProgress
|
||||
}
|
||||
else if (responseType.type === "arraybuffer") {
|
||||
is(bufferToString(xhr.response), testState.pendingResult,
|
||||
"full response for " + testState.name);
|
||||
}
|
||||
else if (responseType.type === "blob") {
|
||||
let reader = new FileReader;
|
||||
reader.readAsBinaryString(xhr.response);
|
||||
reader.onloadend = getEvent;
|
||||
yield;
|
||||
|
||||
is(reader.result, testState.pendingResult,
|
||||
"full response in blob for " + testState.name);
|
||||
}
|
||||
|
||||
testState.name = "";
|
||||
}
|
||||
else {
|
||||
log("sending");
|
||||
if (responseType.text) {
|
||||
testState.pendingResult += "utf16" in test ? test.utf16 : test.data;
|
||||
}
|
||||
else {
|
||||
testState.pendingResult += test.data;
|
||||
}
|
||||
testState.pendingBytes = test.data.length;
|
||||
sendData(test.data);
|
||||
}
|
||||
|
||||
while(testState.pendingBytes) {
|
||||
log("waiting for more bytes: " + testState.pendingBytes);
|
||||
e = yield;
|
||||
// Readystate can fire several times between each progress event.
|
||||
if (e.type === "readystatechange")
|
||||
continue;
|
||||
|
||||
updateProgress(e, testState, "data for " + testState.name + "[" + testState.index + "]");
|
||||
if (responseType.chunked) {
|
||||
testState.receivedResult = "";
|
||||
}
|
||||
}
|
||||
|
||||
if (!testState.nodata) {
|
||||
is(testState.pendingResult, "",
|
||||
"should have consumed the expected result");
|
||||
}
|
||||
|
||||
log("done with this test");
|
||||
}
|
||||
|
||||
is(testState.name, "", "forgot to close last test");
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
yield;
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -120,7 +120,7 @@ public class CrashReporter extends Activity
|
||||
String passedMinidumpPath = getIntent().getStringExtra("minidumpPath");
|
||||
File passedMinidumpFile = new File(passedMinidumpPath);
|
||||
File pendingDir =
|
||||
new File("/data/data/@ANDROID_PACKAGE_NAME@/mozilla/Crash Reports/pending");
|
||||
new File("/data/data/@ANDROID_PACKAGE_NAME@/files/mozilla/Crash Reports/pending");
|
||||
pendingDir.mkdirs();
|
||||
mPendingMinidumpFile = new File(pendingDir, passedMinidumpFile.getName());
|
||||
moveFile(passedMinidumpFile, mPendingMinidumpFile);
|
||||
@ -295,7 +295,7 @@ public class CrashReporter extends Activity
|
||||
|
||||
if (conn.getResponseCode() == conn.HTTP_OK) {
|
||||
File submittedDir = new File(
|
||||
"/data/data/@ANDROID_PACKAGE_NAME@/mozilla/Crash Reports/submitted");
|
||||
"/data/data/@ANDROID_PACKAGE_NAME@/files/mozilla/Crash Reports/submitted");
|
||||
submittedDir.mkdirs();
|
||||
minidumpFile.delete();
|
||||
extrasFile.delete();
|
||||
|
@ -278,7 +278,8 @@ public class GeckoAppShell
|
||||
GeckoApp geckoApp = GeckoApp.mAppContext;
|
||||
String homeDir;
|
||||
if (Build.VERSION.SDK_INT < 8 ||
|
||||
geckoApp.getApplication().getPackageResourcePath().startsWith("/data")) {
|
||||
geckoApp.getApplication().getPackageResourcePath().startsWith("/data") ||
|
||||
geckoApp.getApplication().getPackageResourcePath().startsWith("/system")) {
|
||||
File home = geckoApp.getFilesDir();
|
||||
homeDir = home.getPath();
|
||||
// handle the application being moved to phone from sdcard
|
||||
|
@ -550,6 +550,9 @@ static HWND CreateGroupBox(HINSTANCE aHInst,
|
||||
// Localizes and initializes the radio buttons and group
|
||||
static void InitializeExtendedDialog(HWND hdlg, PRInt16 aHowToEnableFrameUI)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aHowToEnableFrameUI != nsIPrintSettings::kFrameEnableNone,
|
||||
"should not be called");
|
||||
|
||||
// Localize the new controls in the print dialog
|
||||
nsCOMPtr<nsIStringBundle> strBundle;
|
||||
if (NS_SUCCEEDED(GetLocalizedBundle(PRINTDLG_PROPERTIES, getter_AddRefs(strBundle)))) {
|
||||
@ -568,23 +571,13 @@ static void InitializeExtendedDialog(HWND hdlg, PRInt16 aHowToEnableFrameUI)
|
||||
// set default so user doesn't have to actually press on it
|
||||
gFrameSelectedRadioBtn = rad5;
|
||||
|
||||
} else if (aHowToEnableFrameUI == nsIPrintSettings::kFrameEnableAsIsAndEach) {
|
||||
} else { // nsIPrintSettings::kFrameEnableAsIsAndEach
|
||||
SetRadio(hdlg, rad4, PR_FALSE);
|
||||
SetRadio(hdlg, rad5, PR_FALSE, PR_FALSE);
|
||||
SetRadio(hdlg, rad6, PR_TRUE);
|
||||
// set default so user doesn't have to actually press on it
|
||||
gFrameSelectedRadioBtn = rad6;
|
||||
|
||||
|
||||
} else { // nsIPrintSettings::kFrameEnableNone
|
||||
// we are using this function to disabe the group box
|
||||
SetRadio(hdlg, grp3, PR_FALSE, PR_FALSE);
|
||||
// now disable radiobuttons
|
||||
SetRadio(hdlg, rad4, PR_FALSE, PR_FALSE);
|
||||
SetRadio(hdlg, rad5, PR_FALSE, PR_FALSE);
|
||||
SetRadio(hdlg, rad6, PR_FALSE, PR_FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -605,6 +598,10 @@ static UINT CALLBACK PrintHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM
|
||||
if (printDlg == NULL) return 0L;
|
||||
|
||||
PRInt16 howToEnableFrameUI = (PRInt16)printDlg->lCustData;
|
||||
// don't add frame options if they would be disabled anyway
|
||||
// because there are no frames
|
||||
if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableNone)
|
||||
return TRUE;
|
||||
|
||||
HINSTANCE hInst = (HINSTANCE)::GetWindowLongPtr(hdlg, GWLP_HINSTANCE);
|
||||
if (hInst == NULL) return 0L;
|
||||
@ -1106,6 +1103,11 @@ static BOOL APIENTRY PropSheetCallBack(HWND hdlg, UINT uiMsg, UINT wParam, LONG
|
||||
// We temporarily borrowed the global value for initialization
|
||||
// now clear it before the dialog appears
|
||||
PRInt16 howToEnableFrameUI = gFrameSelectedRadioBtn;
|
||||
// don't add frame options if they would be disabled anyway
|
||||
// because there are no frames
|
||||
if (howToEnableFrameUI == nsIPrintSettings::kFrameEnableNone)
|
||||
return TRUE;
|
||||
|
||||
gFrameSelectedRadioBtn = 0;
|
||||
|
||||
HINSTANCE hInst = (HINSTANCE)::GetWindowLongPtr(hdlg, GWLP_HINSTANCE);
|
||||
|
@ -40,7 +40,6 @@ asm/signal.h
|
||||
ASRegistry.h
|
||||
assert.h
|
||||
atk/atk.h
|
||||
atlbase.h
|
||||
atlcom.h
|
||||
atlconv.h
|
||||
atlctl.cpp
|
||||
|
@ -125,6 +125,7 @@ _TEST_FILES = \
|
||||
bug633762_iframe.html \
|
||||
$(srcdir)/../../reftests/backgrounds/blue-32x32.png \
|
||||
$(srcdir)/../../reftests/backgrounds/fuchsia-32x32.png \
|
||||
test_selection_splitText-normalize.html \
|
||||
$(NULL)
|
||||
|
||||
_CHROME_FILES = \
|
||||
|
173
layout/generic/test/test_selection_splitText-normalize.html
Normal file
@ -0,0 +1,173 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=191864
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 191864</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=191864">Mozilla Bug 191864</a>
|
||||
<p id="display">
|
||||
<span id="col1" style="float:left; height:800px; width:180px;"></span>
|
||||
<span id="col2" style="float:left; height:800px; width:180px;"></span>
|
||||
</p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript;version=1.7">
|
||||
var tests = [
|
||||
[ {}, [0,4], "012345678" ],
|
||||
[ {}, [0,0], "012345678" ],
|
||||
[ {}, [0,9], "012345678" ],
|
||||
[ {startOffset:4}, [0,4], "012345678" ],
|
||||
[ {startOffset:5}, [0,4], "012345678" ],
|
||||
[ {startOffset:5,endOffset:6}, [0,4], "012345678" ],
|
||||
[ {endOffset:5}, [0,4], "012345678" ],
|
||||
[ {endOffset:4}, [0,4], "012345678" ],
|
||||
[ {endOffset:3}, [0,4], "012345678" ],
|
||||
[ {startOffset:1,endOffset:3}, [0,4], "012345678" ],
|
||||
[ {startOffset:7,endOffset:7}, [0,4], "012345678" ],
|
||||
[ {startOffset:4,endOffset:4}, [0,4], "012345678" ],
|
||||
[ {endNode:1}, [0,4], "012345678", "" ],
|
||||
[ {endNode:1}, [0,4], "01234567", "8" ],
|
||||
[ {endNode:1}, [1,4], "0", "12345678" ],
|
||||
[ {endNode:2}, [1,4], "0", "12345", "678" ],
|
||||
]
|
||||
|
||||
function runtest(r,p,t) {
|
||||
// create content
|
||||
document.original_nodes = [];
|
||||
for (let i = 2; i < t.length; ++i) {
|
||||
c = document.createTextNode(t[i]);
|
||||
p.appendChild(c);
|
||||
document.original_nodes.push(c);
|
||||
}
|
||||
|
||||
// setup the range
|
||||
let sel = t[0]
|
||||
let startNode = p.firstChild;
|
||||
let startOffset = sel.startOffset === undefined ? 0 : sel.startOffset;
|
||||
let endNode = sel.endNode === undefined ? startNode : p.childNodes[sel.endNode];
|
||||
let endOffset = sel.endOffset === undefined ? endNode.length : sel.endOffset;
|
||||
r.setStart(startNode, startOffset);
|
||||
r.setEnd(endNode, endOffset);
|
||||
|
||||
// splitText
|
||||
let split = t[1]
|
||||
p.childNodes[split[0]].splitText(split[1])
|
||||
}
|
||||
function test_split(r,p,t) {
|
||||
runtest(r,p,t);
|
||||
}
|
||||
function test_split_merge(r,p,t) {
|
||||
runtest(r,p,t);
|
||||
p.normalize();
|
||||
}
|
||||
</script>
|
||||
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
/** Test for Bug 191864 **/
|
||||
|
||||
var results = [
|
||||
/* test_split */
|
||||
[ {}, [ [0, "0123"], "45678" ]],
|
||||
[ {}, [ [0, ""], "012345678" ]],
|
||||
[ {endNode:0, endOffset:9}, [ [0, "012345678"], "" ]],
|
||||
[ {startOffset:4}, [ [0, "0123"], "45678" ]],
|
||||
[ {startNode:1, startOffset:1}, [ [0, "0123"], "45678" ]],
|
||||
[ {startNode:1, startOffset:1, endOffset:2}, [ [0, "0123"], "45678" ]],
|
||||
[ {endOffset:1}, [ [0, "0123"], "45678" ]],
|
||||
[ {endNode:0}, [ [0, "0123"], "45678" ]],
|
||||
[ {endNode:0, endOffset:3}, [ [0, "0123"], "45678" ]],
|
||||
[ {startOffset:1, endNode:0, endOffset:3}, [ [0, "0123"], "45678" ]],
|
||||
[ {startNode:1, startOffset:3, endOffset:3}, [ [0, "0123"], "45678" ]],
|
||||
[ {startOffset:4, endNode:0}, [ [0, "0123"], "45678" ]],
|
||||
[ {endNode:2, endOffset:0}, [ [0, "0123"], "45678", [1, ""] ]],
|
||||
[ {endNode:2}, [ [0, "0123"], "4567", [1, "8"] ]],
|
||||
[ {endNode:2}, [ [0, "0"], [1, "1234"], "5678" ]],
|
||||
[ {endNode:3}, [ [0, "0"], [1, "1234"], "5", [2, "678"] ]],
|
||||
/* test_split_merge */
|
||||
[ {}, [ [0, "012345678" ] ]],
|
||||
[ {startParent:true}, [ "012345678" ]], /* splitText() creates an empty first child which is removed by normalize() */
|
||||
[ {}, [ [0, "012345678" ] ]],
|
||||
[ {startOffset:4}, [ [0, "012345678" ] ]],
|
||||
[ {startOffset:5}, [ [0, "012345678" ] ]],
|
||||
[ {startOffset:5,endOffset:6}, [ [0, "012345678" ] ]],
|
||||
[ {endOffset:5}, [ [0, "012345678" ] ]],
|
||||
[ {endOffset:4}, [ [0, "012345678" ] ]],
|
||||
[ {endOffset:3}, [ [0, "012345678" ] ]],
|
||||
[ {startOffset:1,endOffset:3}, [ [0, "012345678" ] ]],
|
||||
[ {startOffset:7,endOffset:7}, [ [0, "012345678" ] ]],
|
||||
[ {startOffset:4,endOffset:4}, [ [0, "012345678" ] ]],
|
||||
[ {endParent:true}, [ [0, "012345678" ] ]],
|
||||
[ {}, [ [0, "012345678" ] ]],
|
||||
[ {}, [ [0, "012345678" ] ]],
|
||||
[ {}, [ [0, "012345678" ] ]],
|
||||
]
|
||||
|
||||
function verifyResults(r,p,i) {
|
||||
let nodes = results[i][1];
|
||||
is(p.childNodes.length, nodes.length, "same number of DOM nodes" + " (test " + i + ")");
|
||||
for (let j = 0; j < nodes.length; ++j) {
|
||||
let a = nodes[j];
|
||||
let b = p.childNodes[j];
|
||||
if (a instanceof Array) {
|
||||
is(b, document.original_nodes[a[0]], "same node" + " (test " + i + " child " + j + ")");
|
||||
is(b.textContent, a[1], "contents2" + " (test " + i + " child " + j + ")");
|
||||
} else {
|
||||
is(b.nodeType, Node.TEXT_NODE, "text node" + " (test " + i + " child " + j + ")");
|
||||
is(b.textContent, a, "contents1" + " (test " + i + " child " + j + ")");
|
||||
}
|
||||
}
|
||||
let sel = results[i][0];
|
||||
if (sel.todo) {
|
||||
alert(r.startContainer + '\n' + r.startOffset + '\n' + r.endContainer + '\n' + r.endOffset + '\n')
|
||||
return;
|
||||
}
|
||||
let startNode = sel.startNode === undefined ? p.firstChild : p.childNodes[sel.startNode];
|
||||
let startOffset = sel.startOffset === undefined ? 0 : sel.startOffset;
|
||||
if (sel.startParent) { startNode = p; startOffset = 0; }
|
||||
let endNode = sel.endNode === undefined ? p.childNodes[p.childNodes.length>1 ? 1 : 0] : p.childNodes[sel.endNode];
|
||||
let endOffset = sel.endOffset === undefined ? endNode.length : sel.endOffset;
|
||||
if (sel.endParent) { endNode = p; endOffset = 1; }
|
||||
is(r.startContainer, startNode, "range start node" + " (test " + i + ")");
|
||||
is(r.startOffset, startOffset, "range start offset" + " (test " + i + ")");
|
||||
is(r.endContainer, endNode, "range end node" + " (test " + i + ")");
|
||||
is(r.endOffset, endOffset, "range end offset" + " (test " + i + ")");
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
let col1 = document.getElementById('col1');
|
||||
let col2 = document.getElementById('col2');
|
||||
for (let i=0; i < tests.length; ++i) {
|
||||
let t = tests[i];
|
||||
let p = document.createElement('p')
|
||||
col1.appendChild(p);
|
||||
let r = document.createRange();
|
||||
test_split(r,p,t);
|
||||
verifyResults(r,p,i);
|
||||
}
|
||||
for (let i=0; i < tests.length; ++i) {
|
||||
let t = tests[i];
|
||||
let p = document.createElement('p')
|
||||
col2.appendChild(p);
|
||||
let r = document.createRange();
|
||||
test_split_merge(r,p,t);
|
||||
verifyResults(r,p,i+tests.length);
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
window.onload = function() { setTimeout(runTest, 0); };
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
14
layout/reftests/svg/foreignObject-form-no-theme.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<svg xmlns='http://www.w3.org/2000/svg' width='500' height='200'>
|
||||
<foreignObject width='500' height='500'>
|
||||
<div xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<button style='-moz-appearance:none'>this is a button inside of SVG</button>
|
||||
<br/>
|
||||
<select style='-moz-appearance:none'>
|
||||
<option>This is a menu inside of SVG</option>
|
||||
<option>a second menu option</option>
|
||||
</select>
|
||||
</div>
|
||||
</foreignObject>
|
||||
</svg>
|
||||
|
||||
<!-- Bug 686581 -->
|
After Width: | Height: | Size: 469 B |
22
layout/reftests/svg/foreignObject-form-theme-ref.html
Normal file
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Testcase #2 for bug 686581</title>
|
||||
<style type="text/css">
|
||||
|
||||
html,body {
|
||||
color:black; background-color:white; font-size:16px; padding:0; margin:0;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<button>this is a button inside of SVG</button>
|
||||
<br/>
|
||||
<select>
|
||||
<option>This is a menu inside of SVG</option>
|
||||
<option>a second menu option</option>
|
||||
</select>
|
||||
|
||||
</body>
|
||||
</html>
|
14
layout/reftests/svg/foreignObject-form-theme.svg
Normal file
@ -0,0 +1,14 @@
|
||||
<svg xmlns='http://www.w3.org/2000/svg' width='500' height='200'>
|
||||
<foreignObject width='500' height='500'>
|
||||
<div xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<button>this is a button inside of SVG</button>
|
||||
<br/>
|
||||
<select>
|
||||
<option>This is a menu inside of SVG</option>
|
||||
<option>a second menu option</option>
|
||||
</select>
|
||||
</div>
|
||||
</foreignObject>
|
||||
</svg>
|
||||
|
||||
<!-- Bug 686581 -->
|
After Width: | Height: | Size: 411 B |
16
layout/reftests/svg/foreignObject-img-form-theme-ref.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Testcase for bug 686581</title>
|
||||
<style type="text/css">
|
||||
html,body {
|
||||
color:black; background-color:white; font-size:16px; padding:0; margin:0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<img src="foreignObject-form-no-theme.svg">
|
||||
|
||||
</body>
|
||||
</html>
|
16
layout/reftests/svg/foreignObject-img-form-theme.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html><head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<title>Testcase for bug 686581</title>
|
||||
<style type="text/css">
|
||||
html,body {
|
||||
color:black; background-color:white; font-size:16px; padding:0; margin:0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<img src="foreignObject-form-theme.svg">
|
||||
|
||||
</body>
|
||||
</html>
|
@ -130,6 +130,8 @@ random == dynamic-use-nested-01.svg dynamic-use-nested-01-ref.svg # bug 467498
|
||||
== foreignObject-overflow-01.svg pass.svg
|
||||
== foreignObject-start-hidden-01.svg pass.svg # followup from Bug 596765
|
||||
== foreignObject-start-hidden-02.svg pass.svg
|
||||
== foreignObject-img-form-theme.html foreignObject-img-form-theme-ref.html
|
||||
== foreignObject-form-theme.svg foreignObject-form-theme-ref.html
|
||||
== getElementById-a-element-01.svg pass.svg
|
||||
== gradient-live-01a.svg gradient-live-01-ref.svg
|
||||
== gradient-live-01b.svg gradient-live-01-ref.svg
|
||||
|
@ -194,6 +194,15 @@ GetDeviceOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
GetIsResourceDocument(nsPresContext* aPresContext, const nsMediaFeature*,
|
||||
nsCSSValue& aResult)
|
||||
{
|
||||
nsIDocument* doc = aPresContext->Document();
|
||||
aResult.SetIntValue(doc && doc->IsResourceDoc() ? 1 : 0, eCSSUnit_Integer);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Helper for two features below
|
||||
static nsresult
|
||||
MakeArray(const nsSize& aSize, nsCSSValue& aResult)
|
||||
@ -460,6 +469,13 @@ nsMediaFeatures::features[] = {
|
||||
{ kOrientationKeywords },
|
||||
GetDeviceOrientation
|
||||
},
|
||||
{
|
||||
&nsGkAtoms::_moz_is_resource_document,
|
||||
nsMediaFeature::eMinMaxNotAllowed,
|
||||
nsMediaFeature::eBoolInteger,
|
||||
{ nsnull },
|
||||
GetIsResourceDocument
|
||||
},
|
||||
{
|
||||
&nsGkAtoms::_moz_scrollbar_start_backward,
|
||||
nsMediaFeature::eMinMaxNotAllowed,
|
||||
|
@ -44,7 +44,7 @@ style, script, symbol {
|
||||
|
||||
switch {
|
||||
-moz-binding: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
svg:not(:root), symbol, image, marker, pattern, foreignObject {
|
||||
overflow: hidden;
|
||||
@ -56,6 +56,12 @@ foreignObject {
|
||||
border-width: 0 ! important;
|
||||
}
|
||||
|
||||
@media all and (-moz-is-resource-document) {
|
||||
foreignObject *|* {
|
||||
-moz-appearance: none;
|
||||
}
|
||||
}
|
||||
|
||||
*|*::-moz-svg-foreign-content {
|
||||
display: block !important;
|
||||
position: static !important;
|
||||
|
@ -59,14 +59,12 @@ var TabsPopup = {
|
||||
},
|
||||
|
||||
hide: function hide() {
|
||||
this._hidePortraitMenu();
|
||||
|
||||
if (!Util.isPortrait()) {
|
||||
Elements.urlbarState.removeAttribute("tablet_sidebar");
|
||||
ViewableAreaObserver.update();
|
||||
return;
|
||||
}
|
||||
this.box.hidden = true;
|
||||
BrowserUI.popPopup(this);
|
||||
window.removeEventListener("resize", this.resizeHandler, false);
|
||||
},
|
||||
|
||||
show: function show() {
|
||||
@ -99,6 +97,13 @@ var TabsPopup = {
|
||||
let iconURI = gFaviconService.getFaviconImageForPage(pageURI);
|
||||
icon = iconURI.spec;
|
||||
} catch(ex) { }
|
||||
} else {
|
||||
if (caption == "about:blank")
|
||||
caption = browser.currentURI.spec;
|
||||
if (!icon) {
|
||||
let iconURI = gFaviconService.getFaviconImageForPage(browser.currentURI);
|
||||
icon = iconURI.spec;
|
||||
}
|
||||
}
|
||||
item.setAttribute("img", icon);
|
||||
item.setAttribute("label", caption);
|
||||
@ -112,7 +117,12 @@ var TabsPopup = {
|
||||
this.box.anchorTo(this.button, "after_end");
|
||||
BrowserUI.pushPopup(this, [this.box, this.button]);
|
||||
|
||||
window.addEventListener("resize", this.resizeHandler.bind(this), false);
|
||||
window.addEventListener("resize", function resizeHandler(aEvent) {
|
||||
if (aEvent.target != window)
|
||||
return;
|
||||
if (!Util.isPortrait())
|
||||
TabsPopup._hidePortraitMenu();
|
||||
}, false);
|
||||
},
|
||||
|
||||
toggle: function toggle() {
|
||||
@ -126,9 +136,12 @@ var TabsPopup = {
|
||||
return Util.isPortrait() ? !this.box.hidden : Elements.urlbarState.hasAttribute("tablet_sidebar");
|
||||
},
|
||||
|
||||
resizeHandler: function(aEvent) {
|
||||
if (!Util.isPortrait())
|
||||
this.hide();
|
||||
_hidePortraitMenu: function _hidePortraitMenu() {
|
||||
if (!this.box.hidden) {
|
||||
this.box.hidden = true;
|
||||
BrowserUI.popPopup(this);
|
||||
window.removeEventListener("resize", resizeHandler, false);
|
||||
}
|
||||
},
|
||||
|
||||
closeTab: function(aTab) {
|
||||
|
@ -21,3 +21,4 @@
|
||||
<!ENTITY homepage.default "&brandShortName; Start">
|
||||
<!ENTITY homepage.currentpage "Use Current Page">
|
||||
<!ENTITY showCharsetEncoding.title "Show character encoding">
|
||||
<!ENTITY actionbar.default "&brandShortName; Settings">
|
||||
|
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 207 B |
Before Width: | Height: | Size: 299 B After Width: | Height: | Size: 252 B |
Before Width: | Height: | Size: 225 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 204 B After Width: | Height: | Size: 194 B |
Before Width: | Height: | Size: 301 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 39 KiB |
@ -180,11 +180,11 @@ toolbarbutton.urlbar-button {
|
||||
|
||||
/* add special color */
|
||||
#identity-box[mode="verifiedIdentity"] {
|
||||
background-color: #89d715;
|
||||
background-color: #c4eb8a;
|
||||
}
|
||||
|
||||
#identity-box[mode="verifiedDomain"] {
|
||||
background-color: #6579e3;
|
||||
background-color: #b2bcf1;
|
||||
}
|
||||
|
||||
#identity-popup-runBy-box,
|
||||
@ -195,8 +195,11 @@ toolbarbutton.urlbar-button {
|
||||
#urlbar-throbber[loading] {
|
||||
list-style-image: url("chrome://browser/skin/images/throbber.png");
|
||||
}
|
||||
#urlbar-throbber {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
#urlbar-throbber,
|
||||
#urlbar-favicon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
@ -1724,15 +1727,16 @@ setting {
|
||||
|
||||
/* Sync setup ------------------------------------------------------------- */
|
||||
.content-dialog > .prompt-title {
|
||||
margin: @margin_normal@ @margin_large@ 0px;
|
||||
margin: @margin_large@;
|
||||
}
|
||||
|
||||
.content-dialog > .prompt-line {
|
||||
border-bottom: @border_width_xxlarge@ solid @color_divider_border@;
|
||||
margin: 0 @margin_large@;
|
||||
}
|
||||
|
||||
.content-dialog > .prompt-line,
|
||||
.content-dialog .prompt-message {
|
||||
margin: 0px @margin_large@;
|
||||
}
|
||||
|
||||
.content-dialog .prompt-message {
|
||||
border-bottom: @border_width_tiny@ solid @color_button_border@;
|
||||
}
|
||||
|
||||
@ -1741,14 +1745,15 @@ setting {
|
||||
}
|
||||
|
||||
.syncsetup-code {
|
||||
color: @color_text_textbox@;
|
||||
background-color: @color_background_textbox@;
|
||||
font-size: @font_xlarge@ !important;
|
||||
padding: 0.2em 0.4em;
|
||||
-moz-padding-end: 0.2em;
|
||||
color: @color_text_header@;
|
||||
background-color: @color_background_header@;
|
||||
font-size: @font_xnormal@ !important;
|
||||
font-weight: bold;
|
||||
padding: .8em;
|
||||
letter-spacing: 0.2em;
|
||||
text-align: center;
|
||||
min-width: 5.5em;
|
||||
min-width: 8em;
|
||||
margin: @margin_xtiny@ 0 0 0;
|
||||
}
|
||||
|
||||
.syncsetup-label {
|
||||
@ -1760,7 +1765,7 @@ setting {
|
||||
}
|
||||
|
||||
#sync-message {
|
||||
padding-bottom: 2em;
|
||||
padding: 1em 0;
|
||||
}
|
||||
|
||||
/* content scrollbars */
|
||||
@ -1954,8 +1959,8 @@ setting {
|
||||
}
|
||||
|
||||
.documenttab-popup-checkmark {
|
||||
min-width: -moz-calc(26px + 2 * @padding_normal@); /* size of the checkmark image plus the padding */
|
||||
padding: 0px @padding_normal@;
|
||||
min-width: -moz-calc(26px + @padding_normal@) !important; /* size of the checkmark image plus the padding */
|
||||
-moz-padding-end: @padding_normal@;
|
||||
}
|
||||
|
||||
.tab-popup-item.selected .documenttab-popup-checkmark {
|
||||
|
@ -24,7 +24,7 @@
|
||||
%define color_text_button #000
|
||||
%define color_text_disabled #808080
|
||||
%define color_text_placeholder #808080
|
||||
%define color_text_as_link #febc2b
|
||||
%define color_text_as_link #69f
|
||||
%define color_background_panelrow #c8c8c8
|
||||
%define color_text_panelrow #222222
|
||||
%define color_text_toolbutton_inverse #666666
|
||||
|
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1016 B |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 221 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 232 B |
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 39 KiB |
@ -334,12 +334,6 @@ chrome.jar:
|
||||
skin/honeycomb/images/dropmarker-hdpi.png (honeycomb/images/dropmarker-hdpi.png)
|
||||
skin/honeycomb/images/ratings-18.png (images/ratings-18.png)
|
||||
skin/honeycomb/images/favicon-default-32.png (honeycomb/images/favicon-default-32.png)
|
||||
skin/honeycomb/images/endcap-default-bg.png (honeycomb/images/endcap-default-bg.png)
|
||||
skin/honeycomb/images/endcap-active-bg.png (honeycomb/images/endcap-active-bg.png)
|
||||
skin/honeycomb/images/endcap-ev-default-bg.png (honeycomb/images/endcap-ev-default-bg.png)
|
||||
skin/honeycomb/images/endcap-ev-active-bg.png (honeycomb/images/endcap-ev-active-bg.png)
|
||||
skin/honeycomb/images/endcap-ssl-default-bg.png (honeycomb/images/endcap-ssl-default-bg.png)
|
||||
skin/honeycomb/images/endcap-ssl-active-bg.png (honeycomb/images/endcap-ssl-active-bg.png)
|
||||
skin/honeycomb/images/throbber.png (honeycomb/images/throbber.png)
|
||||
skin/honeycomb/images/navigation-magnifier-30.png (honeycomb/images/navigation-magnifier-30.png)
|
||||
skin/honeycomb/images/folder-32.png (honeycomb/images/folder-32.png)
|
||||
|
@ -1,50 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libreg
|
||||
|
||||
DIRS = include src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,50 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = libreg
|
||||
|
||||
EXPORTS = VerReg.h NSReg.h
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -1,574 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* NSReg.h
|
||||
*/
|
||||
#ifndef _NSREG_H_
|
||||
#define _NSREG_H_
|
||||
|
||||
typedef void (*nr_RegPackCallbackFunc) (void *userData, int32 bytes, int32 totalBytes);
|
||||
|
||||
typedef int32 REGERR;
|
||||
typedef int32 RKEY;
|
||||
typedef uint32 REGENUM;
|
||||
typedef void * HREG;
|
||||
|
||||
typedef struct _reginfo
|
||||
{
|
||||
uint16 size; /* must be initialized to sizeof(REGINFO) */
|
||||
uint16 entryType;
|
||||
uint32 entryLength;
|
||||
} REGINFO;
|
||||
|
||||
#define REGERR_OK (0)
|
||||
#define REGERR_FAIL (1)
|
||||
#define REGERR_NOMORE (2)
|
||||
#define REGERR_NOFIND (3)
|
||||
#define REGERR_BADREAD (4)
|
||||
#define REGERR_BADLOCN (5)
|
||||
#define REGERR_PARAM (6)
|
||||
#define REGERR_BADMAGIC (7)
|
||||
#define REGERR_BADCHECK (8)
|
||||
#define REGERR_NOFILE (9)
|
||||
#define REGERR_MEMORY (10)
|
||||
#define REGERR_BUFTOOSMALL (11)
|
||||
#define REGERR_NAMETOOLONG (12)
|
||||
#define REGERR_REGVERSION (13)
|
||||
#define REGERR_DELETED (14)
|
||||
#define REGERR_BADTYPE (15)
|
||||
#define REGERR_NOPATH (16)
|
||||
#define REGERR_BADNAME (17)
|
||||
#define REGERR_READONLY (18)
|
||||
#define REGERR_BADUTF8 (19)
|
||||
|
||||
|
||||
/* Total path length */
|
||||
#define MAXREGPATHLEN (2048)
|
||||
/* Name on the path (including null terminator) */
|
||||
#define MAXREGNAMELEN (512)
|
||||
/* Value of an entry */
|
||||
#define MAXREGVALUELEN (0x7FFF)
|
||||
|
||||
/* Standard keys */
|
||||
#define ROOTKEY_USERS (0x01)
|
||||
#define ROOTKEY_COMMON (0x02)
|
||||
#define ROOTKEY_CURRENT_USER (0x03)
|
||||
#define ROOTKEY_PRIVATE (0x04)
|
||||
|
||||
/* enumeration styles */
|
||||
#define REGENUM_NORMAL (0x00)
|
||||
#define REGENUM_CHILDREN REGENUM_NORMAL
|
||||
#define REGENUM_DESCEND (0x01)
|
||||
#define REGENUM_DEPTH_FIRST (0x02)
|
||||
|
||||
/* entry data types */
|
||||
#define REGTYPE_ENTRY (0x0010)
|
||||
#define REGTYPE_ENTRY_STRING_UTF (REGTYPE_ENTRY + 1)
|
||||
#define REGTYPE_ENTRY_INT32_ARRAY (REGTYPE_ENTRY + 2)
|
||||
#define REGTYPE_ENTRY_BYTES (REGTYPE_ENTRY + 3)
|
||||
#define REGTYPE_ENTRY_FILE (REGTYPE_ENTRY + 4)
|
||||
|
||||
#define REG_DELETE_LIST_KEY "Mozilla/XPInstall/Delete List"
|
||||
#define REG_REPLACE_LIST_KEY "Mozilla/XPInstall/Replace List"
|
||||
#define REG_UNINSTALL_DIR "Mozilla/XPInstall/Uninstall/"
|
||||
#define REG_REPLACE_SRCFILE "ReplacementFile"
|
||||
#define REG_REPLACE_DESTFILE "DestinationFile"
|
||||
|
||||
#define UNINSTALL_NAV_STR "_"
|
||||
|
||||
|
||||
#define UNIX_GLOBAL_FLAG "MOZILLA_SHARED_REGISTRY"
|
||||
|
||||
/* libreg functions are not DLLexported and may have hidden visibility */
|
||||
#define VR_INTERFACE(type) type
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Registry API -- General
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegSetBufferSize - Sets the file buffer size
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle to opened registry
|
||||
* bufsize - size of the new buffer
|
||||
*
|
||||
* Output:
|
||||
* ---------------------------------------------------------------------
|
||||
* returns the size of the buffer or -1 for err
|
||||
*/
|
||||
VR_INTERFACE(int) NR_RegSetBufferSize(
|
||||
HREG hReg, /* handle to opened registry */
|
||||
int bufsize
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegOpen - Open a netscape XP registry
|
||||
*
|
||||
* Parameters:
|
||||
* filename - registry file to open. NULL or "" opens the standard
|
||||
* local registry.
|
||||
* hReg - OUT: handle to opened registry
|
||||
*
|
||||
* Output:
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegOpen(
|
||||
const char *filename, /* reg. file to open (NULL == standard registry) */
|
||||
HREG *hReg /* OUT: handle to opened registry */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegClose - Close a netscape XP registry
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry to be closed.
|
||||
*
|
||||
* After calling this routine the handle is no longer valid
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegClose(
|
||||
HREG hReg /* handle of open registry to close */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegFlush - Manually flush data in a netscape XP registry
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry to be flushed.
|
||||
*
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegFlush(
|
||||
HREG hReg /* handle of open registry to flush */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegIsWritable - Check read/write status of open registry
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry to query
|
||||
* Returns:
|
||||
* REGERR_OK if writable, REGERR_READONLY if not, possibly
|
||||
* other errors for an invalid hReg
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegIsWritable(
|
||||
HREG hReg /* handle of open registry to query */
|
||||
);
|
||||
|
||||
VR_INTERFACE(REGERR) NR_RegPack(
|
||||
HREG hReg, /* handle of open registry to pack */
|
||||
void *userData,
|
||||
nr_RegPackCallbackFunc fn
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegSetUsername - Set the current username
|
||||
*
|
||||
* If the current user profile name is not set then trying to use
|
||||
* HKEY_CURRENT_USER will result in an error.
|
||||
*
|
||||
* Parameters:
|
||||
* name - name of the current user
|
||||
*
|
||||
* Output:
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegSetUsername(
|
||||
const char *name /* name of current user */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegGetUniqueName
|
||||
*
|
||||
* Returns a unique name that can be used for anonymous key/value names
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* outbuf - where to put the string
|
||||
* buflen - how big the buffer is
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegGetUniqueName(
|
||||
HREG hReg, /* handle of open registry */
|
||||
char* outbuf, /* buffer to hold key name */
|
||||
uint32 buflen /* size of buffer */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* DO NOT USE -- Will be removed
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegGetUsername(
|
||||
char **name /* on return, an alloc'ed copy of the current user name */
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Registry API -- Key Management functions
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegAddKey - Add a key node to the registry
|
||||
*
|
||||
* Can also be used to find an existing node for convenience.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - registry key obtained from NR_RegGetKey(),
|
||||
* or one of the standard top-level keys
|
||||
* path - relative path of key to be added. Intermediate
|
||||
* nodes will be added if necessary.
|
||||
* newkey - If not null returns RKEY of new or found node
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegAddKey(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *path, /* relative path of subkey to add */
|
||||
RKEY *newKey /* if not null returns newly created key */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegAddKeyRaw - Add a key node to the registry
|
||||
*
|
||||
* This routine is different from NR_RegAddKey() in that it takes
|
||||
* a keyname rather than a path.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - registry key obtained from NR_RegGetKey(),
|
||||
* or one of the standard top-level keys
|
||||
* keyname - name of key to be added. No parsing of this
|
||||
* name happens.
|
||||
* newkey - if not null the RKEY of the new key is returned
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegAddKeyRaw(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *keyname, /* name of key to add */
|
||||
RKEY *newKey /* if not null returns newly created key */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegDeleteKey - Delete the specified key
|
||||
*
|
||||
* Note that delete simply orphans blocks and makes no attempt
|
||||
* to reclaim space in the file. Use NR_RegPack()
|
||||
*
|
||||
* Cannot be used to delete keys with child keys
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - starting node RKEY, typically one of the standard ones.
|
||||
* path - relative path of key to delete
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegDeleteKey(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *path /* relative path of subkey to delete */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegDeleteKeyRaw - Delete the specified raw key
|
||||
*
|
||||
* Note that delete simply orphans blocks and makes no attempt
|
||||
* to reclaim space in the file. Use NR_RegPack()
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY or parent to the raw key you wish to delete
|
||||
* keyname - name of child key to delete
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegDeleteKeyRaw(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *keyname /* name subkey to delete */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegGetKey - Get the RKEY value of a node from its path
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - starting node RKEY, typically one of the standard ones.
|
||||
* path - relative path of key to find. (a blank path just gives you
|
||||
* the starting key--useful for verification, VersionRegistry)
|
||||
* result - if successful the RKEY of the specified sub-key
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegGetKey(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
const char *path, /* relative path of subkey to find */
|
||||
RKEY *result /* returns RKEY of specified sub-key */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegGetKeyRaw - Get the RKEY value of a node from its keyname
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - starting node RKEY, typically one of the standard ones.
|
||||
* keyname - keyname of key to find. (a blank keyname just gives you
|
||||
* the starting key--useful for verification, VersionRegistry)
|
||||
* result - if successful the RKEY of the specified sub-key
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegGetKeyRaw(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* root key */
|
||||
char *keyname, /* name of key to get */
|
||||
RKEY *result /* returns RKEY of specified sub-key */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegEnumSubkeys - Enumerate the subkey names for the specified key
|
||||
*
|
||||
* Returns REGERR_NOMORE at end of enumeration.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key to enumerate--obtain with NR_RegGetKey()
|
||||
* eState - enumerations state, must contain NULL to start
|
||||
* buffer - location to store subkey names. Once an enumeration
|
||||
* is started user must not modify contents since values
|
||||
* are built using the previous contents.
|
||||
* bufsize - size of buffer for names
|
||||
* style - 0 returns direct child keys only, REGENUM_DESCEND
|
||||
* returns entire sub-tree
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegEnumSubkeys(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
REGENUM *state, /* enum state, must be NULL to start */
|
||||
char *buffer, /* buffer for entry names */
|
||||
uint32 bufsize, /* size of buffer */
|
||||
uint32 style /* 0: children only; REGENUM_DESCEND: sub-tree */
|
||||
);
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* Registry API -- Entry Management functions
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegGetEntryInfo - Get some basic info about the entry data
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key that contains entry--obtain with NR_RegGetKey()
|
||||
* name - name of entry
|
||||
* info - return: Entry info object
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegGetEntryInfo(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
REGINFO *info /* returned entry info */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegGetEntryString - Get the UTF string value associated with the
|
||||
* named entry of the specified key.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key that contains entry--obtain with NR_RegGetKey()
|
||||
* name - name of entry
|
||||
* buffer - destination for string
|
||||
* bufsize - size of buffer
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegGetEntryString(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
const char *name, /* entry name */
|
||||
char *buffer, /* buffer to hold value (UTF String) */
|
||||
uint32 bufsize /* length of buffer */
|
||||
);
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegGetEntry - Get the value data associated with the
|
||||
* named entry of the specified key.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key that contains entry--obtain with NR_RegGetKey()
|
||||
* name - name of entry
|
||||
* buffer - destination for data
|
||||
* size - in: size of buffer
|
||||
* out: size of actual data (incl. \0 term. for strings)
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegGetEntry(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
void *buffer, /* buffer to hold value */
|
||||
uint32 *size /* in:length of buffer */
|
||||
); /* out: data length, >>includes<< null terminator*/
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegSetEntryString - Store a UTF-8 string value associated with the
|
||||
* named entry of the specified key. Used for
|
||||
* both creation and update.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key that contains entry--obtain with NR_RegGetKey()
|
||||
* name - name of entry
|
||||
* buffer - UTF-8 String to store
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegSetEntryString(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
char *buffer /* UTF String value */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegSetEntry - Store value data associated with the named entry
|
||||
* of the specified key. Used for both creation and update.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key that contains entry--obtain with NR_RegGetKey()
|
||||
* name - name of entry
|
||||
* type - type of data to be stored
|
||||
* buffer - data to store
|
||||
* size - length of data to store in bytes
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegSetEntry(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name, /* entry name */
|
||||
uint16 type, /* type of value data */
|
||||
void *buffer, /* data buffer */
|
||||
uint32 size /* data length in bytes; incl. null term for strings */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegDeleteEntry - Delete the named entry
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key that contains entry--obtain with NR_RegGetKey()
|
||||
* name - name of entry
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegDeleteEntry(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
char *name /* value name */
|
||||
);
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* NR_RegEnumEntries - Enumerate the entry names for the specified key
|
||||
*
|
||||
* Returns REGERR_NOMORE at end of enumeration.
|
||||
*
|
||||
* Parameters:
|
||||
* hReg - handle of open registry
|
||||
* key - RKEY of key that contains entry--obtain with NR_RegGetKey()
|
||||
* eState - enumerations state, must contain NULL to start
|
||||
* buffer - location to store entry names
|
||||
* bufsize - size of buffer for names
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
VR_INTERFACE(REGERR) NR_RegEnumEntries(
|
||||
HREG hReg, /* handle of open registry */
|
||||
RKEY key, /* containing key */
|
||||
REGENUM *state, /* enum state, must be NULL to start */
|
||||
char *buffer, /* buffer for entry names */
|
||||
uint32 bufsize, /* size of buffer */
|
||||
REGINFO *info /* optional; returns info about entry */
|
||||
);
|
||||
|
||||
|
||||
VR_INTERFACE(void) NR_ShutdownRegistry(void);
|
||||
VR_INTERFACE(REGERR) NR_StartupRegistry(void);
|
||||
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* _NSREG_H_ */
|
||||
|
||||
/* EOF: NSReg.h */
|
||||
|
@ -1,105 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* VerReg.h
|
||||
* XP Version Registry functions
|
||||
*/
|
||||
#ifndef _VERREG_H_
|
||||
#define _VERREG_H_
|
||||
|
||||
#include "NSReg.h"
|
||||
|
||||
typedef struct _version
|
||||
{
|
||||
int32 major;
|
||||
int32 minor;
|
||||
int32 release;
|
||||
int32 build;
|
||||
int32 check;
|
||||
} VERSION;
|
||||
|
||||
|
||||
/* CreateRegistry flags */
|
||||
#define CR_NEWREGISTRY 1
|
||||
|
||||
PR_BEGIN_EXTERN_C
|
||||
/* ---------------------------------------------------------------------
|
||||
* Version Registry Operations
|
||||
* ---------------------------------------------------------------------
|
||||
*/
|
||||
/* global registry operations */
|
||||
/* VR_CreateRegistry is available only in the STANDALONE_REGISTRY builds */
|
||||
VR_INTERFACE(REGERR) VR_CreateRegistry(char *installation, char *programPath, char *versionStr);
|
||||
VR_INTERFACE(REGERR) VR_SetRegDirectory(const char *path);
|
||||
VR_INTERFACE(REGERR) VR_PackRegistry(void *userData, nr_RegPackCallbackFunc pdCallbackFunction);
|
||||
VR_INTERFACE(REGERR) VR_Close(void);
|
||||
|
||||
/* component-level functions */
|
||||
VR_INTERFACE(REGERR) VR_Install(char *component_path, char *filepath, char *version, int bDirectory);
|
||||
VR_INTERFACE(REGERR) VR_Remove(char *component_path);
|
||||
VR_INTERFACE(REGERR) VR_InRegistry(char *path);
|
||||
VR_INTERFACE(REGERR) VR_ValidateComponent(char *path);
|
||||
VR_INTERFACE(REGERR) VR_Enum(char *component_path, REGENUM *state, char *buffer, uint32 buflen);
|
||||
|
||||
/* dealing with parts of individual components */
|
||||
VR_INTERFACE(REGERR) VR_GetVersion(char *component_path, VERSION *result);
|
||||
VR_INTERFACE(REGERR) VR_GetPath(char *component_path, uint32 sizebuf, char *buf);
|
||||
VR_INTERFACE(REGERR) VR_SetRefCount(char *component_path, int refcount);
|
||||
VR_INTERFACE(REGERR) VR_GetRefCount(char *component_path, int *result);
|
||||
VR_INTERFACE(REGERR) VR_GetDefaultDirectory(char *component_path, uint32 sizebuf, char *buf);
|
||||
VR_INTERFACE(REGERR) VR_SetDefaultDirectory(char *component_path, char *directory);
|
||||
|
||||
/* uninstall functions */
|
||||
VR_INTERFACE(REGERR) VR_UninstallCreateNode(char *regPackageName, char *userPackageName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallAddFileToList(char *regPackageName, char *vrName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallFileExistsInList(char *regPackageName, char *vrName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallEnumSharedFiles(char *component_path, REGENUM *state, char *buffer, uint32 buflen);
|
||||
VR_INTERFACE(REGERR) VR_UninstallDeleteFileFromList(char *component_path, char *vrName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallDeleteSharedFilesKey(char *regPackageName);
|
||||
VR_INTERFACE(REGERR) VR_UninstallDestroy(char *regPackageName);
|
||||
VR_INTERFACE(REGERR) VR_EnumUninstall(REGENUM *state, char* userPackageName,
|
||||
int32 len1, char*regPackageName, int32 len2, XP_Bool bSharedList);
|
||||
VR_INTERFACE(REGERR) VR_GetUninstallUserName(char *regPackageName, char *outbuf, uint32 buflen);
|
||||
|
||||
PR_END_EXTERN_C
|
||||
|
||||
#endif /* _VERREG_H_ */
|
||||
|
||||
/* EOF: VerReg.h */
|
||||
|
@ -1,82 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(srcdir)/objs.mk
|
||||
|
||||
MODULE = libreg
|
||||
LIBRARY_NAME = mozreg_s
|
||||
DIST_INSTALL = 1
|
||||
|
||||
CSRCS = $(MODULES_LIBREG_SRC_LCSRCS) nr_bufio.c
|
||||
|
||||
BIN_SRCS = VerReg.c reg.c vr_stubs.c
|
||||
PROGOBJS = $(addprefix R_,$(BIN_SRCS:.c=.o))
|
||||
|
||||
# We don't want a shared lib. Static lib only.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
# Force use of PIC
|
||||
FORCE_USE_PIC = 1
|
||||
|
||||
# We do want this in the static libraries list
|
||||
EXPORT_LIBRARY = 1
|
||||
|
||||
USE_STATIC_LIBS = 1
|
||||
|
||||
SDK_LIBRARY = $(LIBRARY)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
DEFINES += -DUSE_BUFFERED_REGISTRY_IO
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
R_%.o: %.c
|
||||
$(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) -DSTANDALONE_REGISTRY $<
|
||||
|
||||
ifdef _MSC_VER
|
||||
# Don't include directives about which CRT to use
|
||||
OS_COMPILE_CXXFLAGS += -Zl
|
||||
OS_COMPILE_CFLAGS += -Zl
|
||||
DEFINES += -D_USE_ANSI_CPP
|
||||
endif
|
@ -1,758 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Edward Kandrot <kandrot@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/*------------------------------------------------------------------------
|
||||
* nr_bufio
|
||||
*
|
||||
* Buffered I/O routines to improve registry performance
|
||||
* the routines mirror fopen(), fclose() et al
|
||||
*
|
||||
* Inspired by the performance gains James L. Nance <jim_nance@yahoo.com>
|
||||
* got using NSPR memory-mapped I/O for the registry. Unfortunately NSPR
|
||||
* doesn't support mmapio on the Mac.
|
||||
*-----------------------------------------------------------------------*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
#include <Carbon/Carbon.h>
|
||||
#endif
|
||||
|
||||
#if defined(SUNOS4)
|
||||
#include <unistd.h> /* for SEEK_SET */
|
||||
#endif /* SUNOS4 */
|
||||
|
||||
#include "prerror.h"
|
||||
#include "prlog.h"
|
||||
|
||||
#include "vr_stubs.h"
|
||||
#include "nr_bufio.h"
|
||||
|
||||
|
||||
#define BUFIO_BUFSIZE_DEFAULT 0x2000
|
||||
|
||||
#define STARTS_IN_BUF(f) ((f->fpos >= f->datastart) && \
|
||||
(f->fpos < (f->datastart+f->datasize)))
|
||||
|
||||
#define ENDS_IN_BUF(f,c) (((f->fpos + c) > (PRUint32)f->datastart) && \
|
||||
((f->fpos + c) <= (PRUint32)(f->datastart+f->datasize)))
|
||||
|
||||
#if DEBUG_dougt
|
||||
static num_reads = 0;
|
||||
#endif
|
||||
|
||||
|
||||
struct BufioFileStruct
|
||||
{
|
||||
FILE *fd; /* real file descriptor */
|
||||
PRInt32 fsize; /* total size of file */
|
||||
PRInt32 fpos; /* our logical position in the file */
|
||||
PRInt32 datastart; /* the file position at which the buffer starts */
|
||||
PRInt32 datasize; /* the amount of data actually in the buffer*/
|
||||
PRInt32 bufsize; /* size of the in memory buffer */
|
||||
PRBool bufdirty; /* whether the buffer been written to */
|
||||
PRInt32 dirtystart;
|
||||
PRInt32 dirtyend;
|
||||
PRBool readOnly; /* whether the file allows writing or not */
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
PRUint32 reads;
|
||||
PRUint32 writes;
|
||||
#endif
|
||||
char *data; /* the data buffer */
|
||||
};
|
||||
|
||||
|
||||
static PRBool _bufio_loadBuf( BufioFile* file, PRUint32 count );
|
||||
static int _bufio_flushBuf( BufioFile* file );
|
||||
|
||||
#ifdef XP_OS2
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <share.h>
|
||||
#include <io.h>
|
||||
|
||||
FILE* os2_fileopen(const char* name, const char* mode)
|
||||
{
|
||||
int access = O_RDWR;
|
||||
int descriptor;
|
||||
int pmode = 0;
|
||||
|
||||
/* Fail if only one character is passed in - this shouldn't happen */
|
||||
if (mode[1] == '\0') {
|
||||
return NULL;
|
||||
}
|
||||
/* Only possible options are wb+, rb+, wb and rb */
|
||||
if (mode[0] == 'w' && mode[1] == 'b') {
|
||||
access |= (O_TRUNC | O_CREAT);
|
||||
if (mode[2] == '+') {
|
||||
access |= O_RDWR;
|
||||
pmode = S_IREAD | S_IWRITE;
|
||||
} else {
|
||||
access |= O_WRONLY;
|
||||
pmode = S_IWRITE;
|
||||
}
|
||||
}
|
||||
if (mode[0] == 'r' && mode[1] == 'b') {
|
||||
if (mode[2] == '+') {
|
||||
access |= O_RDWR;
|
||||
pmode = S_IREAD | S_IWRITE;
|
||||
} else {
|
||||
access = O_RDONLY;
|
||||
pmode = S_IREAD;
|
||||
}
|
||||
}
|
||||
|
||||
descriptor = sopen(name, access, SH_DENYNO, pmode);
|
||||
if (descriptor != -1) {
|
||||
return fdopen(descriptor, mode);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* like fopen() this routine takes *native* filenames, not NSPR names.
|
||||
*/
|
||||
BufioFile* bufio_Open(const char* name, const char* mode)
|
||||
{
|
||||
FILE *fd;
|
||||
BufioFile *file = NULL;
|
||||
|
||||
#ifdef XP_OS2
|
||||
fd = os2_fileopen( name, mode );
|
||||
#else
|
||||
fd = fopen( name, mode );
|
||||
#endif
|
||||
|
||||
if ( fd )
|
||||
{
|
||||
/* file opened successfully, initialize the bufio structure */
|
||||
|
||||
file = PR_NEWZAP( BufioFile );
|
||||
if ( file )
|
||||
{
|
||||
file->fd = fd;
|
||||
file->bufsize = BUFIO_BUFSIZE_DEFAULT; /* set the default buffer size */
|
||||
|
||||
file->data = (char*)PR_Malloc( file->bufsize );
|
||||
if ( file->data )
|
||||
{
|
||||
/* get file size to finish initialization of bufio */
|
||||
if ( !fseek( fd, 0, SEEK_END ) )
|
||||
{
|
||||
file->fsize = ftell( fd );
|
||||
|
||||
file->readOnly = strcmp(mode,XP_FILE_READ) == 0 ||
|
||||
strcmp(mode,XP_FILE_READ_BIN) == 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
PR_Free( file->data );
|
||||
PR_DELETE( file );
|
||||
}
|
||||
}
|
||||
else
|
||||
PR_DELETE( file );
|
||||
}
|
||||
|
||||
/* close file if we couldn't create BufioFile */
|
||||
if (!file)
|
||||
{
|
||||
fclose( fd );
|
||||
PR_SetError( PR_OUT_OF_MEMORY_ERROR, 0 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* couldn't open file. Figure out why and set NSPR errors */
|
||||
|
||||
switch (errno)
|
||||
{
|
||||
/* file not found */
|
||||
#if defined(XP_MACOSX)
|
||||
case fnfErr:
|
||||
#else
|
||||
case ENOENT:
|
||||
#endif
|
||||
PR_SetError(PR_FILE_NOT_FOUND_ERROR,0);
|
||||
break;
|
||||
|
||||
/* file in use */
|
||||
#if defined(XP_MACOSX)
|
||||
case opWrErr:
|
||||
#else
|
||||
case EACCES:
|
||||
#endif
|
||||
PR_SetError(PR_NO_ACCESS_RIGHTS_ERROR,0);
|
||||
break;
|
||||
|
||||
default:
|
||||
PR_SetError(PR_UNKNOWN_ERROR,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* close the buffered file and destroy BufioFile struct
|
||||
*/
|
||||
int bufio_Close(BufioFile* file)
|
||||
{
|
||||
int retval = -1;
|
||||
|
||||
if ( file )
|
||||
{
|
||||
if ( file->bufdirty )
|
||||
_bufio_flushBuf( file );
|
||||
|
||||
retval = fclose( file->fd );
|
||||
|
||||
if ( file->data )
|
||||
PR_Free( file->data );
|
||||
|
||||
PR_DELETE( file );
|
||||
#if DEBUG_dougt
|
||||
printf(" --- > Buffered registry read fs hits (%d)\n", num_reads);
|
||||
#endif
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* change the logical position in the file. Equivalent to fseek()
|
||||
*/
|
||||
int bufio_Seek(BufioFile* file, PRInt32 offset, int whence)
|
||||
{
|
||||
if (!file)
|
||||
return -1;
|
||||
|
||||
switch(whence)
|
||||
{
|
||||
case SEEK_SET:
|
||||
file->fpos = offset;
|
||||
break;
|
||||
case SEEK_END:
|
||||
file->fpos = file->fsize + offset;
|
||||
break;
|
||||
case SEEK_CUR:
|
||||
file->fpos = file->fpos + offset;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ( file->fpos < 0 )
|
||||
file->fpos = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* like ftell() returns the current position in the file, or -1 for error
|
||||
*/
|
||||
PRInt32 bufio_Tell(BufioFile* file)
|
||||
{
|
||||
if (file)
|
||||
return file->fpos;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
PRUint32 bufio_Read(BufioFile* file, char* dest, PRUint32 count)
|
||||
{
|
||||
PRInt32 startOffset;
|
||||
PRInt32 endOffset;
|
||||
PRInt32 leftover;
|
||||
PRUint32 bytesCopied;
|
||||
PRUint32 bytesRead;
|
||||
PRUint32 retcount = 0;
|
||||
|
||||
/* sanity check arguments */
|
||||
if ( !file || !dest || count == 0 || file->fpos >= file->fsize )
|
||||
return 0;
|
||||
|
||||
/* Adjust amount to read if we're near EOF */
|
||||
if ( (file->fpos + count) > (PRUint32)file->fsize )
|
||||
count = file->fsize - file->fpos;
|
||||
|
||||
|
||||
/* figure out how much of the data we want is already buffered */
|
||||
|
||||
startOffset = file->fpos - file->datastart;
|
||||
endOffset = startOffset + count;
|
||||
|
||||
if ( startOffset >= 0 && startOffset < file->datasize )
|
||||
{
|
||||
/* The beginning of what we want is in the buffer */
|
||||
/* so copy as much as is available of what we want */
|
||||
|
||||
if ( endOffset <= file->datasize )
|
||||
bytesCopied = count;
|
||||
else
|
||||
bytesCopied = file->datasize - startOffset;
|
||||
|
||||
memcpy( dest, file->data + startOffset, bytesCopied );
|
||||
retcount = bytesCopied;
|
||||
file->fpos += bytesCopied;
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
file->reads++;
|
||||
#endif
|
||||
|
||||
/* Was that all we wanted, or do we need to get more? */
|
||||
|
||||
leftover = count - bytesCopied;
|
||||
PR_ASSERT( leftover >= 0 ); /* negative left? something's wrong! */
|
||||
|
||||
if ( leftover )
|
||||
{
|
||||
/* need data that's not in the buffer */
|
||||
|
||||
/* if what's left fits in a buffer then load the buffer with the */
|
||||
/* new area before giving the data, otherwise just read right */
|
||||
/* into the user's dest buffer */
|
||||
|
||||
if ( _bufio_loadBuf( file, leftover ) )
|
||||
{
|
||||
startOffset = file->fpos - file->datastart;
|
||||
|
||||
/* we may not have been able to load as much as we wanted */
|
||||
if ( startOffset > file->datasize )
|
||||
bytesRead = 0;
|
||||
else if ( startOffset+leftover <= file->datasize )
|
||||
bytesRead = leftover;
|
||||
else
|
||||
bytesRead = file->datasize - startOffset;
|
||||
|
||||
if ( bytesRead )
|
||||
{
|
||||
memcpy( dest+bytesCopied, file->data+startOffset, bytesRead );
|
||||
file->fpos += bytesRead;
|
||||
retcount += bytesRead;
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
file->reads++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* we need more than we could load into a buffer, so */
|
||||
/* skip buffering and just read the data directly */
|
||||
|
||||
if ( fseek( file->fd, file->fpos, SEEK_SET ) == 0 )
|
||||
{
|
||||
#if DEBUG_dougt
|
||||
++num_reads;
|
||||
#endif
|
||||
bytesRead = fread(dest+bytesCopied, 1, leftover, file->fd);
|
||||
file->fpos += bytesRead;
|
||||
retcount += bytesRead;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* XXX seek failed, couldn't load more data -- help! */
|
||||
/* should we call PR_SetError() ? */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* range doesn't start in the loaded buffer but it might end there */
|
||||
if ( endOffset > 0 && endOffset <= file->datasize )
|
||||
bytesCopied = endOffset;
|
||||
else
|
||||
bytesCopied = 0;
|
||||
|
||||
leftover = count - bytesCopied;
|
||||
|
||||
if ( bytesCopied )
|
||||
{
|
||||
/* the tail end of the range we want is already buffered */
|
||||
/* first copy the buffered data to the dest area */
|
||||
memcpy( dest+leftover, file->data, bytesCopied );
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
file->reads++;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* now pick up the part that's not already in the buffer */
|
||||
|
||||
if ( _bufio_loadBuf( file, leftover ) )
|
||||
{
|
||||
/* we were able to load some data */
|
||||
startOffset = file->fpos - file->datastart;
|
||||
|
||||
/* we may not have been able to read as much as we wanted */
|
||||
if ( startOffset > file->datasize )
|
||||
bytesRead = 0;
|
||||
else if ( startOffset+leftover <= file->datasize )
|
||||
bytesRead = leftover;
|
||||
else
|
||||
bytesRead = file->datasize - startOffset;
|
||||
|
||||
if ( bytesRead )
|
||||
{
|
||||
memcpy( dest, file->data+startOffset, bytesRead );
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
file->reads++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* leftover data doesn't fit so skip buffering */
|
||||
if ( fseek( file->fd, file->fpos, SEEK_SET ) == 0 )
|
||||
{
|
||||
bytesRead = fread(dest, 1, leftover, file->fd);
|
||||
#if DEBUG_dougt
|
||||
++num_reads;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
bytesRead = 0;
|
||||
}
|
||||
|
||||
/* if we couldn't read all the leftover, don't tell caller */
|
||||
/* about the tail end we copied from the first buffer */
|
||||
if ( bytesRead == (PRUint32)leftover )
|
||||
retcount = bytesCopied + bytesRead;
|
||||
else
|
||||
retcount = bytesRead;
|
||||
|
||||
file->fpos += retcount;
|
||||
}
|
||||
|
||||
return retcount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Buffered writes
|
||||
*/
|
||||
PRUint32 bufio_Write(BufioFile* file, const char* src, PRUint32 count)
|
||||
{
|
||||
const char* newsrc;
|
||||
PRInt32 startOffset;
|
||||
PRInt32 endOffset;
|
||||
PRUint32 leftover;
|
||||
PRUint32 retcount = 0;
|
||||
PRUint32 bytesWritten = 0;
|
||||
PRUint32 bytesCopied = 0;
|
||||
|
||||
/* sanity check arguments */
|
||||
if ( !file || !src || count == 0 || file->readOnly )
|
||||
return 0;
|
||||
|
||||
/* Write to the current buffer if we can, otherwise load a new buffer */
|
||||
|
||||
startOffset = file->fpos - file->datastart;
|
||||
endOffset = startOffset + count;
|
||||
|
||||
if ( startOffset >= 0 && startOffset < file->bufsize )
|
||||
{
|
||||
/* the area we want to write starts in the buffer */
|
||||
|
||||
if ( endOffset <= file->bufsize )
|
||||
bytesCopied = count;
|
||||
else
|
||||
bytesCopied = file->bufsize - startOffset;
|
||||
|
||||
memcpy( file->data + startOffset, src, bytesCopied );
|
||||
file->bufdirty = PR_TRUE;
|
||||
endOffset = startOffset + bytesCopied;
|
||||
file->dirtystart = PR_MIN( startOffset, file->dirtystart );
|
||||
file->dirtyend = PR_MAX( endOffset, file->dirtyend );
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
file->writes++;
|
||||
#endif
|
||||
|
||||
if ( endOffset > file->datasize )
|
||||
file->datasize = endOffset;
|
||||
|
||||
retcount = bytesCopied;
|
||||
file->fpos += bytesCopied;
|
||||
|
||||
/* was that all we had to write, or is there more? */
|
||||
leftover = count - bytesCopied;
|
||||
newsrc = src+bytesCopied;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* range doesn't start in the loaded buffer but it might end there */
|
||||
if ( endOffset > 0 && endOffset <= file->bufsize )
|
||||
bytesCopied = endOffset;
|
||||
else
|
||||
bytesCopied = 0;
|
||||
|
||||
leftover = count - bytesCopied;
|
||||
newsrc = src;
|
||||
|
||||
if ( bytesCopied )
|
||||
{
|
||||
/* the tail end of the write range is already in the buffer */
|
||||
memcpy( file->data, src+leftover, bytesCopied );
|
||||
file->bufdirty = PR_TRUE;
|
||||
file->dirtystart = 0;
|
||||
file->dirtyend = PR_MAX( endOffset, file->dirtyend );
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
file->writes++;
|
||||
#endif
|
||||
|
||||
if ( endOffset > file->datasize )
|
||||
file->datasize = endOffset;
|
||||
}
|
||||
}
|
||||
|
||||
/* if we only wrote part of the request pick up the leftovers */
|
||||
if ( leftover )
|
||||
{
|
||||
/* load the buffer with the new range, if possible */
|
||||
if ( _bufio_loadBuf( file, leftover ) )
|
||||
{
|
||||
startOffset = file->fpos - file->datastart;
|
||||
endOffset = startOffset + leftover;
|
||||
|
||||
memcpy( file->data+startOffset, newsrc, leftover );
|
||||
file->bufdirty = PR_TRUE;
|
||||
file->dirtystart = startOffset;
|
||||
file->dirtyend = endOffset;
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
file->writes++;
|
||||
#endif
|
||||
if ( endOffset > file->datasize )
|
||||
file->datasize = endOffset;
|
||||
|
||||
bytesWritten = leftover;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* request didn't fit in a buffer, write directly */
|
||||
if ( fseek( file->fd, file->fpos, SEEK_SET ) == 0 )
|
||||
bytesWritten = fwrite( newsrc, 1, leftover, file->fd );
|
||||
else
|
||||
bytesWritten = 0; /* seek failed! */
|
||||
}
|
||||
|
||||
if ( retcount )
|
||||
{
|
||||
/* we already counted the first part we wrote */
|
||||
retcount += bytesWritten;
|
||||
file->fpos += bytesWritten;
|
||||
}
|
||||
else
|
||||
{
|
||||
retcount = bytesCopied + bytesWritten;
|
||||
file->fpos += retcount;
|
||||
}
|
||||
}
|
||||
|
||||
if ( file->fpos > file->fsize )
|
||||
file->fsize = file->fpos;
|
||||
|
||||
return retcount;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int bufio_Flush(BufioFile* file)
|
||||
{
|
||||
if ( file->bufdirty )
|
||||
_bufio_flushBuf( file );
|
||||
|
||||
return fflush(file->fd);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* internal helper functions
|
||||
*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
* Attempts to load the buffer with the requested amount of data.
|
||||
* Returns PR_TRUE if it was able to load *some* of the requested
|
||||
* data, but not necessarily all. Returns PR_FALSE if the read fails
|
||||
* or if the requested amount wouldn't fit in the buffer.
|
||||
*/
|
||||
static PRBool _bufio_loadBuf( BufioFile* file, PRUint32 count )
|
||||
{
|
||||
PRInt32 startBuf;
|
||||
PRInt32 endPos;
|
||||
PRInt32 endBuf;
|
||||
PRUint32 bytesRead;
|
||||
|
||||
/* no point in buffering more than the physical buffer will hold */
|
||||
if ( count > (PRUint32)file->bufsize )
|
||||
return PR_FALSE;
|
||||
|
||||
/* Is caller asking for data we already have? */
|
||||
if ( STARTS_IN_BUF(file) && ENDS_IN_BUF(file,count) )
|
||||
{
|
||||
PR_ASSERT(0);
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/* if the buffer's dirty make sure we successfully flush it */
|
||||
if ( file->bufdirty && _bufio_flushBuf(file) != 0 )
|
||||
return PR_FALSE;
|
||||
|
||||
/* For now we're not trying anything smarter than simple paging. */
|
||||
/* Slide over if necessary to fit the entire request */
|
||||
startBuf = ( file->fpos / file->bufsize ) * file->bufsize;
|
||||
endPos = file->fpos + count;
|
||||
endBuf = startBuf + file->bufsize;
|
||||
if ( endPos > endBuf )
|
||||
startBuf += (endPos - endBuf);
|
||||
|
||||
if ( fseek( file->fd, startBuf, SEEK_SET ) != 0 )
|
||||
return PR_FALSE;
|
||||
else
|
||||
{
|
||||
#if DEBUG_dougt
|
||||
++num_reads;
|
||||
#endif
|
||||
bytesRead = fread( file->data, 1, file->bufsize, file->fd );
|
||||
file->datastart = startBuf;
|
||||
file->datasize = bytesRead;
|
||||
file->bufdirty = PR_FALSE;
|
||||
file->dirtystart = file->bufsize;
|
||||
file->dirtyend = 0;
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
printf("REG: buffer read %d (%d) after %d reads\n",startBuf,file->fpos,file->reads);
|
||||
file->reads = 0;
|
||||
file->writes = 0;
|
||||
#endif
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int _bufio_flushBuf( BufioFile* file )
|
||||
{
|
||||
PRUint32 written;
|
||||
PRUint32 dirtyamt;
|
||||
PRInt32 startpos;
|
||||
|
||||
PR_ASSERT(file);
|
||||
if ( !file || !file->bufdirty )
|
||||
return 0;
|
||||
|
||||
startpos = file->datastart + file->dirtystart;
|
||||
if ( !fseek( file->fd, startpos, SEEK_SET ) )
|
||||
{
|
||||
dirtyamt = file->dirtyend - file->dirtystart;
|
||||
written = fwrite( file->data+file->dirtystart, 1, dirtyamt, file->fd );
|
||||
if ( written == dirtyamt )
|
||||
{
|
||||
#ifdef DEBUG_dveditzbuf
|
||||
printf("REG: buffer flush %d - %d after %d writes\n",startpos,startpos+written,file->writes);
|
||||
file->writes = 0;
|
||||
#endif
|
||||
file->bufdirty = PR_FALSE;
|
||||
file->dirtystart = file->bufsize;
|
||||
file->dirtyend = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* sets the file buffer size to bufsize, clearing the buffer in the process.
|
||||
*
|
||||
* accepts bufsize of -1 to mean default buffer size, defined by BUFIO_BUFSIZE_DEFAULT
|
||||
* returns new buffers size, or -1 if error occurred
|
||||
*/
|
||||
|
||||
int bufio_SetBufferSize(BufioFile* file, int bufsize)
|
||||
{
|
||||
char *newBuffer;
|
||||
int retVal = -1;
|
||||
|
||||
PR_ASSERT(file);
|
||||
if (!file)
|
||||
return retVal;
|
||||
|
||||
if (bufsize == -1)
|
||||
bufsize = BUFIO_BUFSIZE_DEFAULT;
|
||||
if (bufsize == file->bufsize)
|
||||
return bufsize;
|
||||
|
||||
newBuffer = (char*)PR_Malloc( bufsize );
|
||||
if (newBuffer)
|
||||
{
|
||||
/* if the buffer's dirty make sure we successfully flush it */
|
||||
if ( file->bufdirty && _bufio_flushBuf(file) != 0 )
|
||||
{
|
||||
PR_Free( newBuffer );
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
file->bufsize = bufsize;
|
||||
if ( file->data )
|
||||
PR_Free( file->data );
|
||||
file->data = newBuffer;
|
||||
file->datasize = 0;
|
||||
file->datastart = 0;
|
||||
retVal = bufsize;
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
/* EOF nr_bufio.c */
|
@ -1,64 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1999
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
* Edward Kandrot <kandrot@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* nr_bufio.h
|
||||
* Buffered I/O routines to improve registry performance
|
||||
*
|
||||
* the routines mirror fopen(), fclose() et al
|
||||
*
|
||||
* __NOTE__: the filenames are *native* filenames, not NSPR names.
|
||||
*/
|
||||
|
||||
#ifndef _NR_BUFIO_H_
|
||||
#define _NR_BUFIO_H_
|
||||
|
||||
typedef struct BufioFileStruct BufioFile;
|
||||
|
||||
BufioFile* bufio_Open(const char* name, const char* mode);
|
||||
int bufio_Close(BufioFile* file);
|
||||
int bufio_Seek(BufioFile* file, PRInt32 offset, int whence);
|
||||
PRUint32 bufio_Read(BufioFile* file, char* dest, PRUint32 count);
|
||||
PRUint32 bufio_Write(BufioFile* file, const char* src, PRUint32 count);
|
||||
PRInt32 bufio_Tell(BufioFile* file);
|
||||
int bufio_Flush(BufioFile* file);
|
||||
int bufio_SetBufferSize(BufioFile* file, int bufsize);
|
||||
|
||||
#endif /* _NR_BUFIO_H_ */
|
||||
|
@ -1,47 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2000
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
MODULES_LIBREG_SRC_LCSRCS = \
|
||||
reg.c \
|
||||
VerReg.c \
|
||||
vr_stubs.c \
|
||||
$(NULL)
|
||||
|
||||
|
||||
MODULES_LIBREG_SRC_CSRCS := $(addprefix $(topsrcdir)/modules/libreg/src/, $(MODULES_LIBREG_SRC_LCSRCS))
|
||||
|
||||
|
@ -1,196 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* reg.h
|
||||
* XP Registry functions (prototype)
|
||||
*/
|
||||
|
||||
#ifndef _REG_H_
|
||||
#define _REG_H_
|
||||
|
||||
#include "vr_stubs.h"
|
||||
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
#include "prlock.h"
|
||||
#endif
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* Miscellaneous Definitions
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
#define MAGIC_NUMBER 0x76644441L
|
||||
#define MAJOR_VERSION 2 /* major version for incompatible changes */
|
||||
#define MINOR_VERSION 2 /* minor ver for new (compatible) features */
|
||||
#define PATHDEL '/'
|
||||
#define HDRRESERVE 128 /* number of bytes reserved for hdr */
|
||||
#define INTSIZE 4
|
||||
#define DOUBLESIZE 8
|
||||
|
||||
#define PACKBUFFERSIZE 2048
|
||||
|
||||
|
||||
/* Node types */
|
||||
#define REGTYPE_KEY (1)
|
||||
#define REGTYPE_DELETED (0x0080)
|
||||
|
||||
/* Private standard keys */
|
||||
#define ROOTKEY (0x20)
|
||||
#define ROOTKEY_VERSIONS (0x21)
|
||||
|
||||
/* strings for standard keys */
|
||||
#define ROOTKEY_STR "/"
|
||||
#define ROOTKEY_VERSIONS_STR "Version Registry"
|
||||
#define ROOTKEY_USERS_STR "Users"
|
||||
#define ROOTKEY_COMMON_STR "Common"
|
||||
#define ROOTKEY_PRIVATE_STR "Private Arenas"
|
||||
|
||||
#define OLD_VERSIONS_STR "ROOTKEY_VERSIONS"
|
||||
#define OLD_USERS_STR "ROOTKEY_USERS"
|
||||
#define OLD_COMMON_STR "ROOTKEY_COMMON"
|
||||
|
||||
/* needs to be kept in sync with PE. see ns/cmd/winfe/profile.h */
|
||||
/* and ns/cmd/macfe/central/profile.cp */
|
||||
#define ASW_MAGIC_PROFILE_NAME "User1"
|
||||
|
||||
/* macros */
|
||||
#define COPYDESC(dest,src) memcpy((dest),(src),sizeof(REGDESC))
|
||||
|
||||
#define VALID_FILEHANDLE(fh) ((fh) != NULL)
|
||||
|
||||
#define INVALID_NAME_CHAR(p) ( ((unsigned char)(p) < 0x20) )
|
||||
|
||||
#define TYPE_IS_ENTRY(type) ( (type) & REGTYPE_ENTRY )
|
||||
#define TYPE_IS_KEY(type) ( !((type) & REGTYPE_ENTRY) )
|
||||
|
||||
#define VERIFY_HREG(h)\
|
||||
( ((h) == NULL) ? REGERR_PARAM : \
|
||||
( (((REGHANDLE*)(h))->magic == MAGIC_NUMBER) ? REGERR_OK : REGERR_BADMAGIC ) )
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------
|
||||
* Types and Objects
|
||||
* --------------------------------------------------------------------
|
||||
*/
|
||||
#undef REGOFF
|
||||
typedef int32 REGOFF; /* offset into registry file */
|
||||
|
||||
typedef struct _desc
|
||||
{
|
||||
REGOFF location; /* this object's offset (for verification) */
|
||||
REGOFF name; /* name string */
|
||||
uint16 namelen; /* length of name string (including terminator) */
|
||||
uint16 type; /* node type (key, or entry style) */
|
||||
REGOFF left; /* next object at this level (0 if none) */
|
||||
REGOFF down; /* KEY: first subkey VALUE: 0 */
|
||||
REGOFF value; /* KEY: first entry object VALUE: value string */
|
||||
uint32 valuelen; /* KEY: 0 VALUE: length of value data */
|
||||
uint32 valuebuf; /* KEY: 0 VALUE: length available */
|
||||
REGOFF parent; /* the node on the immediate level above */
|
||||
} REGDESC;
|
||||
|
||||
/* offsets into structure on disk */
|
||||
#define DESC_LOCATION 0
|
||||
#define DESC_NAME 4
|
||||
#define DESC_NAMELEN 8
|
||||
#define DESC_TYPE 10
|
||||
#define DESC_LEFT 12
|
||||
#define DESC_DOWN 16
|
||||
#define DESC_VALUE 20
|
||||
#define DESC_VALUELEN 24
|
||||
#define DESC_VALUEBUF 16 /* stored in place of "down" for entries */
|
||||
#define DESC_PARENT 28
|
||||
|
||||
#define DESC_SIZE 32 /* size of desc on disk */
|
||||
|
||||
typedef struct _hdr
|
||||
{
|
||||
uint32 magic; /* must equal MAGIC_NUMBER */
|
||||
uint16 verMajor; /* major version number */
|
||||
uint16 verMinor; /* minor version number */
|
||||
REGOFF avail; /* next available offset */
|
||||
REGOFF root; /* root object */
|
||||
} REGHDR;
|
||||
|
||||
/* offsets into structure on disk*/
|
||||
#define HDR_MAGIC 0
|
||||
#define HDR_VERMAJOR 4
|
||||
#define HDR_VERMINOR 6
|
||||
#define HDR_AVAIL 8
|
||||
#define HDR_ROOT 12
|
||||
|
||||
typedef XP_File FILEHANDLE; /* platform-specific file reference */
|
||||
|
||||
typedef struct _stdnodes {
|
||||
REGOFF versions;
|
||||
REGOFF users;
|
||||
REGOFF common;
|
||||
REGOFF current_user;
|
||||
REGOFF privarea;
|
||||
} STDNODES;
|
||||
|
||||
typedef struct _regfile
|
||||
{
|
||||
FILEHANDLE fh;
|
||||
REGHDR hdr;
|
||||
int refCount;
|
||||
int hdrDirty;
|
||||
int inInit;
|
||||
int readOnly;
|
||||
char * filename;
|
||||
STDNODES rkeys;
|
||||
struct _regfile *next;
|
||||
struct _regfile *prev;
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
PRLock *lock;
|
||||
PRUint64 uniqkey;
|
||||
#endif
|
||||
} REGFILE;
|
||||
|
||||
typedef struct _reghandle
|
||||
{
|
||||
uint32 magic; /* for validating reg handles */
|
||||
REGFILE *pReg; /* the real registry file object */
|
||||
} REGHANDLE;
|
||||
|
||||
|
||||
#endif /* _REG_H_ */
|
||||
|
||||
/* EOF: reg.h */
|
||||
|
@ -1,507 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/* this file contains stubs needed to build the registry routines
|
||||
* into a stand-alone library for use with our installers
|
||||
*/
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#else
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
#include "vr_stubs.h"
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_BEOS
|
||||
#include <FindDirectory.h>
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
/* So that we're not dependent on the size of chars in a wide string literal */
|
||||
static const UniChar kOSXRegParentName[] =
|
||||
{ 'M', 'o', 'z', 'i', 'l', 'l', 'a' };
|
||||
static const UniChar kOSXRegName[] =
|
||||
{ 'G', 'l', 'o', 'b', 'a', 'l', '.', 'r', 'e', 'g', 's' };
|
||||
static const UniChar kOSXVersRegName[] =
|
||||
{ 'V', 'e', 'r', 's', 'i', 'o', 'n', 's', '.', 'r', 'e', 'g', 's' };
|
||||
|
||||
#define UNICHAR_ARRAY_LEN(s) (sizeof(s) / sizeof(UniChar))
|
||||
#endif
|
||||
|
||||
#define DEF_REG "/.mozilla/registry"
|
||||
#define WIN_REG "\\mozregistry.dat"
|
||||
#define MAC_REG "\pMozilla Registry"
|
||||
#define BEOS_REG "/mozilla/registry"
|
||||
|
||||
#define DEF_VERREG "/.mozilla/mozver.dat"
|
||||
#define WIN_VERREG "\\mozver.dat"
|
||||
#define MAC_VERREG "\pMozilla Versions"
|
||||
#define BEOS_VERREG "/mozilla/mozver.dat"
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* OS/2 STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
#ifdef XP_OS2
|
||||
#define INCL_DOS
|
||||
#include <os2.h>
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen (const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
fh = fopen( name, XP_FILE_TRUNCATE_BIN );
|
||||
}
|
||||
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName ()
|
||||
{
|
||||
char path[ CCHMAXPATH ];
|
||||
int pathlen;
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
XP_STRCPY(path, ".");
|
||||
pathlen = strlen(path);
|
||||
|
||||
if ( pathlen > 0 ) {
|
||||
XP_STRCPY( path+pathlen, WIN_REG );
|
||||
globalRegName = XP_STRDUP(path);
|
||||
}
|
||||
}
|
||||
|
||||
char* vr_findVerRegName()
|
||||
{
|
||||
/* need to find a global place for the version registry */
|
||||
if ( verRegName == NULL )
|
||||
{
|
||||
if ( globalRegName == NULL)
|
||||
vr_findGlobalRegName();
|
||||
verRegName = XP_STRDUP(globalRegName);
|
||||
}
|
||||
|
||||
return verRegName;
|
||||
}
|
||||
|
||||
#endif /* XP_OS2 */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* WINDOWS STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
#if defined(XP_WIN)
|
||||
#include "windows.h"
|
||||
#define PATHLEN 260
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen (const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
fh = fopen( name, XP_FILE_TRUNCATE_BIN );
|
||||
}
|
||||
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName ()
|
||||
{
|
||||
char path[ PATHLEN ];
|
||||
int pathlen;
|
||||
|
||||
pathlen = GetWindowsDirectory(path, PATHLEN);
|
||||
if ( pathlen > 0 ) {
|
||||
XP_FREEIF(globalRegName);
|
||||
XP_STRCPY( path+pathlen, WIN_REG );
|
||||
globalRegName = XP_STRDUP(path);
|
||||
}
|
||||
}
|
||||
|
||||
char* vr_findVerRegName()
|
||||
{
|
||||
char path[ PATHLEN ];
|
||||
int pathlen;
|
||||
|
||||
if ( verRegName == NULL )
|
||||
{
|
||||
pathlen = GetWindowsDirectory(path, PATHLEN);
|
||||
if ( pathlen > 0 ) {
|
||||
XP_STRCPY( path+pathlen, WIN_VERREG );
|
||||
verRegName = XP_STRDUP(path);
|
||||
}
|
||||
}
|
||||
|
||||
return verRegName;
|
||||
}
|
||||
|
||||
#if !defined(WIN32) && !defined(__BORLANDC__)
|
||||
int FAR PASCAL _export WEP(int);
|
||||
|
||||
int FAR PASCAL LibMain(HANDLE hInst, WORD wDataSeg, WORD wHeapSize, LPSTR lpszCmdLine)
|
||||
{
|
||||
if ( wHeapSize > 0 )
|
||||
UnlockData(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int FAR PASCAL _export WEP(int nParam)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#endif /* not WIN32 */
|
||||
|
||||
#endif /* XP_WIN */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* MACINTOSH STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen(const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
errno = 0; /* reset errno (only if we're using stdio) */
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
{
|
||||
/* should never get here! */
|
||||
fh = fopen( name, XP_FILE_TRUNCATE_BIN );
|
||||
}
|
||||
}
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName()
|
||||
{
|
||||
OSErr err;
|
||||
FSRef foundRef;
|
||||
|
||||
err = FSFindFolder(kLocalDomain, kDomainLibraryFolderType, kDontCreateFolder, &foundRef);
|
||||
if (err == noErr)
|
||||
{
|
||||
FSRef parentRef;
|
||||
err = FSMakeFSRefUnicode(&foundRef, UNICHAR_ARRAY_LEN(kOSXRegParentName), kOSXRegParentName,
|
||||
kTextEncodingUnknown, &parentRef);
|
||||
if (err == fnfErr)
|
||||
{
|
||||
err = FSCreateDirectoryUnicode(&foundRef, UNICHAR_ARRAY_LEN(kOSXRegParentName), kOSXRegParentName,
|
||||
kFSCatInfoNone, NULL, &parentRef, NULL, NULL);
|
||||
}
|
||||
if (err == noErr)
|
||||
{
|
||||
FSRef regRef;
|
||||
err = FSMakeFSRefUnicode(&parentRef, UNICHAR_ARRAY_LEN(kOSXRegName), kOSXRegName,
|
||||
kTextEncodingUnknown, ®Ref);
|
||||
if (err == fnfErr)
|
||||
{
|
||||
FSCatalogInfo catalogInfo;
|
||||
FileInfo fileInfo = { 'REGS', 'MOSS', 0, { 0, 0 }, 0 };
|
||||
memmove(&(catalogInfo.finderInfo), &fileInfo, sizeof(FileInfo));
|
||||
err = FSCreateFileUnicode(&parentRef, UNICHAR_ARRAY_LEN(kOSXRegName), kOSXRegName,
|
||||
kFSCatInfoFinderInfo, &catalogInfo, ®Ref, NULL);
|
||||
}
|
||||
if (err == noErr)
|
||||
{
|
||||
UInt8 pathBuf[PATH_MAX];
|
||||
err = FSRefMakePath(®Ref, pathBuf, sizeof(pathBuf));
|
||||
if (err == noErr)
|
||||
globalRegName = XP_STRDUP((const char*)pathBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern char* vr_findVerRegName()
|
||||
{
|
||||
OSErr err;
|
||||
FSRef foundRef;
|
||||
|
||||
err = FSFindFolder(kLocalDomain, kDomainLibraryFolderType, kDontCreateFolder, &foundRef);
|
||||
if (err == noErr)
|
||||
{
|
||||
FSRef parentRef;
|
||||
err = FSMakeFSRefUnicode(&foundRef, UNICHAR_ARRAY_LEN(kOSXRegParentName), kOSXRegParentName,
|
||||
kTextEncodingUnknown, &parentRef);
|
||||
if (err == fnfErr)
|
||||
{
|
||||
err = FSCreateDirectoryUnicode(&foundRef, UNICHAR_ARRAY_LEN(kOSXRegParentName), kOSXRegParentName,
|
||||
kFSCatInfoNone, NULL, &parentRef, NULL, NULL);
|
||||
}
|
||||
if (err == noErr)
|
||||
{
|
||||
FSRef regRef;
|
||||
err = FSMakeFSRefUnicode(&parentRef, UNICHAR_ARRAY_LEN(kOSXVersRegName), kOSXVersRegName,
|
||||
kTextEncodingUnknown, ®Ref);
|
||||
if (err == fnfErr)
|
||||
{
|
||||
FSCatalogInfo catalogInfo;
|
||||
FileInfo fileInfo = { 'REGS', 'MOSS', 0, { 0, 0 }, 0 };
|
||||
memmove(&(catalogInfo.finderInfo), &fileInfo, sizeof(FileInfo));
|
||||
err = FSCreateFileUnicode(&parentRef, UNICHAR_ARRAY_LEN(kOSXVersRegName), kOSXVersRegName,
|
||||
kFSCatInfoFinderInfo, &catalogInfo, ®Ref, NULL);
|
||||
}
|
||||
if (err == noErr)
|
||||
{
|
||||
UInt8 pathBuf[PATH_MAX];
|
||||
err = FSRefMakePath(®Ref, pathBuf, sizeof(pathBuf));
|
||||
if (err == noErr)
|
||||
verRegName = XP_STRDUP((const char*)pathBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
return verRegName;
|
||||
}
|
||||
|
||||
#endif /* XP_MACOSX */
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* UNIX STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef XP_OS2
|
||||
#include <io.h>
|
||||
#define W_OK 0x02 /*evil hack from the docs...*/
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "NSReg.h"
|
||||
#include "VerReg.h"
|
||||
|
||||
char *TheRegistry = "registry";
|
||||
char *Flist;
|
||||
|
||||
REGERR vr_ParseVersion(char *verstr, VERSION *result);
|
||||
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen (const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
fh = fopen( name, XP_FILE_TRUNCATE_BIN );
|
||||
}
|
||||
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName ()
|
||||
{
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
char *def = NULL;
|
||||
char *home = getenv("HOME");
|
||||
if (home != NULL) {
|
||||
def = (char *) XP_ALLOC(XP_STRLEN(home) + XP_STRLEN(DEF_REG)+1);
|
||||
if (def != NULL) {
|
||||
XP_STRCPY(def, home);
|
||||
XP_STRCAT(def, DEF_REG);
|
||||
}
|
||||
}
|
||||
if (def != NULL) {
|
||||
globalRegName = XP_STRDUP(def);
|
||||
} else {
|
||||
globalRegName = XP_STRDUP(TheRegistry);
|
||||
}
|
||||
XP_FREEIF(def);
|
||||
#else
|
||||
globalRegName = XP_STRDUP(TheRegistry);
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
}
|
||||
|
||||
char* vr_findVerRegName ()
|
||||
{
|
||||
if ( verRegName != NULL )
|
||||
return verRegName;
|
||||
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
{
|
||||
char *def = NULL;
|
||||
char *home = getenv("HOME");
|
||||
if (home != NULL) {
|
||||
def = (char *) XP_ALLOC(XP_STRLEN(home) + XP_STRLEN(DEF_VERREG)+1);
|
||||
if (def != NULL) {
|
||||
XP_STRCPY(def, home);
|
||||
XP_STRCAT(def, DEF_VERREG);
|
||||
}
|
||||
}
|
||||
if (def != NULL) {
|
||||
verRegName = XP_STRDUP(def);
|
||||
}
|
||||
XP_FREEIF(def);
|
||||
}
|
||||
#else
|
||||
verRegName = XP_STRDUP(TheRegistry);
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
return verRegName;
|
||||
}
|
||||
|
||||
#endif /*XP_UNIX*/
|
||||
|
||||
/* ------------------------------------------------------------------
|
||||
* BeOS STUBS
|
||||
* ------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifdef XP_BEOS
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
extern XP_File vr_fileOpen (const char *name, const char * mode)
|
||||
{
|
||||
XP_File fh = NULL;
|
||||
struct stat st;
|
||||
|
||||
if ( name != NULL ) {
|
||||
if ( stat( name, &st ) == 0 )
|
||||
fh = fopen( name, XP_FILE_UPDATE_BIN );
|
||||
else
|
||||
fh = fopen( name, XP_FILE_TRUNCATE_BIN );
|
||||
}
|
||||
|
||||
return fh;
|
||||
}
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
extern void vr_findGlobalRegName ()
|
||||
{
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
char *def = NULL;
|
||||
char settings[1024];
|
||||
find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, settings, sizeof(settings));
|
||||
if (settings != NULL) {
|
||||
def = (char *) XP_ALLOC(XP_STRLEN(settings) + XP_STRLEN(BEOS_REG)+1);
|
||||
if (def != NULL) {
|
||||
XP_STRCPY(def, settings);
|
||||
XP_STRCAT(def, BEOS_REG);
|
||||
}
|
||||
}
|
||||
if (def != NULL) {
|
||||
globalRegName = XP_STRDUP(def);
|
||||
} else {
|
||||
globalRegName = XP_STRDUP(TheRegistry);
|
||||
}
|
||||
XP_FREEIF(def);
|
||||
#else
|
||||
globalRegName = XP_STRDUP(TheRegistry);
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
}
|
||||
|
||||
char* vr_findVerRegName ()
|
||||
{
|
||||
if ( verRegName != NULL )
|
||||
return verRegName;
|
||||
|
||||
#ifndef STANDALONE_REGISTRY
|
||||
{
|
||||
char *def = NULL;
|
||||
char settings[1024];
|
||||
find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, settings, sizeof(settings));
|
||||
if (settings != NULL) {
|
||||
def = (char *) XP_ALLOC(XP_STRLEN(settings) + XP_STRLEN(BEOS_VERREG)+1);
|
||||
if (def != NULL) {
|
||||
XP_STRCPY(def, settings);
|
||||
XP_STRCAT(def, BEOS_VERREG);
|
||||
}
|
||||
}
|
||||
if (def != NULL) {
|
||||
verRegName = XP_STRDUP(def);
|
||||
}
|
||||
XP_FREEIF(def);
|
||||
}
|
||||
#else
|
||||
verRegName = XP_STRDUP(TheRegistry);
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
return verRegName;
|
||||
}
|
||||
|
||||
#endif /*XP_BEOS*/
|
||||
|
||||
#endif /* XP_UNIX || XP_OS2 */
|
@ -1,283 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla Communicator client code, released
|
||||
* March 31, 1998.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Daniel Veditz <dveditz@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* vr_stubs.h
|
||||
*
|
||||
* XP code stubs for stand-alone registry library
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _VR_STUBS_H_
|
||||
#define _VR_STUBS_H_
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
#else
|
||||
|
||||
#include "prio.h"
|
||||
#include "prlog.h"
|
||||
#include "prmem.h"
|
||||
#include "plstr.h"
|
||||
|
||||
#endif /* STANDALONE_REGISTRY*/
|
||||
|
||||
#if ( defined(BSDI) && !defined(BSDI_2) ) || defined(XP_OS2)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
# define XP_CPLUSPLUS
|
||||
# define XP_IS_CPLUSPLUS 1
|
||||
#else
|
||||
# define XP_IS_CPLUSPLUS 0
|
||||
#endif
|
||||
|
||||
#if defined(XP_CPLUSPLUS)
|
||||
# define XP_BEGIN_PROTOS extern "C" {
|
||||
# define XP_END_PROTOS }
|
||||
#else
|
||||
# define XP_BEGIN_PROTOS
|
||||
# define XP_END_PROTOS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef STANDALONE_REGISTRY
|
||||
|
||||
#define USE_STDIO_MODES
|
||||
|
||||
#define XP_FileSeek(file,offset,whence) fseek((file), (offset), (whence))
|
||||
#define XP_FileRead(dest,count,file) fread((dest), 1, (count), (file))
|
||||
#define XP_FileWrite(src,count,file) fwrite((src), 1, (count), (file))
|
||||
#define XP_FileTell(file) ftell(file)
|
||||
#define XP_FileFlush(file) fflush(file)
|
||||
#define XP_FileClose(file) fclose(file)
|
||||
#define XP_FileSetBufferSize(file,bufsize) (-1)
|
||||
|
||||
#define XP_ASSERT(x) ((void)0)
|
||||
|
||||
#define XP_STRCAT(a,b) strcat((a),(b))
|
||||
#define XP_ATOI atoi
|
||||
#define XP_STRNCPY(a,b,n) strncpy((a),(b),(n))
|
||||
#define XP_STRCPY(a,b) strcpy((a),(b))
|
||||
#define XP_STRLEN(x) strlen(x)
|
||||
#define XP_SPRINTF sprintf
|
||||
#define XP_FREE(x) free((x))
|
||||
#define XP_ALLOC(x) malloc((x))
|
||||
#define XP_FREEIF(x) if ((x)) free((x))
|
||||
#define XP_STRCMP(x,y) strcmp((x),(y))
|
||||
#define XP_STRNCMP(x,y,n) strncmp((x),(y),(n))
|
||||
#define XP_STRDUP(s) strdup((s))
|
||||
#define XP_MEMCPY(d, s, l) memcpy((d), (s), (l))
|
||||
#define XP_MEMSET(d, c, l) memset((d), (c), (l))
|
||||
|
||||
#define PR_Lock(a) ((void)0)
|
||||
#define PR_Unlock(a) ((void)0)
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#define XP_STRCASECMP(x,y) stricmp((x),(y))
|
||||
#define XP_STRNCASECMP(x,y,n) strnicmp((x),(y),(n))
|
||||
#else
|
||||
#define XP_STRCASECMP(x,y) strcasecmp((x),(y))
|
||||
#define XP_STRNCASECMP(x,y,n) strncasecmp((x),(y),(n))
|
||||
#endif /* XP_WIN || XP_OS2 */
|
||||
|
||||
typedef FILE * XP_File;
|
||||
|
||||
#else /* not standalone, use NSPR */
|
||||
|
||||
|
||||
/*-------------------------------------*/
|
||||
/* Alternate fileI/O function mappings */
|
||||
/*-------------------------------------*/
|
||||
|
||||
#if USE_BUFFERED_REGISTRY_IO
|
||||
/*-----------------------------------------------*/
|
||||
/* home-grown XP buffering */
|
||||
/* writes are buffered too so use flush! */
|
||||
/*-----------------------------------------------*/
|
||||
#define USE_STDIO_MODES
|
||||
|
||||
#include "nr_bufio.h"
|
||||
#define XP_FileSeek(file,offset,whence) bufio_Seek((file),(offset),(whence))
|
||||
#define XP_FileRead(dest,count,file) bufio_Read((file), (dest), (count))
|
||||
#define XP_FileWrite(src,count,file) bufio_Write((file), (src), (count))
|
||||
#define XP_FileTell(file) bufio_Tell(file)
|
||||
#define XP_FileClose(file) bufio_Close(file)
|
||||
#define XP_FileOpen(path, mode) bufio_Open((path), (mode))
|
||||
#define XP_FileFlush(file) bufio_Flush(file)
|
||||
#define XP_FileSetBufferSize(file,bufsize) bufio_SetBufferSize(file,bufsize)
|
||||
|
||||
|
||||
typedef BufioFile* XP_File;
|
||||
|
||||
#else
|
||||
/*-----------------------------------------------*/
|
||||
/* standard NSPR file I/O */
|
||||
/*-----------------------------------------------*/
|
||||
#define USE_NSPR_MODES
|
||||
/*
|
||||
** Note that PR_Seek returns the offset (if successful) and -1 otherwise. So
|
||||
** to make this code work
|
||||
** if (XP_FileSeek(fh, offset, SEEK_SET) != 0) { error handling }
|
||||
** we return 1 if PR_Seek() returns a negative value, and 0 otherwise
|
||||
*/
|
||||
#define XP_FileSeek(file,offset,whence) (PR_Seek((file), (offset), (whence)) < 0)
|
||||
#define XP_FileRead(dest,count,file) PR_Read((file), (dest), (count))
|
||||
#define XP_FileWrite(src,count,file) PR_Write((file), (src), (count))
|
||||
#define XP_FileTell(file) PR_Seek(file, 0, PR_SEEK_CUR)
|
||||
#define XP_FileOpen(path, mode) PR_Open((path), mode )
|
||||
#define XP_FileClose(file) PR_Close(file)
|
||||
#define XP_FileFlush(file) PR_Sync(file)
|
||||
#define XP_FileSetBufferSize(file,bufsize) (-1)
|
||||
|
||||
typedef PRFileDesc* XP_File;
|
||||
|
||||
#endif /*USE_MMAP_REGISTRY_IO*/
|
||||
|
||||
|
||||
|
||||
#define XP_ASSERT(x) PR_ASSERT((x))
|
||||
|
||||
#define XP_STRCAT(a,b) PL_strcat((a),(b))
|
||||
#define XP_ATOI PL_atoi
|
||||
#define XP_STRCPY(a,b) PL_strcpy((a),(b))
|
||||
#define XP_STRNCPY(a,b,n) PL_strncpy((a),(b),(n))
|
||||
#define XP_STRLEN(x) PL_strlen(x)
|
||||
#define XP_SPRINTF sprintf
|
||||
#define XP_FREE(x) PR_Free((x))
|
||||
#define XP_ALLOC(x) PR_Malloc((x))
|
||||
#define XP_FREEIF(x) PR_FREEIF(x)
|
||||
#define XP_STRCMP(x,y) PL_strcmp((x),(y))
|
||||
#define XP_STRNCMP(x,y,n) PL_strncmp((x),(y),(n))
|
||||
#define XP_STRDUP(s) PL_strdup((s))
|
||||
#define XP_MEMCPY(d, s, l) memcpy((d), (s), (l))
|
||||
#define XP_MEMSET(d, c, l) memset((d), (c), (l))
|
||||
|
||||
#define XP_STRCASECMP(x,y) PL_strcasecmp((x),(y))
|
||||
#define XP_STRNCASECMP(x,y,n) PL_strncasecmp((x),(y),(n))
|
||||
|
||||
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
/*--- file open modes for stdio ---*/
|
||||
#ifdef USE_STDIO_MODES
|
||||
#define XP_FILE_READ "r"
|
||||
#define XP_FILE_READ_BIN "rb"
|
||||
#define XP_FILE_WRITE "w"
|
||||
#define XP_FILE_WRITE_BIN "wb"
|
||||
#define XP_FILE_UPDATE "r+"
|
||||
#define XP_FILE_TRUNCATE "w+"
|
||||
#ifdef SUNOS4
|
||||
/* XXX SunOS4 hack -- make this universal by using r+b and w+b */
|
||||
#define XP_FILE_UPDATE_BIN "r+"
|
||||
#define XP_FILE_TRUNCATE_BIN "w+"
|
||||
#else
|
||||
#define XP_FILE_UPDATE_BIN "rb+"
|
||||
#define XP_FILE_TRUNCATE_BIN "wb+"
|
||||
#endif
|
||||
#endif /* USE_STDIO_MODES */
|
||||
|
||||
/*--- file open modes for NSPR file I/O ---*/
|
||||
#ifdef USE_NSPR_MODES
|
||||
#define XP_FILE_READ PR_RDONLY, 0644
|
||||
#define XP_FILE_READ_BIN PR_RDONLY, 0644
|
||||
#define XP_FILE_WRITE PR_WRONLY, 0644
|
||||
#define XP_FILE_WRITE_BIN PR_WRONLY, 0644
|
||||
#define XP_FILE_UPDATE (PR_RDWR|PR_CREATE_FILE), 0644
|
||||
#define XP_FILE_TRUNCATE (PR_RDWR | PR_TRUNCATE), 0644
|
||||
#define XP_FILE_UPDATE_BIN PR_RDWR|PR_CREATE_FILE, 0644
|
||||
#define XP_FILE_TRUNCATE_BIN (PR_RDWR | PR_TRUNCATE), 0644
|
||||
|
||||
#ifdef SEEK_SET
|
||||
#undef SEEK_SET
|
||||
#undef SEEK_CUR
|
||||
#undef SEEK_END
|
||||
#define SEEK_SET PR_SEEK_SET
|
||||
#define SEEK_CUR PR_SEEK_CUR
|
||||
#define SEEK_END PR_SEEK_END
|
||||
#endif
|
||||
#endif /* USE_NSPR_MODES */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef STANDALONE_REGISTRY /* included from prmon.h otherwise */
|
||||
#include "prtypes.h"
|
||||
#endif /*STANDALONE_REGISTRY*/
|
||||
|
||||
typedef int XP_Bool;
|
||||
|
||||
typedef struct stat XP_StatStruct;
|
||||
#define XP_Stat(file,data) stat((file),(data))
|
||||
|
||||
XP_BEGIN_PROTOS
|
||||
|
||||
#define nr_RenameFile(from, to) rename((from), (to))
|
||||
|
||||
extern char* globalRegName;
|
||||
extern char* verRegName;
|
||||
|
||||
extern void vr_findGlobalRegName();
|
||||
extern char* vr_findVerRegName();
|
||||
|
||||
|
||||
#ifdef STANDALONE_REGISTRY /* included from prmon.h otherwise */
|
||||
|
||||
extern XP_File vr_fileOpen(const char *name, const char * mode);
|
||||
|
||||
|
||||
#else
|
||||
#define vr_fileOpen PR_Open
|
||||
#endif /* STANDALONE_REGISTRY */
|
||||
|
||||
XP_END_PROTOS
|
||||
|
||||
#endif /* _VR_STUBS_H_ */
|
@ -1,293 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* Registry interpreter */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "VerReg.h"
|
||||
#include "NSReg.h"
|
||||
|
||||
extern char *errstr(REGERR err);
|
||||
extern int DumpTree(void);
|
||||
|
||||
|
||||
int error(char *func, int err)
|
||||
{
|
||||
if (err == REGERR_OK)
|
||||
{
|
||||
printf("\t%s -- OK\n", func);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\t%s -- %s\n", func, errstr(err));
|
||||
}
|
||||
|
||||
return err;
|
||||
|
||||
} /* error */
|
||||
|
||||
static char *GetNextWord(char *cmd, char *buf)
|
||||
{
|
||||
/* copies until ',' or eos, then skips spaces */
|
||||
if (!cmd || !buf)
|
||||
return 0;
|
||||
while (*cmd && *cmd != ',')
|
||||
*buf++ = *cmd++;
|
||||
*buf = '\0';
|
||||
if (*cmd == ',')
|
||||
{
|
||||
cmd++;
|
||||
while(*cmd && *cmd == ' ')
|
||||
cmd++;
|
||||
}
|
||||
return cmd;
|
||||
|
||||
} /* GetNextWord */
|
||||
|
||||
static int vr_ParseVersion(char *verstr, VERSION *result)
|
||||
{
|
||||
|
||||
result->major = result->minor = result->release = result->build = 0;
|
||||
result->major = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
if (*verstr)
|
||||
{
|
||||
verstr++;
|
||||
result->minor = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
if (*verstr)
|
||||
{
|
||||
verstr++;
|
||||
result->release = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
if (*verstr)
|
||||
{
|
||||
verstr++;
|
||||
result->build = atoi(verstr);
|
||||
while (*verstr && *verstr != '.')
|
||||
verstr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return REGERR_OK;
|
||||
|
||||
} /* ParseVersion */
|
||||
|
||||
|
||||
void vCreate(char *cmd)
|
||||
{
|
||||
|
||||
/* Syntax: Create [new,] 5.0b1 */
|
||||
char buf[512];
|
||||
|
||||
int flag = 0;
|
||||
cmd = GetNextWord(cmd, buf);
|
||||
|
||||
error("VR_CreateRegistry", VR_CreateRegistry("Communicator", buf, cmd));
|
||||
|
||||
} /* vCreate */
|
||||
|
||||
|
||||
|
||||
void vFind(char *cmd)
|
||||
{
|
||||
|
||||
VERSION ver;
|
||||
char path[MAXREGPATHLEN];
|
||||
|
||||
if (error("VR_GetVersion", VR_GetVersion(cmd, &ver)) == REGERR_OK)
|
||||
{
|
||||
if (error("VR_GetPath", VR_GetPath(cmd, sizeof(path), path)) == REGERR_OK)
|
||||
{
|
||||
printf("%s found: ver=%d.%d.%d.%d, check=0x%04x, path=%s\n",
|
||||
cmd, ver.major, ver.minor, ver.release, ver.build, ver.check,
|
||||
path);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
printf("%s not found.\n", cmd);
|
||||
return;
|
||||
|
||||
} /* vFind */
|
||||
|
||||
|
||||
void vHelp(char *cmd)
|
||||
{
|
||||
|
||||
puts("Enter a command:");
|
||||
puts("\tN)ew <dir> [, <ver>] - create a new registry");
|
||||
puts("\tA)pp <dir> - set application directory");
|
||||
puts("\tC)lose - close the registry");
|
||||
puts("");
|
||||
puts("\tI)nstall <name>, <version>, <path> - install a new component");
|
||||
puts("\tR)emove <name> - deletes a component from the Registry");
|
||||
puts("\tX)ists <name> - checks for existence in registry");
|
||||
puts("\tT)est <name> - validates physical existence");
|
||||
puts("\tE)num <name> - dumps named subtree");
|
||||
puts("");
|
||||
puts("\tV)ersion <name> - gets component version");
|
||||
puts("\tP)ath <name> - gets component path");
|
||||
puts("\treF)count <name> - gets component refcount");
|
||||
puts("\tD)ir <name> - gets component directory");
|
||||
puts("\tSR)efcount <name>- sets component refcount");
|
||||
puts("\tSD)ir <name> - sets component directory");
|
||||
puts("");
|
||||
puts("\tQ)uit - end the program");
|
||||
|
||||
} /* vHelp */
|
||||
|
||||
|
||||
void vInstall(char *cmd)
|
||||
{
|
||||
|
||||
char name[MAXREGPATHLEN+1];
|
||||
char path[MAXREGPATHLEN+1];
|
||||
char ver[MAXREGPATHLEN+1];
|
||||
|
||||
char *pPath, *pVer;
|
||||
|
||||
cmd = GetNextWord(cmd, name);
|
||||
cmd = GetNextWord(cmd, ver);
|
||||
cmd = GetNextWord(cmd, path);
|
||||
|
||||
pVer = ( ver[0] != '*' ) ? ver : NULL;
|
||||
pPath = ( path[0] != '*' ) ? path : NULL;
|
||||
|
||||
error("VR_Install", VR_Install(name, pPath, pVer, FALSE));
|
||||
|
||||
} /* vInstall */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void interp(void)
|
||||
{
|
||||
|
||||
char line[256];
|
||||
char *p;
|
||||
|
||||
while(1)
|
||||
{
|
||||
putchar('>');
|
||||
putchar(' ');
|
||||
fflush(stdin); fflush(stdout); fflush(stderr);
|
||||
gets(line);
|
||||
|
||||
/* p points to next word after verb on command line */
|
||||
p = line;
|
||||
while (*p && *p!=' ')
|
||||
p++;
|
||||
if (!*p)
|
||||
p = 0;
|
||||
else
|
||||
{
|
||||
while(*p && *p==' ')
|
||||
p++;
|
||||
}
|
||||
|
||||
switch(toupper(line[0]))
|
||||
{
|
||||
case 'N':
|
||||
vCreate(p);
|
||||
break;
|
||||
case 'A':
|
||||
error("VR_SetRegDirectory", VR_SetRegDirectory(p));
|
||||
break;
|
||||
case 'C':
|
||||
error("VR_Close", VR_Close());
|
||||
break;
|
||||
|
||||
case 'I':
|
||||
vInstall(p);
|
||||
break;
|
||||
case 'R':
|
||||
error("VR_Remove", VR_Remove(p));
|
||||
break;
|
||||
case 'X':
|
||||
error("VR_InRegistry", VR_InRegistry(p));
|
||||
break;
|
||||
case 'T':
|
||||
error("VR_ValidateComponent", VR_ValidateComponent(p));
|
||||
break;
|
||||
|
||||
#if LATER
|
||||
case 'E':
|
||||
vEnum(p);
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
vVersion(p);
|
||||
break;
|
||||
case 'P':
|
||||
vPath(p);
|
||||
break;
|
||||
case 'F':
|
||||
vGetRefCount(p);
|
||||
break;
|
||||
case 'D':
|
||||
vGetDir(p);
|
||||
break;
|
||||
|
||||
case 'S':
|
||||
puts("--Unsupported--");
|
||||
#endif
|
||||
|
||||
case 'H':
|
||||
default:
|
||||
vHelp(line);
|
||||
break;
|
||||
case 'Q':
|
||||
return;
|
||||
} /* switch */
|
||||
} /* while */
|
||||
|
||||
assert(0);
|
||||
return; /* shouldn't get here */
|
||||
|
||||
} /* interp */
|
||||
|
||||
/* EOF: interp.c */
|
@ -1,117 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "NSReg.h"
|
||||
#include "VerReg.h"
|
||||
|
||||
extern void interp(void);
|
||||
|
||||
#define REGFILE "c:\\temp\\reg.dat"
|
||||
|
||||
char *gRegistry;
|
||||
|
||||
int main(int argc, char *argv[]);
|
||||
|
||||
char *errstr(REGERR err)
|
||||
{
|
||||
|
||||
switch( err )
|
||||
{
|
||||
case REGERR_OK:
|
||||
return "REGERR_OK";
|
||||
case REGERR_FAIL:
|
||||
return "REGERR_FAIL";
|
||||
case REGERR_NOMORE:
|
||||
return "REGERR_MORE";
|
||||
case REGERR_NOFIND:
|
||||
return "REGERR_NOFIND";
|
||||
case REGERR_BADREAD:
|
||||
return "REGERR_BADREAD";
|
||||
case REGERR_BADLOCN:
|
||||
return "REGERR_BADLOCN";
|
||||
case REGERR_PARAM:
|
||||
return "REGERR_PARAM";
|
||||
case REGERR_BADMAGIC:
|
||||
return "REGERR_BADMAGIC";
|
||||
case REGERR_BADCHECK:
|
||||
return "REGERR_BADCHECK";
|
||||
case REGERR_NOFILE:
|
||||
return "REGERR_NOFILE";
|
||||
case REGERR_MEMORY:
|
||||
return "REGERR_MEMORY";
|
||||
case REGERR_BUFTOOSMALL:
|
||||
return "REGERR_BUFTOOSMALL";
|
||||
case REGERR_NAMETOOLONG:
|
||||
return "REGERR_NAMETOOLONG";
|
||||
case REGERR_REGVERSION:
|
||||
return "REGERR_REGVERSION";
|
||||
case REGERR_DELETED:
|
||||
return "REGERR_DELETED";
|
||||
case REGERR_BADTYPE:
|
||||
return "REGERR_BADTYPE";
|
||||
case REGERR_NOPATH:
|
||||
return "REGERR_NOPATH";
|
||||
case REGERR_BADNAME:
|
||||
return "REGERR_BADNAME";
|
||||
case REGERR_READONLY:
|
||||
return "REGERR_READONLY";
|
||||
case REGERR_BADUTF8:
|
||||
return "REGERR_BADUTF8";
|
||||
default:
|
||||
return "<Unknown>";
|
||||
}
|
||||
|
||||
} // errstr
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
printf("Registry Test 4/10/99.\n");
|
||||
|
||||
interp();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,77 +0,0 @@
|
||||
#
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is
|
||||
# Netscape Communications Corporation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 1998
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Samir Gehani <sgehani@netscape.com>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(srcdir)/../src/objs.mk
|
||||
|
||||
MODULE = zlib
|
||||
LIBRARY_NAME = mozz_s
|
||||
|
||||
CSRCS = $(MODULES_ZLIB_SRC_LCSRCS)
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
SRCS_IN_OBJDIR = 1
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
USE_STATIC_LIBS=1
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
USE_STATIC_LIBS=1
|
||||
endif
|
||||
|
||||
EXTRA_DSO_LDOPTS += $(MOZ_COMPONENT_NSPR_LIBS)
|
||||
|
||||
GARBAGE += $(MODULES_ZLIB_SRC_LCSRCS) $(wildcard *.$(OBJ_SUFFIX))
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
GARBAGE += $(addprefix $(srcdir)/,$(MODULES_ZLIB_SRC_LCSRCS))
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../src
|
||||
|
||||
export:: $(MODULES_ZLIB_SRC_CSRCS)
|
||||
$(INSTALL) $^ .
|
||||
|
@ -115,7 +115,7 @@ main(int aArgc,
|
||||
char** aArgv)
|
||||
{
|
||||
ScopedXPCOM xpcom(TEST_NAME);
|
||||
nsCOMPtr<ShutdownObserver> shutdownObserver = new ShutdownObserver();
|
||||
nsRefPtr<ShutdownObserver> shutdownObserver = new ShutdownObserver();
|
||||
|
||||
|
||||
// Tinderboxes are constantly on idle. Since idle tasks can interact with
|
||||
|
@ -64,7 +64,6 @@ LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
|
||||
endif
|
||||
|
||||
ifneq (,$(filter WINNT OS2,$(OS_ARCH)))
|
||||
REQUIRES += libreg
|
||||
DEFINES += -DZLIB_DLL=1
|
||||
endif
|
||||
|
||||
@ -112,7 +111,6 @@ STATIC_LIBS += \
|
||||
xpcom_core \
|
||||
ucvutil_s \
|
||||
chromium_s \
|
||||
mozreg_s \
|
||||
$(NULL)
|
||||
|
||||
# component libraries
|
||||
|
@ -72,19 +72,6 @@ interface nsIProfileStartup : nsISupports
|
||||
[scriptable, uuid(24ce8b9d-b7ff-4279-aef4-26e158f03e34)]
|
||||
interface nsIProfileMigrator : nsISupports
|
||||
{
|
||||
/**
|
||||
* Import existing profile paths. When the app is started the first
|
||||
* time, if there are no INI-style profiles, appstartup will call
|
||||
* this method to import any registry- style profiles that may
|
||||
* exist. When this method is called, there is no event queue
|
||||
* service and this method should not attempt to use the network or
|
||||
* show any GUI.
|
||||
*
|
||||
* @note You don't actually have to move the profile data. Just call
|
||||
* nsIToolkitProfileService.create on the existing profile path(s).
|
||||
*/
|
||||
void import();
|
||||
|
||||
/**
|
||||
* Do profile migration.
|
||||
*
|
||||
|
@ -294,12 +294,6 @@ MAKEFILES_libjar="
|
||||
modules/libjar/test/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_libreg="
|
||||
modules/libreg/Makefile
|
||||
modules/libreg/include/Makefile
|
||||
modules/libreg/src/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_libpref="
|
||||
modules/libpref/Makefile
|
||||
modules/libpref/public/Makefile
|
||||
@ -714,10 +708,6 @@ MAKEFILES_accessible="
|
||||
accessible/build/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_zlib="
|
||||
modules/zlib/standalone/Makefile
|
||||
"
|
||||
|
||||
MAKEFILES_libmar="
|
||||
modules/libmar/Makefile
|
||||
modules/libmar/src/Makefile
|
||||
@ -754,7 +744,6 @@ add_makefiles "
|
||||
$MAKEFILES_content
|
||||
$MAKEFILES_layout
|
||||
$MAKEFILES_libjar
|
||||
$MAKEFILES_libreg
|
||||
$MAKEFILES_libpref
|
||||
$MAKEFILES_mathml
|
||||
$MAKEFILES_plugin
|
||||
@ -775,7 +764,6 @@ add_makefiles "
|
||||
$MAKEFILES_xulapp
|
||||
$MAKEFILES_libpr0n
|
||||
$MAKEFILES_accessible
|
||||
$MAKEFILES_zlib
|
||||
$MAKEFILES_libmar
|
||||
$MAKEFILES_extensions
|
||||
$MAKEFILES_startupcache
|
||||
|
@ -59,7 +59,6 @@ tier_platform_dirs += modules/zlib
|
||||
endif
|
||||
|
||||
tier_platform_dirs += \
|
||||
modules/libreg \
|
||||
modules/libpref \
|
||||
intl \
|
||||
netwerk \
|
||||
@ -77,11 +76,6 @@ ifndef MOZ_NATIVE_JPEG
|
||||
tier_platform_dirs += jpeg
|
||||
endif
|
||||
|
||||
# Installer needs standalone libjar, hence standalone zlib
|
||||
ifdef MOZ_INSTALLER
|
||||
tier_platform_dirs += modules/zlib/standalone
|
||||
endif
|
||||
|
||||
ifdef MOZ_UPDATER
|
||||
ifndef MOZ_NATIVE_BZ2
|
||||
tier_platform_dirs += modules/libbz2
|
||||
|
@ -1861,35 +1861,6 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
|
||||
return LaunchChild(aNative);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
ImportProfiles(nsIToolkitProfileService* aPService,
|
||||
nsINativeAppSupport* aNative)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
SaveToEnv("XRE_IMPORT_PROFILES=1");
|
||||
|
||||
// try to import old-style profiles
|
||||
{ // scope XPCOM
|
||||
ScopedXPCOMStartup xpcom;
|
||||
rv = xpcom.Initialize();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
#ifdef XP_MACOSX
|
||||
CommandLineServiceMac::SetupMacCommandLine(gRestartArgc, gRestartArgv, PR_TRUE);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIProfileMigrator> migrator
|
||||
(do_GetService(NS_PROFILEMIGRATOR_CONTRACTID));
|
||||
if (migrator) {
|
||||
migrator->Import();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
aPService->Flush();
|
||||
return LaunchChild(aNative);
|
||||
}
|
||||
|
||||
// Pick a profile. We need to end up with a profile lock.
|
||||
//
|
||||
// 1) check for -profile <path>
|
||||
@ -2041,12 +2012,6 @@ SelectProfile(nsIProfileLock* *aResult, nsINativeAppSupport* aNative,
|
||||
rv = profileSvc->GetProfileCount(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (gAppData->flags & NS_XRE_ENABLE_PROFILE_MIGRATOR) {
|
||||
if (!count && !EnvHasValue("XRE_IMPORT_PROFILES")) {
|
||||
return ImportProfiles(profileSvc, aNative);
|
||||
}
|
||||
}
|
||||
|
||||
ar = CheckArg("p", PR_FALSE, &arg);
|
||||
if (ar == ARG_BAD) {
|
||||
ar = CheckArg("osint");
|
||||
@ -3468,7 +3433,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
||||
SaveToEnv("XRE_PROFILE_LOCAL_PATH=");
|
||||
SaveToEnv("XRE_PROFILE_NAME=");
|
||||
SaveToEnv("XRE_START_OFFLINE=");
|
||||
SaveToEnv("XRE_IMPORT_PROFILES=");
|
||||
SaveToEnv("NO_EM_RESTART=");
|
||||
SaveToEnv("XUL_APP_FILE=");
|
||||
SaveToEnv("XRE_BINARY_PATH=");
|
||||
|