зеркало из https://github.com/mozilla/gecko-dev.git
190020 r=timeless sr=alecf GetResource should take AUTF8String
This commit is contained in:
Родитель
86eabf3281
Коммит
9405eda256
|
@ -326,49 +326,64 @@ nsChromeRegistry::Init()
|
|||
(nsISupports**)&mRDFContainerUtils);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_selectedSkin, getter_AddRefs(mSelectedSkin));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_selectedSkin),
|
||||
getter_AddRefs(mSelectedSkin));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_selectedLocale, getter_AddRefs(mSelectedLocale));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_selectedLocale),
|
||||
getter_AddRefs(mSelectedLocale));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_baseURL, getter_AddRefs(mBaseURL));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_baseURL),
|
||||
getter_AddRefs(mBaseURL));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_packages, getter_AddRefs(mPackages));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_packages),
|
||||
getter_AddRefs(mPackages));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_package, getter_AddRefs(mPackage));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_package),
|
||||
getter_AddRefs(mPackage));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_name, getter_AddRefs(mName));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_name),
|
||||
getter_AddRefs(mName));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_image, getter_AddRefs(mImage));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_image),
|
||||
getter_AddRefs(mImage));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_locType, getter_AddRefs(mLocType));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_locType),
|
||||
getter_AddRefs(mLocType));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_allowScripts, getter_AddRefs(mAllowScripts));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_allowScripts),
|
||||
getter_AddRefs(mAllowScripts));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_hasOverlays, getter_AddRefs(mHasOverlays));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_hasOverlays),
|
||||
getter_AddRefs(mHasOverlays));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_hasStylesheets, getter_AddRefs(mHasStylesheets));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_hasStylesheets),
|
||||
getter_AddRefs(mHasStylesheets));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_skinVersion, getter_AddRefs(mSkinVersion));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_skinVersion),
|
||||
getter_AddRefs(mSkinVersion));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_localeVersion, getter_AddRefs(mLocaleVersion));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_localeVersion),
|
||||
getter_AddRefs(mLocaleVersion));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_packageVersion, getter_AddRefs(mPackageVersion));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_packageVersion),
|
||||
getter_AddRefs(mPackageVersion));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_disabled, getter_AddRefs(mDisabled));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_disabled),
|
||||
getter_AddRefs(mDisabled));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
|
@ -1251,11 +1266,11 @@ nsChromeRegistry::LoadDataSource(const nsACString &aFileName,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsChromeRegistry::GetResource(const nsCString& aURL,
|
||||
nsChromeRegistry::GetResource(const nsACString& aURL,
|
||||
nsIRDFResource** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (NS_FAILED(rv = mRDFService->GetResource(aURL.get(), aResult))) {
|
||||
if (NS_FAILED(rv = mRDFService->GetResource(aURL, aResult))) {
|
||||
NS_ERROR("Unable to retrieve a resource for this URL.");
|
||||
*aResult = nsnull;
|
||||
return rv;
|
||||
|
|
|
@ -93,7 +93,7 @@ protected:
|
|||
nsresult GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile, PRBool aCreateDS, nsIRDFDataSource **aResult);
|
||||
nsresult GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult);
|
||||
|
||||
nsresult GetResource(const nsCString& aChromeType, nsIRDFResource** aResult);
|
||||
nsresult GetResource(const nsACString& aChromeType, nsIRDFResource** aResult);
|
||||
|
||||
nsresult UpdateDynamicDataSource(nsIRDFDataSource *aDataSource,
|
||||
nsIRDFResource *aResource,
|
||||
|
|
|
@ -3448,7 +3448,7 @@ nsXULElement::GetResource(nsIRDFResource** aResource)
|
|||
}
|
||||
|
||||
if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
|
||||
rv = gRDFService->GetUnicodeResource(id.get(), aResource);
|
||||
rv = gRDFService->GetUnicodeResource(id, aResource);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -3076,7 +3076,8 @@ nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> attr;
|
||||
rv = gRDFService->GetResource(NS_LossyConvertUCS2toASCII(attrstr).get(), getter_AddRefs(attr));
|
||||
rv = gRDFService->GetUnicodeResource(nsDependentString(attrstr),
|
||||
getter_AddRefs(attr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Turn the value into a literal
|
||||
|
@ -3124,7 +3125,7 @@ nsXULDocument::Persist(nsIContent* aElement, PRInt32 aNameSpaceID,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> doc;
|
||||
rv = gRDFService->GetResource(docurl.get(), getter_AddRefs(doc));
|
||||
rv = gRDFService->GetResource(docurl, getter_AddRefs(doc));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
PRBool hasAssertion;
|
||||
|
@ -4416,9 +4417,12 @@ nsXULDocument::Init()
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF Service");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "persist", &kNC_persist);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "attribute", &kNC_attribute);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "value", &kNC_value);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "persist"),
|
||||
&kNC_persist);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "attribute"),
|
||||
&kNC_attribute);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "value"),
|
||||
&kNC_value);
|
||||
|
||||
rv = CallCreateInstance(kHTMLElementFactoryCID, &gHTMLElementFactory);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get HTML element factory");
|
||||
|
@ -4900,7 +4904,7 @@ nsXULDocument::ApplyPersistentAttributes()
|
|||
mDocumentURL->GetSpec(docurl);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> doc;
|
||||
gRDFService->GetResource(docurl.get(), getter_AddRefs(doc));
|
||||
gRDFService->GetResource(docurl, getter_AddRefs(doc));
|
||||
|
||||
nsCOMPtr<nsISimpleEnumerator> persisted;
|
||||
mLocalStore->GetTargets(doc, kNC_persist, PR_TRUE, getter_AddRefs(persisted));
|
||||
|
|
|
@ -100,10 +100,10 @@ nsXULContentUtils::Init()
|
|||
return rv;
|
||||
}
|
||||
|
||||
#define XUL_RESOURCE(ident, uri) \
|
||||
PR_BEGIN_MACRO \
|
||||
rv = gRDF->GetResource((uri), &(ident)); \
|
||||
if (NS_FAILED(rv)) return rv; \
|
||||
#define XUL_RESOURCE(ident, uri) \
|
||||
PR_BEGIN_MACRO \
|
||||
rv = gRDF->GetResource(NS_LITERAL_CSTRING(uri), &(ident)); \
|
||||
if (NS_FAILED(rv)) return rv; \
|
||||
PR_END_MACRO
|
||||
|
||||
#define XUL_LITERAL(ident, val) \
|
||||
|
@ -253,7 +253,7 @@ nsXULContentUtils::GetElementRefResource(nsIContent* aElement, nsIRDFResource**
|
|||
// the protocol), uriStr will be untouched.
|
||||
NS_MakeAbsoluteURI(uri, uri, url);
|
||||
|
||||
rv = gRDF->GetUnicodeResource(uri.get(), aResult);
|
||||
rv = gRDF->GetUnicodeResource(uri, aResult);
|
||||
}
|
||||
else {
|
||||
rv = GetElementResource(aElement, aResult);
|
||||
|
@ -391,7 +391,7 @@ nsXULContentUtils::MakeElementResource(nsIDocument* aDocument, const nsAString&
|
|||
rv = MakeElementURI(aDocument, aID, uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gRDF->GetResource(uri.get(), aResult);
|
||||
rv = gRDF->GetResource(uri, aResult);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -475,7 +475,7 @@ nsXULContentUtils::GetResource(PRInt32 aNameSpaceID, const nsAString& aAttribute
|
|||
|
||||
uri.Append(aAttribute);
|
||||
|
||||
rv = gRDF->GetUnicodeResource(uri.get(), aResult);
|
||||
rv = gRDF->GetUnicodeResource(uri, aResult);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -808,7 +808,7 @@ XULSortServiceImpl::GetNodeValue(nsIContent *node1, sortPtr sortInfo, PRBool fir
|
|||
if (NS_SUCCEEDED(rv = node1->GetAttr(kNameSpaceID_None, nsXULAtoms::id, htmlID))
|
||||
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
||||
{
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(htmlID.get(), getter_AddRefs(res1))))
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(htmlID, getter_AddRefs(res1))))
|
||||
res1 = nsnull;
|
||||
}
|
||||
}
|
||||
|
@ -886,7 +886,7 @@ XULSortServiceImpl::GetNodeValue(contentSortInfo *info1, sortPtr sortInfo, PRBoo
|
|||
if (NS_SUCCEEDED(rv = node1->GetAttr(kNameSpaceID_None, nsXULAtoms::id, htmlID))
|
||||
&& (rv == NS_CONTENT_ATTR_HAS_VALUE))
|
||||
{
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(htmlID.get(), getter_AddRefs(res1))))
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(htmlID, getter_AddRefs(res1))))
|
||||
res1 = nsnull;
|
||||
info1->resource = res1;
|
||||
}
|
||||
|
@ -1333,38 +1333,38 @@ XULSortServiceImpl::InsertContainerNode(nsIRDFCompositeDataSource *db, nsRDFSort
|
|||
sortState->sortPropertySort = nsnull;
|
||||
sortState->sortPropertySort2 = nsnull;
|
||||
|
||||
rv = gRDFService->GetUnicodeResource(sortResource.get(), getter_AddRefs(sortInfo.sortProperty));
|
||||
rv = gRDFService->GetUnicodeResource(sortResource, getter_AddRefs(sortInfo.sortProperty));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
sortState->sortResource = sortResource;
|
||||
sortState->sortProperty = sortInfo.sortProperty;
|
||||
|
||||
nsAutoString resourceUrl = sortResource;
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?collation=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertyColl));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertyColl));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
sortState->sortPropertyColl = sortInfo.sortPropertyColl;
|
||||
|
||||
resourceUrl = sortResource;
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?sort=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertySort));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertySort));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
sortState->sortPropertySort = sortInfo.sortPropertySort;
|
||||
|
||||
if (!sortResource2.IsEmpty()) {
|
||||
rv = gRDFService->GetUnicodeResource(sortResource2.get(), getter_AddRefs(sortInfo.sortProperty2));
|
||||
rv = gRDFService->GetUnicodeResource(sortResource2, getter_AddRefs(sortInfo.sortProperty2));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
sortState->sortResource2 = sortResource2;
|
||||
sortState->sortProperty2 = sortInfo.sortProperty2;
|
||||
|
||||
resourceUrl = sortResource2;
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?collation=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertyColl2));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertyColl2));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
sortState->sortPropertyColl2 = sortInfo.sortPropertyColl2;
|
||||
|
||||
resourceUrl = sortResource2;
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?sort=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertySort2));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertySort2));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
sortState->sortPropertySort2 = sortInfo.sortPropertySort2;
|
||||
}
|
||||
|
@ -1625,33 +1625,33 @@ XULSortServiceImpl::Sort(nsIDOMNode* node, const nsAString& sortResource, const
|
|||
GetSortColumnInfo(contentNode, unused, unused, sortResource2, sortInfo.inbetweenSeparatorSort);
|
||||
|
||||
// build resource url for first sort resource
|
||||
rv = gRDFService->GetUnicodeResource(PromiseFlatString(sortResource).get(), getter_AddRefs(sortInfo.sortProperty));
|
||||
rv = gRDFService->GetUnicodeResource(sortResource, getter_AddRefs(sortInfo.sortProperty));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsAutoString resourceUrl;
|
||||
resourceUrl.Assign(sortResource);
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?collation=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertyColl));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertyColl));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
resourceUrl.Assign(sortResource);
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?sort=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertySort));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertySort));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// build resource url for second sort resource
|
||||
if (!sortResource2.IsEmpty()) {
|
||||
rv = gRDFService->GetUnicodeResource(sortResource2.get(), getter_AddRefs(sortInfo.sortProperty2));
|
||||
rv = gRDFService->GetUnicodeResource(sortResource2, getter_AddRefs(sortInfo.sortProperty2));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
resourceUrl = sortResource2;
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?collation=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertyColl2));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertyColl2));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
resourceUrl = sortResource2;
|
||||
resourceUrl.Append(NS_LITERAL_STRING("?sort=true"));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl.get(), getter_AddRefs(sortInfo.sortPropertySort2));
|
||||
rv = gRDFService->GetUnicodeResource(resourceUrl, getter_AddRefs(sortInfo.sortPropertySort2));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -1317,7 +1317,7 @@ nsXULTemplateBuilder::ComputeContainmentProperties()
|
|||
containment.Mid(propertyStr, offset, end - offset);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> property;
|
||||
rv = gRDFService->GetUnicodeResource(propertyStr.get(), getter_AddRefs(property));
|
||||
rv = gRDFService->GetUnicodeResource(propertyStr, getter_AddRefs(property));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mContainmentProperties.Add(property);
|
||||
|
@ -1797,7 +1797,7 @@ nsXULTemplateBuilder::CompileTripleCondition(nsTemplateRule* aRule,
|
|||
if (subject[0] == PRUnichar('?'))
|
||||
svar = mRules.LookupSymbol(subject.get(), PR_TRUE);
|
||||
else
|
||||
gRDFService->GetUnicodeResource(subject.get(), getter_AddRefs(sres));
|
||||
gRDFService->GetUnicodeResource(subject, getter_AddRefs(sres));
|
||||
|
||||
// predicate
|
||||
nsAutoString predicate;
|
||||
|
@ -1811,7 +1811,7 @@ nsXULTemplateBuilder::CompileTripleCondition(nsTemplateRule* aRule,
|
|||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
gRDFService->GetUnicodeResource(predicate.get(), getter_AddRefs(pres));
|
||||
gRDFService->GetUnicodeResource(predicate, getter_AddRefs(pres));
|
||||
}
|
||||
|
||||
// object
|
||||
|
@ -1826,7 +1826,7 @@ nsXULTemplateBuilder::CompileTripleCondition(nsTemplateRule* aRule,
|
|||
else if (object.FindChar(':') != -1) { // XXXwaterson evil.
|
||||
// treat as resource
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
gRDFService->GetUnicodeResource(object.get(), getter_AddRefs(resource));
|
||||
gRDFService->GetUnicodeResource(object, getter_AddRefs(resource));
|
||||
onode = do_QueryInterface(resource);
|
||||
}
|
||||
else {
|
||||
|
@ -2010,7 +2010,7 @@ nsXULTemplateBuilder::CompileBinding(nsTemplateRule* aRule,
|
|||
return NS_OK;
|
||||
}
|
||||
else {
|
||||
gRDFService->GetUnicodeResource(predicate.get(), getter_AddRefs(pred));
|
||||
gRDFService->GetUnicodeResource(predicate, getter_AddRefs(pred));
|
||||
}
|
||||
|
||||
// object
|
||||
|
@ -2144,7 +2144,7 @@ nsXULTemplateBuilder::CompileSimpleRule(nsIContent* aRuleElement,
|
|||
nsCOMPtr<nsIRDFNode> target;
|
||||
if (value.FindChar(':') != -1) { // XXXwaterson WRONG WRONG WRONG!
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = gRDFService->GetUnicodeResource(value.get(), getter_AddRefs(resource));
|
||||
rv = gRDFService->GetUnicodeResource(value, getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
target = do_QueryInterface(resource);
|
||||
|
@ -2285,7 +2285,7 @@ nsXULTemplateBuilder::AddBindingsFor(nsXULTemplateBuilder* aThis,
|
|||
const nsAString& propertyStr = Substring(aVariable, PRUint32(4), aVariable.Length() - 4);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> property;
|
||||
gRDFService->GetUnicodeResource(nsAutoString(propertyStr).get(), getter_AddRefs(property));
|
||||
gRDFService->GetUnicodeResource(propertyStr, getter_AddRefs(property));
|
||||
|
||||
if (! rule->HasBinding(aThis->mMemberVar, property, var))
|
||||
// In the simple syntax, the binding is always from the
|
||||
|
|
|
@ -331,8 +331,9 @@ nsXULTreeBuilder::Init()
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (gRefCnt++ == 0) {
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "BookmarkSeparator", &kNC_BookmarkSeparator);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"), &kRDF_type);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "BookmarkSeparator"),
|
||||
&kNC_BookmarkSeparator);
|
||||
}
|
||||
|
||||
// Try to acquire a collation object for sorting
|
||||
|
|
|
@ -344,7 +344,7 @@ nsresult nsAbAddressCollecter::SetAbURI(const char *aURI)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIRDFResource> resource;
|
||||
rv = rdfService->GetResource(m_abURI.get(), getter_AddRefs(resource));
|
||||
rv = rdfService->GetResource(m_abURI, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
m_directory = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -570,10 +570,10 @@ nsAbAutoCompleteSession::SearchReplicatedLDAPDirectories(nsIPref *aPref, nsAbAut
|
|||
URI = NS_LITERAL_CSTRING("moz-abmdbdirectory://") + fileName;
|
||||
|
||||
// and then search the replicated directory
|
||||
return SearchDirectory(URI.get(), searchStr, searchSubDirectory, results);
|
||||
return SearchDirectory(URI, searchStr, searchSubDirectory, results);
|
||||
}
|
||||
|
||||
nsresult nsAbAutoCompleteSession::SearchDirectory(const char *aURI, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results)
|
||||
nsresult nsAbAutoCompleteSession::SearchDirectory(const nsACString& aURI, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIRDFService> rdfService(do_GetService("@mozilla.org/rdf/rdf-service;1", &rv));
|
||||
|
@ -598,7 +598,7 @@ nsresult nsAbAutoCompleteSession::SearchDirectory(const char *aURI, nsAbAutoComp
|
|||
if (!searchDuringLocalAutocomplete)
|
||||
return NS_OK;
|
||||
|
||||
if (nsCRT::strcmp(kAllDirectoryRoot, aURI))
|
||||
if (!aURI.Equals(NS_LITERAL_CSTRING(kAllDirectoryRoot)))
|
||||
rv = SearchCards(directory, searchStr, results);
|
||||
|
||||
if (!searchSubDirectory)
|
||||
|
@ -622,7 +622,7 @@ nsresult nsAbAutoCompleteSession::SearchDirectory(const char *aURI, nsAbAutoComp
|
|||
{
|
||||
nsXPIDLCString URI;
|
||||
subResource->GetValue(getter_Copies(URI));
|
||||
rv = SearchDirectory(URI.get(), searchStr, PR_TRUE, results);
|
||||
rv = SearchDirectory(URI, searchStr, PR_TRUE, results);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -746,7 +746,8 @@ NS_IMETHODIMP nsAbAutoCompleteSession::OnStartLookup(const PRUnichar *uSearchStr
|
|||
nsresult rv1,rv2;
|
||||
|
||||
if (enableLocalAutocomplete) {
|
||||
rv1 = SearchDirectory(kAllDirectoryRoot, &searchStrings, PR_TRUE, results);
|
||||
rv1 = SearchDirectory(NS_LITERAL_CSTRING(kAllDirectoryRoot), &searchStrings,
|
||||
PR_TRUE, results);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv1), "searching all local directories failed");
|
||||
}
|
||||
else
|
||||
|
|
|
@ -127,7 +127,7 @@ private:
|
|||
#define MAX_NUMBER_OF_EMAIL_ADDRESSES 2
|
||||
|
||||
nsresult SearchCards(nsIAbDirectory* directory, nsAbAutoCompleteSearchString* searchStr, nsIAutoCompleteResults* results);
|
||||
nsresult SearchDirectory(const char *aURI, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results);
|
||||
nsresult SearchDirectory(const nsACString& aURI, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results);
|
||||
nsresult SearchPreviousResults(nsAbAutoCompleteSearchString *uSearchString, nsIAutoCompleteResults *previousSearchResult, nsIAutoCompleteResults* results);
|
||||
|
||||
nsresult SearchReplicatedLDAPDirectories(nsIPref *aPrefs, nsAbAutoCompleteSearchString* searchStr, PRBool searchSubDirectory, nsIAutoCompleteResults* results);
|
||||
|
|
|
@ -123,12 +123,10 @@ nsAbCardProperty::nsAbCardProperty(void)
|
|||
|
||||
m_PreferMailFormat = nsIAbPreferMailFormat::unknown;
|
||||
m_IsMailList = PR_FALSE;
|
||||
m_MailListURI = nsnull;
|
||||
}
|
||||
|
||||
nsAbCardProperty::~nsAbCardProperty(void)
|
||||
{
|
||||
CRTFREEIF(m_MailListURI);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAbCardProperty, nsIAbCard)
|
||||
|
@ -185,12 +183,10 @@ NS_IMETHODIMP nsAbCardProperty::GetMailListURI(char **aMailListURI)
|
|||
{
|
||||
if (aMailListURI)
|
||||
{
|
||||
if (m_MailListURI)
|
||||
*aMailListURI = nsCRT::strdup(m_MailListURI);
|
||||
else
|
||||
*aMailListURI = nsCRT::strdup("");
|
||||
|
||||
return NS_OK;
|
||||
*aMailListURI = ToNewCString(m_MailListURI);
|
||||
if (*aMailListURI)
|
||||
return NS_OK;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
else
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -200,8 +196,7 @@ NS_IMETHODIMP nsAbCardProperty::SetMailListURI(const char *aMailListURI)
|
|||
{
|
||||
if (aMailListURI)
|
||||
{
|
||||
nsCRT::free (m_MailListURI);
|
||||
m_MailListURI = nsCRT::strdup(aMailListURI);
|
||||
m_MailListURI = aMailListURI;
|
||||
return NS_OK;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -129,7 +129,7 @@ protected:
|
|||
PRUint32 m_PreferMailFormat;
|
||||
|
||||
PRBool m_IsMailList;
|
||||
char* m_MailListURI;
|
||||
nsCString m_MailListURI;
|
||||
|
||||
private:
|
||||
nsresult AppendData(const char *aAttrName, mozITXTToHTMLConv *aConv, nsString &aResult);
|
||||
|
|
|
@ -112,10 +112,10 @@ NS_IMETHODIMP nsAbLDAPDirFactory::CreateDirectory(nsIAbDirectoryProperties *aPro
|
|||
*/
|
||||
nsCAutoString bridgeURI;
|
||||
bridgeURI = NS_LITERAL_CSTRING(kLDAPDirectoryRoot) + prefName;
|
||||
rv = rdf->GetResource(bridgeURI.get(), getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(bridgeURI, getter_AddRefs(resource));
|
||||
}
|
||||
else {
|
||||
rv = rdf->GetResource(uri.get(), getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(resource));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ NS_IMETHODIMP nsAbLDAPDirectory::GetChildCards(nsIEnumerator** result)
|
|||
localDirectoryURI = NS_LITERAL_CSTRING("moz-abmdbdirectory://") + fileName + NS_LITERAL_CSTRING("?") + mQueryString;
|
||||
|
||||
nsCOMPtr <nsIRDFResource> resource;
|
||||
rv = rdfService->GetResource(localDirectoryURI.get(), getter_AddRefs(resource));
|
||||
rv = rdfService->GetResource(localDirectoryURI, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIAbDirectory> directory = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -119,7 +119,7 @@ NS_IMETHODIMP nsAbMDBDirFactory::CreateDirectory(nsIAbDirectoryProperties *aProp
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(uri.get(), getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(resource, &rv));
|
||||
|
|
|
@ -320,7 +320,7 @@ NS_IMETHODIMP nsAbMDBDirectory::AddDirectory(const char *uriName, nsIAbDirectory
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uriName, getter_AddRefs(res));
|
||||
rv = rdf->GetResource(nsDependentCString(uriName), getter_AddRefs(res));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(res, &rv));
|
||||
|
@ -438,7 +438,7 @@ NS_IMETHODIMP nsAbMDBDirectory::DeleteCards(nsISupportsArray *cards)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = gRDFService->GetResource(mURINoQuery.get(), getter_AddRefs(resource));
|
||||
rv = gRDFService->GetResource(mURINoQuery, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> directory = do_QueryInterface(resource, &rv);
|
||||
|
@ -513,7 +513,8 @@ NS_IMETHODIMP nsAbMDBDirectory::DeleteCards(nsISupportsArray *cards)
|
|||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> listResource;
|
||||
rv = rdfService->GetResource(listUri, getter_AddRefs(listResource));
|
||||
rv = rdfService->GetResource(nsDependentCString(listUri),
|
||||
getter_AddRefs(listResource));
|
||||
nsCOMPtr<nsIAbDirectory> listDir = do_QueryInterface(listResource, &rv);
|
||||
if(NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
@ -932,7 +933,7 @@ NS_IMETHODIMP nsAbMDBDirectory::StartSearch()
|
|||
|
||||
// Get the directory without the query
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = gRDFService->GetResource (mURINoQuery.get(), getter_AddRefs(resource));
|
||||
rv = gRDFService->GetResource (mURINoQuery, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> directory(do_QueryInterface(resource, &rv));
|
||||
|
|
|
@ -219,7 +219,7 @@ NS_IMETHODIMP nsAbView::Init(const char *aURI, nsIAbViewListener *abViewListener
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIRDFResource> resource;
|
||||
rv = rdfService->GetResource(aURI, getter_AddRefs(resource));
|
||||
rv = rdfService->GetResource(nsDependentCString(aURI), getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mDirectory = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -231,7 +231,7 @@ nsAddbookProtocolHandler::GeneratePrintOutput(nsIAddbookUrl *addbookUrl,
|
|||
uri.Insert(':', pos);
|
||||
|
||||
nsCOMPtr <nsIRDFResource> resource;
|
||||
rv = rdfService->GetResource(uri.get(), getter_AddRefs(resource));
|
||||
rv = rdfService->GetResource(uri, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIAbDirectory> directory = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -3589,7 +3589,7 @@ NS_IMETHODIMP nsAddrDatabase::AddListDirNode(nsIMdbRow * listRow)
|
|||
|
||||
char* file = m_dbName.GetLeafName();
|
||||
char *parentUri = PR_smprintf("%s%s", kMDBDirectoryRoot, file);
|
||||
rv = rdfService->GetResource( parentUri, getter_AddRefs(parentResource));
|
||||
rv = rdfService->GetResource(nsDependentCString(parentUri), getter_AddRefs(parentResource));
|
||||
nsCOMPtr<nsIAbDirectory> parentDir;
|
||||
rv = proxyMgr->GetProxyForObject( NS_UI_THREAD_EVENTQ, NS_GET_IID( nsIAbDirectory),
|
||||
parentResource, PROXY_SYNC | PROXY_ALWAYS, getter_AddRefs( parentDir));
|
||||
|
|
|
@ -129,7 +129,8 @@ NS_IMETHODIMP nsAddressBook::NewAddressBook(nsIAbDirectoryProperties *aPropertie
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> parentResource;
|
||||
rv = rdfService->GetResource(kAllDirectoryRoot, getter_AddRefs(parentResource));
|
||||
rv = rdfService->GetResource(NS_LITERAL_CSTRING(kAllDirectoryRoot),
|
||||
getter_AddRefs(parentResource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIAbDirectory> parentDir = do_QueryInterface(parentResource, &rv);
|
||||
|
@ -146,11 +147,11 @@ NS_IMETHODIMP nsAddressBook::DeleteAddressBooks
|
|||
NS_ENSURE_ARG_POINTER(aParentDir);
|
||||
NS_ENSURE_ARG_POINTER(aResourceArray);
|
||||
|
||||
return DoCommand(aDS, NC_RDF_DELETE, aParentDir, aResourceArray);
|
||||
return DoCommand(aDS, NS_LITERAL_CSTRING(NC_RDF_DELETE), aParentDir, aResourceArray);
|
||||
}
|
||||
|
||||
nsresult nsAddressBook::DoCommand(nsIRDFDataSource* db,
|
||||
const char *command,
|
||||
const nsACString& command,
|
||||
nsISupportsArray *srcArray,
|
||||
nsISupportsArray *argumentArray)
|
||||
{
|
||||
|
@ -434,13 +435,11 @@ nsresult AddressBookParser::ParseFile()
|
|||
nsCOMPtr<nsIRDFService> rdfService = do_GetService (NS_RDF_CONTRACTID "/rdf-service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIRDFResource> parentResource;
|
||||
char *parentUri = PR_smprintf("%s", kAllDirectoryRoot);
|
||||
rv = rdfService->GetResource(parentUri, getter_AddRefs(parentResource));
|
||||
rv = rdfService->GetResource(NS_LITERAL_CSTRING(kAllDirectoryRoot),
|
||||
getter_AddRefs(parentResource));
|
||||
nsCOMPtr<nsIAbDirectory> parentDir = do_QueryInterface(parentResource);
|
||||
if (!parentDir)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
if (parentUri)
|
||||
PR_smprintf_free(parentUri);
|
||||
|
||||
if (PL_strcmp(fileName, kPersonalAddressbook) == 0)
|
||||
{
|
||||
|
@ -1649,7 +1648,7 @@ nsresult nsAddressBook::AppendLDIFForMailList(nsIAbCard *aCard, nsACString &aRes
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIRDFResource> resource;
|
||||
rv = rdfService->GetResource(mailListURI.get(), getter_AddRefs(resource));
|
||||
rv = rdfService->GetResource(mailListURI, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr <nsIAbDirectory> mailList = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
CMDLINEHANDLER_REGISTERPROC_DECLS
|
||||
|
||||
protected:
|
||||
nsresult DoCommand(nsIRDFDataSource *db, const char * command,
|
||||
nsresult DoCommand(nsIRDFDataSource *db, const nsACString& command,
|
||||
nsISupportsArray *srcArray, nsISupportsArray *arguments);
|
||||
nsresult GetAbDatabaseFromFile(char* pDbFile, nsIAddrDatabase **db);
|
||||
|
||||
|
|
|
@ -132,26 +132,36 @@ nsAbDirectoryDataSource::Init()
|
|||
|
||||
rv = rdf->RegisterDataSource(this, PR_FALSE);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = rdf->GetResource(NC_RDF_CHILD, getter_AddRefs(kNC_Child));
|
||||
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHILD),
|
||||
getter_AddRefs(kNC_Child));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_DIRNAME, getter_AddRefs(kNC_DirName));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DIRNAME),
|
||||
getter_AddRefs(kNC_DirName));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_CARDCHILD, getter_AddRefs(kNC_CardChild));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CARDCHILD),
|
||||
getter_AddRefs(kNC_CardChild));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_DIRURI, getter_AddRefs(kNC_DirUri));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DIRURI),
|
||||
getter_AddRefs(kNC_DirUri));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_ISMAILLIST, getter_AddRefs(kNC_IsMailList));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISMAILLIST),
|
||||
getter_AddRefs(kNC_IsMailList));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_ISREMOTE, getter_AddRefs(kNC_IsRemote));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISREMOTE),
|
||||
getter_AddRefs(kNC_IsRemote));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_ISSECURE, getter_AddRefs(kNC_IsSecure));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISSECURE),
|
||||
getter_AddRefs(kNC_IsSecure));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_ISWRITEABLE, getter_AddRefs(kNC_IsWriteable));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISWRITEABLE),
|
||||
getter_AddRefs(kNC_IsWriteable));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_DELETE, getter_AddRefs(kNC_Delete));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DELETE),
|
||||
getter_AddRefs(kNC_Delete));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = rdf->GetResource(NC_RDF_DELETECARDS, getter_AddRefs(kNC_DeleteCards));
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DELETECARDS),
|
||||
getter_AddRefs(kNC_DeleteCards));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = createNode(NS_LITERAL_STRING("true").get(), getter_AddRefs(kTrueLiteral));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
|
|
@ -93,9 +93,9 @@ nsMsgFilterDataSource::initGlobalObjects(nsIRDFService *rdf)
|
|||
rdf->GetLiteral(NS_LITERAL_STRING("true").get(),
|
||||
getter_AddRefs(kTrueLiteral));
|
||||
|
||||
rdf->GetResource(NC_RDF_CHILD, getter_AddRefs(kNC_Child));
|
||||
rdf->GetResource(NC_RDF_NAME, getter_AddRefs(kNC_Name));
|
||||
rdf->GetResource(NC_RDF_ENABLED, getter_AddRefs(kNC_Enabled));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHILD), getter_AddRefs(kNC_Child));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME), getter_AddRefs(kNC_Name));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ENABLED), getter_AddRefs(kNC_Enabled));
|
||||
|
||||
NS_NewISupportsArray(getter_AddRefs(mFilterListArcsOut));
|
||||
mFilterListArcsOut->AppendElement(kNC_Child);
|
||||
|
@ -336,7 +336,7 @@ nsMsgFilterDataSource::getFilterListTargets(nsIMsgFilterList *aFilterList,
|
|||
Recycle(utf8Name);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> filterResource;
|
||||
rv = getRDFService()->GetResource(filterUri.get(),
|
||||
rv = getRDFService()->GetResource(filterUri,
|
||||
getter_AddRefs(filterResource));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
aResult->AppendElement(filterResource);
|
||||
|
|
|
@ -210,7 +210,7 @@ nsMsgFilterDelegateFactory::getFilterList(const char *aUri,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> filterListResource;
|
||||
rdf->GetResource(folderUri.get(), getter_AddRefs(filterListResource));
|
||||
rdf->GetResource(folderUri, getter_AddRefs(filterListResource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return filterListResource->GetDelegate("filter",
|
||||
|
|
|
@ -865,7 +865,7 @@ nsresult nsMsgSearchTerm::InitializeAddressBook()
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIRDFResource> resource;
|
||||
rv = rdfService->GetResource(m_value.string, getter_AddRefs(resource));
|
||||
rv = rdfService->GetResource(nsDependentCString(m_value.string), getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mDirectory = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -1059,7 +1059,7 @@ nsMessenger::Alert(const char *stringName)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, const char *command,
|
||||
nsMessenger::DoCommand(nsIRDFCompositeDataSource* db, const nsACString& command,
|
||||
nsISupportsArray *srcArray,
|
||||
nsISupportsArray *argumentArray)
|
||||
{
|
||||
|
@ -1103,9 +1103,9 @@ nsMessenger::DeleteMessages(nsIRDFCompositeDataSource *database,
|
|||
folderArray->AppendElement(srcFolderResource);
|
||||
|
||||
if(reallyDelete)
|
||||
rv = DoCommand(database, NC_RDF_REALLY_DELETE, folderArray, resourceArray);
|
||||
rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_REALLY_DELETE), folderArray, resourceArray);
|
||||
else
|
||||
rv = DoCommand(database, NC_RDF_DELETE, folderArray, resourceArray);
|
||||
rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_DELETE), folderArray, resourceArray);
|
||||
|
||||
|
||||
return rv;
|
||||
|
@ -1139,7 +1139,7 @@ NS_IMETHODIMP nsMessenger::DeleteFolders(nsIRDFCompositeDataSource *db,
|
|||
parentArray->AppendElement(parentResource);
|
||||
deletedArray->AppendElement(deletedFolderResource);
|
||||
|
||||
rv = DoCommand(db, NC_RDF_DELETE, parentArray, deletedArray);
|
||||
rv = DoCommand(db, NS_LITERAL_CSTRING(NC_RDF_DELETE), parentArray, deletedArray);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1172,7 +1172,10 @@ nsMessenger::CopyMessages(nsIRDFCompositeDataSource *database,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
folderArray->AppendElement(dstResource);
|
||||
rv = DoCommand(database, isMove ? (char *)NC_RDF_MOVE : (char *)NC_RDF_COPY, folderArray, argumentArray);
|
||||
if (isMove)
|
||||
rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_MOVE), folderArray, argumentArray);
|
||||
else
|
||||
rv = DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_COPY), folderArray, argumentArray);
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
@ -1208,7 +1211,10 @@ nsMessenger::CopyFolders(nsIRDFCompositeDataSource *database,
|
|||
|
||||
folderArray->AppendElement(dstResource);
|
||||
|
||||
return DoCommand(database, isMoveFolder ? NC_RDF_MOVEFOLDER : NC_RDF_COPYFOLDER, folderArray, argumentArray);
|
||||
if (isMoveFolder)
|
||||
return DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_MOVEFOLDER), folderArray, argumentArray);
|
||||
|
||||
return DoCommand(database, NS_LITERAL_CSTRING(NC_RDF_COPYFOLDER), folderArray, argumentArray);
|
||||
|
||||
}
|
||||
|
||||
|
@ -1234,7 +1240,7 @@ nsMessenger::RenameFolder(nsIRDFCompositeDataSource* db,
|
|||
|
||||
rdfService->GetLiteral(name, getter_AddRefs(nameLiteral));
|
||||
argsArray->AppendElement(nameLiteral);
|
||||
rv = DoCommand(db, NC_RDF_RENAME, folderArray, argsArray);
|
||||
rv = DoCommand(db, NS_LITERAL_CSTRING(NC_RDF_RENAME), folderArray, argsArray);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -1251,7 +1257,10 @@ nsMessenger::CompactFolder(nsIRDFCompositeDataSource* db,
|
|||
rv = NS_NewISupportsArray(getter_AddRefs(folderArray));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
folderArray->AppendElement(folderResource);
|
||||
rv = DoCommand(db, NS_CONST_CAST(char*, forAll ? NC_RDF_COMPACTALL : NC_RDF_COMPACT), folderArray, nsnull);
|
||||
if (forAll)
|
||||
rv = DoCommand(db, NS_LITERAL_CSTRING(NC_RDF_COMPACTALL), folderArray, nsnull);
|
||||
else
|
||||
rv = DoCommand(db, NS_LITERAL_CSTRING(NC_RDF_COMPACT), folderArray, nsnull);
|
||||
if (NS_SUCCEEDED(rv) && mTxnMgr)
|
||||
mTxnMgr->Clear();
|
||||
return rv;
|
||||
|
@ -1269,7 +1278,7 @@ nsMessenger::EmptyTrash(nsIRDFCompositeDataSource* db,
|
|||
rv = NS_NewISupportsArray(getter_AddRefs(folderArray));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
folderArray->AppendElement(folderResource);
|
||||
rv = DoCommand(db, NC_RDF_EMPTYTRASH, folderArray, nsnull);
|
||||
rv = DoCommand(db, NS_LITERAL_CSTRING(NC_RDF_EMPTYTRASH), folderArray, nsnull);
|
||||
if (NS_SUCCEEDED(rv) && mTxnMgr)
|
||||
mTxnMgr->Clear();
|
||||
return rv;
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsresult DoDelete(nsIRDFCompositeDataSource* db, nsISupportsArray *srcArray, nsISupportsArray *deletedArray);
|
||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, const char * command, nsISupportsArray *srcArray,
|
||||
nsresult DoCommand(nsIRDFCompositeDataSource *db, const nsACString& command, nsISupportsArray *srcArray,
|
||||
nsISupportsArray *arguments);
|
||||
PRUnichar *GetString(const PRUnichar *aStringName);
|
||||
nsresult InitStringBundle();
|
||||
|
|
|
@ -159,38 +159,55 @@ nsMsgAccountManagerDataSource::nsMsgAccountManagerDataSource()
|
|||
|
||||
// do per-class initialization here
|
||||
if (gAccountManagerResourceRefCnt++ == 0) {
|
||||
getRDFService()->GetResource(NC_RDF_CHILD, &kNC_Child);
|
||||
getRDFService()->GetResource(NC_RDF_NAME, &kNC_Name);
|
||||
getRDFService()->GetResource(NC_RDF_FOLDERTREENAME, &kNC_FolderTreeName);
|
||||
getRDFService()->GetResource(NC_RDF_FOLDERTREESIMPLENAME, &kNC_FolderTreeSimpleName);
|
||||
getRDFService()->GetResource(NC_RDF_NAME_SORT, &kNC_NameSort);
|
||||
getRDFService()->GetResource(NC_RDF_FOLDERTREENAME_SORT, &kNC_FolderTreeNameSort);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETAG, &kNC_PageTag);
|
||||
getRDFService()->GetResource(NC_RDF_ISDEFAULTSERVER, &kNC_IsDefaultServer);
|
||||
getRDFService()->GetResource(NC_RDF_SUPPORTSFILTERS, &kNC_SupportsFilters);
|
||||
getRDFService()->GetResource(NC_RDF_CANGETMESSAGES, &kNC_CanGetMessages);
|
||||
getRDFService()->GetResource(NC_RDF_CANGETINCOMINGMESSAGES, &kNC_CanGetIncomingMessages);
|
||||
getRDFService()->GetResource(NC_RDF_ACCOUNT, &kNC_Account);
|
||||
getRDFService()->GetResource(NC_RDF_SERVER, &kNC_Server);
|
||||
getRDFService()->GetResource(NC_RDF_IDENTITY, &kNC_Identity);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_MAIN, &kNC_PageTitleMain);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_SERVER, &kNC_PageTitleServer);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_COPIES, &kNC_PageTitleCopies);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_OFFLINEANDDISKSPACE, &kNC_PageTitleOfflineAndDiskSpace);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_DISKSPACE, &kNC_PageTitleDiskSpace);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_ADDRESSING, &kNC_PageTitleAddressing);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_ADVANCED, &kNC_PageTitleAdvanced);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_SMTP, &kNC_PageTitleSMTP);
|
||||
getRDFService()->GetResource(NC_RDF_PAGETITLE_FAKEACCOUNT, &kNC_PageTitleFakeAccount);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHILD), &kNC_Child);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME), &kNC_Name);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME),
|
||||
&kNC_FolderTreeName);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREESIMPLENAME),
|
||||
&kNC_FolderTreeSimpleName);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME_SORT), &kNC_NameSort);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME_SORT),
|
||||
&kNC_FolderTreeNameSort);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETAG), &kNC_PageTag);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISDEFAULTSERVER),
|
||||
&kNC_IsDefaultServer);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SUPPORTSFILTERS),
|
||||
&kNC_SupportsFilters);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANGETMESSAGES),
|
||||
&kNC_CanGetMessages);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANGETINCOMINGMESSAGES),
|
||||
&kNC_CanGetIncomingMessages);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ACCOUNT), &kNC_Account);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SERVER), &kNC_Server);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_IDENTITY), &kNC_Identity);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_MAIN),
|
||||
&kNC_PageTitleMain);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_SERVER),
|
||||
&kNC_PageTitleServer);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_COPIES),
|
||||
&kNC_PageTitleCopies);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_OFFLINEANDDISKSPACE),
|
||||
&kNC_PageTitleOfflineAndDiskSpace);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_DISKSPACE),
|
||||
&kNC_PageTitleDiskSpace);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_ADDRESSING),
|
||||
&kNC_PageTitleAddressing);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_ADVANCED),
|
||||
&kNC_PageTitleAdvanced);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_SMTP),
|
||||
&kNC_PageTitleSMTP);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_FAKEACCOUNT),
|
||||
&kNC_PageTitleFakeAccount);
|
||||
|
||||
getRDFService()->GetResource(NC_RDF_ACCOUNTROOT, &kNC_AccountRoot);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ACCOUNTROOT),
|
||||
&kNC_AccountRoot);
|
||||
|
||||
getRDFService()->GetLiteral(NS_LITERAL_STRING("true").get(),
|
||||
&kTrueLiteral);
|
||||
|
||||
// eventually these need to exist in some kind of array
|
||||
// that's easily extensible
|
||||
getRDFService()->GetResource(NC_RDF_SETTINGS, &kNC_Settings);
|
||||
getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SETTINGS), &kNC_Settings);
|
||||
|
||||
kDefaultServerAtom = NS_NewAtom("DefaultServer");
|
||||
}
|
||||
|
@ -758,7 +775,7 @@ nsMsgAccountManagerDataSource::appendGenericSetting(const char *name, nsISupport
|
|||
resourceStr = NC_RDF_PAGETITLE_PREFIX;
|
||||
resourceStr += name;
|
||||
|
||||
nsresult rv = getRDFService()->GetResource(resourceStr.get(), getter_AddRefs(resource));
|
||||
nsresult rv = getRDFService()->GetResource(resourceStr, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// AppendElement will addref.
|
||||
|
|
|
@ -135,56 +135,56 @@ nsMsgFolderDataSource::nsMsgFolderDataSource()
|
|||
nsIRDFService* rdf = getRDFService();
|
||||
|
||||
if (gFolderResourceRefCnt++ == 0) {
|
||||
rdf->GetResource(NC_RDF_CHILD, &kNC_Child);
|
||||
rdf->GetResource(NC_RDF_FOLDER, &kNC_Folder);
|
||||
rdf->GetResource(NC_RDF_NAME, &kNC_Name);
|
||||
rdf->GetResource(NC_RDF_OPEN, &kNC_Open);
|
||||
rdf->GetResource(NC_RDF_FOLDERTREENAME, &kNC_FolderTreeName);
|
||||
rdf->GetResource(NC_RDF_FOLDERTREESIMPLENAME, &kNC_FolderTreeSimpleName);
|
||||
rdf->GetResource(NC_RDF_NAME_SORT, &kNC_NameSort);
|
||||
rdf->GetResource(NC_RDF_FOLDERTREENAME_SORT, &kNC_FolderTreeNameSort);
|
||||
rdf->GetResource(NC_RDF_SPECIALFOLDER, &kNC_SpecialFolder);
|
||||
rdf->GetResource(NC_RDF_SERVERTYPE, &kNC_ServerType);
|
||||
rdf->GetResource(NC_RDF_REDIRECTORTYPE, &kNC_RedirectorType);
|
||||
rdf->GetResource(NC_RDF_CANCREATEFOLDERSONSERVER, &kNC_CanCreateFoldersOnServer);
|
||||
rdf->GetResource(NC_RDF_CANFILEMESSAGESONSERVER, &kNC_CanFileMessagesOnServer);
|
||||
rdf->GetResource(NC_RDF_ISSERVER, &kNC_IsServer);
|
||||
rdf->GetResource(NC_RDF_ISSECURE, &kNC_IsSecure);
|
||||
rdf->GetResource(NC_RDF_CANSUBSCRIBE, &kNC_CanSubscribe);
|
||||
rdf->GetResource(NC_RDF_SUPPORTSOFFLINE, &kNC_SupportsOffline);
|
||||
rdf->GetResource(NC_RDF_CANFILEMESSAGES, &kNC_CanFileMessages);
|
||||
rdf->GetResource(NC_RDF_CANCREATESUBFOLDERS, &kNC_CanCreateSubfolders);
|
||||
rdf->GetResource(NC_RDF_CANRENAME, &kNC_CanRename);
|
||||
rdf->GetResource(NC_RDF_CANCOMPACT, &kNC_CanCompact);
|
||||
rdf->GetResource(NC_RDF_TOTALMESSAGES, &kNC_TotalMessages);
|
||||
rdf->GetResource(NC_RDF_TOTALUNREADMESSAGES, &kNC_TotalUnreadMessages);
|
||||
rdf->GetResource(NC_RDF_FOLDERSIZE, &kNC_FolderSize);
|
||||
rdf->GetResource(NC_RDF_CHARSET, &kNC_Charset);
|
||||
rdf->GetResource(NC_RDF_BIFFSTATE, &kNC_BiffState);
|
||||
rdf->GetResource(NC_RDF_HASUNREADMESSAGES, &kNC_HasUnreadMessages);
|
||||
rdf->GetResource(NC_RDF_NEWMESSAGES, &kNC_NewMessages);
|
||||
rdf->GetResource(NC_RDF_SUBFOLDERSHAVEUNREADMESSAGES, &kNC_SubfoldersHaveUnreadMessages);
|
||||
rdf->GetResource(NC_RDF_NOSELECT, &kNC_NoSelect);
|
||||
rdf->GetResource(NC_RDF_IMAPSHARED, &kNC_ImapShared);
|
||||
rdf->GetResource(NC_RDF_SYNCHRONIZE, &kNC_Synchronize);
|
||||
rdf->GetResource(NC_RDF_SYNCDISABLED, &kNC_SyncDisabled);
|
||||
rdf->GetResource(NC_RDF_CANSEARCHMESSAGES, &kNC_CanSearchMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHILD), &kNC_Child);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDER), &kNC_Folder);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME), &kNC_Name);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_OPEN), &kNC_Open);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME), &kNC_FolderTreeName);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREESIMPLENAME), &kNC_FolderTreeSimpleName);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME_SORT), &kNC_NameSort);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME_SORT), &kNC_FolderTreeNameSort);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SPECIALFOLDER), &kNC_SpecialFolder);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SERVERTYPE), &kNC_ServerType);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_REDIRECTORTYPE), &kNC_RedirectorType);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANCREATEFOLDERSONSERVER), &kNC_CanCreateFoldersOnServer);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANFILEMESSAGESONSERVER), &kNC_CanFileMessagesOnServer);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISSERVER), &kNC_IsServer);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISSECURE), &kNC_IsSecure);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANSUBSCRIBE), &kNC_CanSubscribe);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SUPPORTSOFFLINE), &kNC_SupportsOffline);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANFILEMESSAGES), &kNC_CanFileMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANCREATESUBFOLDERS), &kNC_CanCreateSubfolders);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANRENAME), &kNC_CanRename);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANCOMPACT), &kNC_CanCompact);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_TOTALMESSAGES), &kNC_TotalMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_TOTALUNREADMESSAGES), &kNC_TotalUnreadMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERSIZE), &kNC_FolderSize);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHARSET), &kNC_Charset);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_BIFFSTATE), &kNC_BiffState);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_HASUNREADMESSAGES), &kNC_HasUnreadMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_NEWMESSAGES), &kNC_NewMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SUBFOLDERSHAVEUNREADMESSAGES), &kNC_SubfoldersHaveUnreadMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_NOSELECT), &kNC_NoSelect);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_IMAPSHARED), &kNC_ImapShared);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SYNCHRONIZE), &kNC_Synchronize);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SYNCDISABLED), &kNC_SyncDisabled);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANSEARCHMESSAGES), &kNC_CanSearchMessages);
|
||||
|
||||
rdf->GetResource(NC_RDF_DELETE, &kNC_Delete);
|
||||
rdf->GetResource(NC_RDF_REALLY_DELETE, &kNC_ReallyDelete);
|
||||
rdf->GetResource(NC_RDF_NEWFOLDER, &kNC_NewFolder);
|
||||
rdf->GetResource(NC_RDF_GETNEWMESSAGES, &kNC_GetNewMessages);
|
||||
rdf->GetResource(NC_RDF_COPY, &kNC_Copy);
|
||||
rdf->GetResource(NC_RDF_MOVE, &kNC_Move);
|
||||
rdf->GetResource(NC_RDF_COPYFOLDER, &kNC_CopyFolder);
|
||||
rdf->GetResource(NC_RDF_MOVEFOLDER, &kNC_MoveFolder);
|
||||
rdf->GetResource(NC_RDF_MARKALLMESSAGESREAD,
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DELETE), &kNC_Delete);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_REALLY_DELETE), &kNC_ReallyDelete);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_NEWFOLDER), &kNC_NewFolder);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_GETNEWMESSAGES), &kNC_GetNewMessages);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_COPY), &kNC_Copy);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_MOVE), &kNC_Move);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_COPYFOLDER), &kNC_CopyFolder);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_MOVEFOLDER), &kNC_MoveFolder);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_MARKALLMESSAGESREAD),
|
||||
&kNC_MarkAllMessagesRead);
|
||||
rdf->GetResource(NC_RDF_COMPACT, &kNC_Compact);
|
||||
rdf->GetResource(NC_RDF_COMPACTALL, &kNC_CompactAll);
|
||||
rdf->GetResource(NC_RDF_RENAME, &kNC_Rename);
|
||||
rdf->GetResource(NC_RDF_EMPTYTRASH, &kNC_EmptyTrash);
|
||||
rdf->GetResource(NC_RDF_DOWNLOADFLAGGED, &kNC_DownloadFlagged);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_COMPACT), &kNC_Compact);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_COMPACTALL), &kNC_CompactAll);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_RENAME), &kNC_Rename);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_EMPTYTRASH), &kNC_EmptyTrash);
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DOWNLOADFLAGGED), &kNC_DownloadFlagged);
|
||||
|
||||
kTotalMessagesAtom = NS_NewAtom("TotalMessages");
|
||||
kTotalUnreadMessagesAtom = NS_NewAtom("TotalUnreadMessages");
|
||||
|
|
|
@ -164,7 +164,7 @@ nsresult nsMsgPurgeService::AddServer(nsIMsgIncomingServer *server)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(junkFolderURI.get(), getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(junkFolderURI, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> junkFolder = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -77,10 +77,12 @@ nsSubscribableServer::Init()
|
|||
rv = EnsureRDFService();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "child",getter_AddRefs(kNC_Child));
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
getter_AddRefs(kNC_Child));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "Subscribed",getter_AddRefs(kNC_Subscribed));
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Subscribed"),
|
||||
getter_AddRefs(kNC_Subscribed));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetLiteral(NS_LITERAL_STRING("true").get(),getter_AddRefs(kTrueLiteral));
|
||||
|
@ -260,9 +262,9 @@ nsSubscribableServer::NotifyAssert(SubscribeTreeNode *subjectNode, nsIRDFResourc
|
|||
rv = EnsureRDFService();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(subjectUri.get(), getter_AddRefs(subject));
|
||||
rv = mRDFService->GetResource(subjectUri, getter_AddRefs(subject));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = mRDFService->GetResource(objectUri.get(), getter_AddRefs(object));
|
||||
rv = mRDFService->GetResource(objectUri, getter_AddRefs(object));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = Notify(subject, property, object, PR_TRUE, PR_FALSE);
|
||||
|
@ -306,7 +308,7 @@ nsSubscribableServer::NotifyChange(SubscribeTreeNode *subjectNode, nsIRDFResourc
|
|||
rv = EnsureRDFService();
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(subjectUri.get(), getter_AddRefs(subject));
|
||||
rv = mRDFService->GetResource(subjectUri, getter_AddRefs(subject));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (value) {
|
||||
|
@ -798,7 +800,7 @@ nsSubscribableServer::GetChildren(const char *path, nsISupportsArray *array)
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
// todo, is this creating nsMsgFolders?
|
||||
mRDFService->GetResource(uri.get(), getter_AddRefs(res));
|
||||
mRDFService->GetResource(uri, getter_AddRefs(res));
|
||||
array->AppendElement(res);
|
||||
|
||||
current = current->prevSibling;
|
||||
|
|
|
@ -83,19 +83,24 @@ nsSubscribeDataSource::Init()
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
if (!mRDFService) return NS_ERROR_FAILURE;
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "child",getter_AddRefs(kNC_Child));
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
getter_AddRefs(kNC_Child));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "Name",getter_AddRefs(kNC_Name));
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
getter_AddRefs(kNC_Name));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "LeafName",getter_AddRefs(kNC_LeafName));
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "LeafName"),
|
||||
getter_AddRefs(kNC_LeafName));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "Subscribed",getter_AddRefs(kNC_Subscribed));
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Subscribed"),
|
||||
getter_AddRefs(kNC_Subscribed));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetResource(NC_NAMESPACE_URI "ServerType",getter_AddRefs(kNC_ServerType));
|
||||
rv = mRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "ServerType"),
|
||||
getter_AddRefs(kNC_ServerType));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = mRDFService->GetLiteral(NS_LITERAL_STRING("true").get(),getter_AddRefs(kTrueLiteral));
|
||||
|
@ -183,7 +188,7 @@ nsSubscribeDataSource::GetTarget(nsIRDFResource *source,
|
|||
if (!(const char *)childUri) return NS_RDF_NO_VALUE;
|
||||
|
||||
nsCOMPtr <nsIRDFResource> childResource;
|
||||
rv = mRDFService->GetResource((const char *)childUri, getter_AddRefs(childResource));
|
||||
rv = mRDFService->GetResource(childUri, getter_AddRefs(childResource));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
return childResource->QueryInterface(NS_GET_IID(nsIRDFNode), (void**) target);
|
||||
|
|
|
@ -427,7 +427,7 @@ nsMsgFolder::FindSubFolder(const char *subFolderName, nsIFolder **aFolder)
|
|||
uri.Append(subFolderName);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uri.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
|
|
@ -535,7 +535,7 @@ nsMsgIdentity::setFolderPref(const char *prefname, const char *value)
|
|||
rv = setCharPref(prefname, value);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
rv = rdf->GetResource(value, getter_AddRefs(res));
|
||||
rv = rdf->GetResource(nsDependentCString(value), getter_AddRefs(res));
|
||||
if (NS_SUCCEEDED(rv) && res)
|
||||
{
|
||||
folder = do_QueryInterface(res, &rv);
|
||||
|
|
|
@ -547,7 +547,7 @@ nsresult GetExistingFolder(const char *aFolderURI, nsIMsgFolder **aFolder)
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(aFolderURI, getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(nsDependentCString(aFolderURI), getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> thisFolder;
|
||||
|
@ -655,7 +655,7 @@ GetOrCreateFolder(const nsACString &aURI, nsIUrlListener *aListener)
|
|||
// get the corresponding RDF resource
|
||||
// RDF will create the folder resource if it doesn't already exist
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(nsCAutoString(aURI).get(), getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(aURI, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> folderResource;
|
||||
|
|
|
@ -3552,10 +3552,10 @@ static nsresult OpenAddressBook(const char * dbUri, nsIAddrDatabase** aDatabase)
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsMsgCompose::GetABDirectories(const char * dirUri, nsISupportsArray* directoriesArray, PRBool searchSubDirectory)
|
||||
nsresult nsMsgCompose::GetABDirectories(const nsACString& dirUri, nsISupportsArray* directoriesArray, PRBool searchSubDirectory)
|
||||
{
|
||||
static PRBool collectedAddressbookFound;
|
||||
if (nsCRT::strcmp(dirUri, kMDBDirectoryRoot) == 0)
|
||||
if (dirUri.Equals(NS_LITERAL_CSTRING(kMDBDirectoryRoot)))
|
||||
collectedAddressbookFound = PR_FALSE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -3621,7 +3621,7 @@ nsresult nsMsgCompose::GetABDirectories(const char * dirUri, nsISupportsArray* d
|
|||
}
|
||||
|
||||
directoriesArray->InsertElementAt(directory, pos);
|
||||
rv = GetABDirectories((const char *)uri, directoriesArray, PR_TRUE);
|
||||
rv = GetABDirectories(uri, directoriesArray, PR_TRUE);
|
||||
}
|
||||
}
|
||||
} while (NS_SUCCEEDED(subDirectories->Next()));
|
||||
|
@ -3791,7 +3791,7 @@ NS_IMETHODIMP nsMsgCompose::CheckAndPopulateRecipients(PRBool populateMailList,
|
|||
if (NS_SUCCEEDED(rv) && addrbookDirArray)
|
||||
{
|
||||
nsString dirPath;
|
||||
GetABDirectories(kAllDirectoryRoot, addrbookDirArray, PR_TRUE);
|
||||
GetABDirectories(NS_LITERAL_CSTRING(kAllDirectoryRoot), addrbookDirArray, PR_TRUE);
|
||||
PRInt32 nbrRecipients;
|
||||
|
||||
PRUint32 nbrAddressbook;
|
||||
|
|
|
@ -118,7 +118,7 @@ private:
|
|||
nsresult _SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *identity, PRBool entityConversionDone);
|
||||
nsresult CreateMessage(const char * originalMsgURI, MSG_ComposeType type, nsIMsgCompFields* compFields);
|
||||
void CleanUpRecipients(nsString& recipients);
|
||||
nsresult GetABDirectories(const char * dirUri, nsISupportsArray* directoriesArray, PRBool searchSubDirectory);
|
||||
nsresult GetABDirectories(const nsACString& dirUri, nsISupportsArray* directoriesArray, PRBool searchSubDirectory);
|
||||
nsresult BuildMailListArray(nsIAddrDatabase* database, nsIAbDirectory* parentDir, nsISupportsArray* array);
|
||||
nsresult GetMailListAddresses(nsString& name, nsISupportsArray* mailListArray, nsISupportsArray** addresses);
|
||||
nsresult TagConvertible(nsIDOMNode *node, PRInt32 *_retval);
|
||||
|
|
|
@ -444,7 +444,7 @@ LocateMessageFolder(nsIMsgIdentity *userIdentity,
|
|||
// get the corresponding RDF resource
|
||||
// RDF will create the folder resource if it doesn't already exist
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(aFolderURI, getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(nsDependentCString(aFolderURI), getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> folderResource;
|
||||
|
|
|
@ -3647,7 +3647,7 @@ PRBool nsMsgComposeAndSend::CanSaveMessagesToFolder(const char *folderURL)
|
|||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(folderURL, getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(nsDependentCString(folderURL), getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv))
|
||||
return PR_FALSE;
|
||||
|
||||
|
@ -4288,7 +4288,7 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
|
|||
if (rdfService)
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rdfService->GetResource(turi, getter_AddRefs(res));
|
||||
rdfService->GetResource(nsDependentCString(turi), getter_AddRefs(res));
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(res);
|
||||
if (folder)
|
||||
folder->GetName(getter_Copies(folderName));
|
||||
|
|
|
@ -88,12 +88,15 @@ nsSmtpDataSource::initGlobalObjects()
|
|||
nsCOMPtr<nsIRDFService> rdf = do_GetService(kRDFServiceCID, &rv);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rdf->GetResource(NC_RDF_CHILD, getter_AddRefs(kNC_Child));
|
||||
rdf->GetResource(NC_RDF_NAME, getter_AddRefs(kNC_Name));
|
||||
rdf->GetResource(NC_RDF_KEY, getter_AddRefs(kNC_Key));
|
||||
rdf->GetResource(NC_RDF_SMTPSERVERS, getter_AddRefs(kNC_SmtpServers));
|
||||
rdf->GetResource(NC_RDF_ISDEFAULT, getter_AddRefs(kNC_IsDefaultServer));
|
||||
rdf->GetResource(NC_RDF_ISSESSIONDEFAULT, getter_AddRefs(kNC_IsSessionDefaultServer));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHILD), getter_AddRefs(kNC_Child));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME), getter_AddRefs(kNC_Name));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_KEY), getter_AddRefs(kNC_Key));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SMTPSERVERS),
|
||||
getter_AddRefs(kNC_SmtpServers));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISDEFAULT),
|
||||
getter_AddRefs(kNC_IsDefaultServer));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISSESSIONDEFAULT),
|
||||
getter_AddRefs(kNC_IsSessionDefaultServer));
|
||||
|
||||
nsAutoString trueStr(NS_LITERAL_STRING("true"));
|
||||
rdf->GetLiteral(trueStr.get(), getter_AddRefs(kTrueLiteral));
|
||||
|
|
|
@ -421,7 +421,7 @@ PRBool nsAbIPCCard::Equals(nsABCOMCardStruct * card, nsStringArray & differingAt
|
|||
differingAttrs.AppendString(NS_LITERAL_STRING(kMailListName));
|
||||
if(card->mailListURI) {
|
||||
nsCAutoString str(card->mailListURI);
|
||||
if (str.Compare(m_MailListURI, PR_TRUE))
|
||||
if (str.Equals(m_MailListURI, nsCaseInsensitiveCStringComparator()))
|
||||
differingAttrs.AppendString(NS_LITERAL_STRING(kMailListDescription));
|
||||
}
|
||||
|
||||
|
@ -582,10 +582,9 @@ NS_IMETHODIMP nsAbIPCCard::Equals(nsIAbCard *card, PRBool *_retval)
|
|||
if (isMailList != m_IsMailList)
|
||||
return NS_OK;
|
||||
|
||||
nsCAutoString tempStr(m_MailListURI);
|
||||
nsXPIDLCString str2;
|
||||
card->GetMailListURI(getter_Copies(str2));
|
||||
if (tempStr.Compare(str2.get(), PR_TRUE))
|
||||
if (m_MailListURI.Equals(str2, nsCaseInsensitiveCStringComparator()))
|
||||
return NS_OK;
|
||||
|
||||
*_retval = PR_TRUE;
|
||||
|
@ -744,10 +743,7 @@ nsresult nsAbIPCCard::GetABCOMCardStruct(PRBool isUnicode, nsABCOMCardStruct * c
|
|||
card->preferMailFormat = m_PreferMailFormat;
|
||||
|
||||
card->isMailList = m_IsMailList;
|
||||
if(m_MailListURI) {
|
||||
card->mailListURI = new char[strlen(m_MailListURI)+1];
|
||||
strcpy(card->mailListURI, m_MailListURI);
|
||||
}
|
||||
card->mailListURI = m_MailListURI;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -1055,7 +1055,7 @@ nsresult nsImapIncomingServer::GetPFCForStringId(PRBool createIfMissing, PRInt32
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(pfcMailUri.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(pfcMailUri, getter_AddRefs(res));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsIMsgFolder> parentToCreate = do_QueryInterface(res, &rv);
|
||||
|
@ -1572,7 +1572,7 @@ nsresult nsImapIncomingServer::GetFolder(const char* name, nsIMsgFolder** pFolde
|
|||
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uriString.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(uriString, getter_AddRefs(res));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
|
||||
|
|
|
@ -341,7 +341,7 @@ NS_IMETHODIMP nsImapMailFolder::AddSubfolderWithPath(nsAutoString *name, nsIFile
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uriStr, getter_AddRefs(res));
|
||||
rv = rdf->GetUnicodeResource(uri, getter_AddRefs(res));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -820,7 +820,7 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
|
|||
uri.Append('/');
|
||||
uri.AppendWithConversion(parentName);
|
||||
|
||||
rv = rdf->GetResource(uri.get(),
|
||||
rv = rdf->GetResource(uri,
|
||||
getter_AddRefs(res));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
parentFolder = do_QueryInterface(res, &rv);
|
||||
|
@ -971,7 +971,7 @@ NS_IMETHODIMP nsImapMailFolder::CreateStorageIfMissing(nsIUrlListener* urlListen
|
|||
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &status));
|
||||
if (NS_FAILED(status)) return status;
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
status = rdf->GetResource(parentName.get(), getter_AddRefs(resource));
|
||||
status = rdf->GetResource(parentName, getter_AddRefs(resource));
|
||||
if (NS_FAILED(status)) return status;
|
||||
|
||||
msgParent = do_QueryInterface(resource, &status);
|
||||
|
@ -3310,7 +3310,7 @@ NS_IMETHODIMP nsImapMailFolder::FetchCustomMsgAttribute(const char *attribute, c
|
|||
|
||||
nsresult nsImapMailFolder::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
nsIMsgDatabase *sourceDB,
|
||||
const char *destFolderUri,
|
||||
const nsACString& destFolderUri,
|
||||
nsIMsgFilter *filter,
|
||||
nsIMsgWindow *msgWindow)
|
||||
{
|
||||
|
|
|
@ -344,7 +344,7 @@ public:
|
|||
|
||||
nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
nsIMsgDatabase *sourceDB,
|
||||
const char *destFolder,
|
||||
const nsACString& destFolder,
|
||||
nsIMsgFilter *filter,
|
||||
nsIMsgWindow *msgWindow);
|
||||
virtual nsresult SpamFilterClassifyMessage(const char *aURI, nsIMsgWindow *aMsgWindow, nsIJunkMailPlugin *aJunkMailPlugin);
|
||||
|
|
|
@ -874,7 +874,7 @@ nsresult nsImapService::DecomposeImapURI(const char * aMessageURI, nsIMsgFolder
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(folderURI.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(folderURI, getter_AddRefs(res));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = res->QueryInterface(NS_GET_IID(nsIMsgFolder), (void **) aFolder);
|
||||
|
|
|
@ -803,7 +803,8 @@ nsIAddrDatabase *GetAddressBook( const PRUnichar *name, PRBool makeNew)
|
|||
NS_WITH_PROXIED_SERVICE(nsIRDFService, rdfService, kRDFServiceCID, NS_UI_THREAD_EVENTQ, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsCOMPtr<nsIRDFResource> parentResource;
|
||||
rv = rdfService->GetResource( kAllDirectoryRoot, getter_AddRefs(parentResource));
|
||||
rv = rdfService->GetResource(NS_LITERAL_CSTRING(kAllDirectoryRoot),
|
||||
getter_AddRefs(parentResource));
|
||||
nsCOMPtr<nsIAbDirectory> parentDir;
|
||||
/*
|
||||
* TODO
|
||||
|
|
|
@ -280,7 +280,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::AddSubfolder(nsAutoString *name,
|
|||
return NS_MSG_FOLDER_EXISTS;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uri.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -773,7 +773,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::CreateStorageIfMissing(nsIUrlListener* aUrlL
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = rdf->GetResource(parentName.get(), getter_AddRefs(resource));
|
||||
rv = rdf->GetResource(parentName, getter_AddRefs(resource));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
msgParent = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -553,7 +553,7 @@ nsMailboxService::DecomposeMailboxURI(const char * aMessageURI, nsIMsgFolder **
|
|||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(folderURI.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(folderURI, getter_AddRefs(res));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = res->QueryInterface(NS_GET_IID(nsIMsgFolder), (void **) aFolder);
|
||||
|
|
|
@ -1679,7 +1679,7 @@ NS_IMETHODIMP nsParseNewMailState::ApplyFilterHit(nsIMsgFilter *filter, nsIMsgWi
|
|||
if ((const char*)actionTargetFolderUri &&
|
||||
nsCRT::strcasecmp(m_inboxUri, actionTargetFolderUri))
|
||||
{
|
||||
nsresult err = MoveIncorporatedMessage(msgHdr, m_mailDB, (const char *) actionTargetFolderUri, filter, msgWindow);
|
||||
nsresult err = MoveIncorporatedMessage(msgHdr, m_mailDB, actionTargetFolderUri, filter, msgWindow);
|
||||
if (NS_SUCCEEDED(err))
|
||||
{
|
||||
if (loggingEnabled)
|
||||
|
@ -1739,7 +1739,7 @@ int nsParseNewMailState::MarkFilteredMessageRead(nsIMsgDBHdr *msgHdr)
|
|||
|
||||
nsresult nsParseNewMailState::MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
nsIMsgDatabase *sourceDB,
|
||||
const char *destFolderUri,
|
||||
const nsACString& destFolderUri,
|
||||
nsIMsgFilter *filter,
|
||||
nsIMsgWindow *msgWindow)
|
||||
{
|
||||
|
|
|
@ -252,7 +252,7 @@ protected:
|
|||
virtual nsresult GetTrashFolder(nsIMsgFolder **pTrashFolder);
|
||||
virtual nsresult MoveIncorporatedMessage(nsIMsgDBHdr *mailHdr,
|
||||
nsIMsgDatabase *sourceDB,
|
||||
const char *destFolder,
|
||||
const nsACString& destFolder,
|
||||
nsIMsgFilter *filter,
|
||||
nsIMsgWindow *msgWindow);
|
||||
virtual int MarkFilteredMessageRead(nsIMsgDBHdr *msgHdr);
|
||||
|
|
|
@ -289,7 +289,7 @@ NS_IMETHODIMP nsPop3Service::NewURI(const nsACString &aSpec,
|
|||
|
||||
nsCOMPtr<nsIRDFService> rdfService(do_GetService(kRDFServiceCID, &rv));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = rdfService->GetResource(folderUri.get(),
|
||||
rv = rdfService->GetResource(folderUri,
|
||||
getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(resource, &rv);
|
||||
|
|
|
@ -225,7 +225,7 @@ nsMsgNewsFolder::AddNewsgroup(const char *name, const char *setStr, nsIMsgFolder
|
|||
uri.Append(escapedName.get());
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
rv = rdf->GetResource(uri.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIMsgFolder> folder(do_QueryInterface(res, &rv));
|
||||
|
|
|
@ -621,10 +621,10 @@ nsNntpService::GetFolderFromUri(const char *uri, nsIMsgFolder **folder)
|
|||
if ((strlen(uri) > kNntpRootURILen) && nsCRT::strncmp(uri, kNntpRootURI, kNntpRootURILen) == 0) {
|
||||
nsCAutoString uriStr(kNewsRootURI);
|
||||
uriStr.Append(uri+kNntpRootURILen);
|
||||
rv = rdf->GetResource(uriStr.get(), getter_AddRefs(res));
|
||||
rv = rdf->GetResource(uriStr, getter_AddRefs(res));
|
||||
}
|
||||
else {
|
||||
rv = rdf->GetResource(uri, getter_AddRefs(res));
|
||||
rv = rdf->GetResource(nsDependentCString(uri), getter_AddRefs(res));
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
|
|
|
@ -49,13 +49,13 @@ interface nsIRDFService : nsISupports {
|
|||
// caches resources that are in-use, so multiple calls to <tt>GetResource()</tt>
|
||||
// for the same <tt>uri</tt> will return identical pointers. FindResource
|
||||
// is used to find out whether there already exists a resource corresponding to that url.
|
||||
nsIRDFResource GetResource(in string aURI);
|
||||
nsIRDFResource GetResource(in AUTF8String aURI);
|
||||
|
||||
// Construct an RDF resource from a Unicode URI. This is provided
|
||||
// as a convenience method, allowing automatic, in-line C++
|
||||
// conversion from <tt>nsString</tt> objects. The <tt>uri</tt> will
|
||||
// be converted to a single-byte representation internally.
|
||||
nsIRDFResource GetUnicodeResource(in wstring aURI);
|
||||
nsIRDFResource GetUnicodeResource(in AString aURI);
|
||||
|
||||
nsIRDFResource GetAnonymousResource();
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ ContainerEnumeratorImpl::Init()
|
|||
if (! rdf)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = rdf->GetResource(RDF_NAMESPACE_URI "nextVal", &kRDF_nextVal);
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"), &kRDF_nextVal);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
|
|
@ -421,7 +421,8 @@ RDFContainerImpl::Init()
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = gRDFService->GetResource(RDF_NAMESPACE_URI "nextVal", &kRDF_nextVal);
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
|
||||
&kRDF_nextVal);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = nsServiceManager::GetService(kRDFContainerUtilsCID,
|
||||
|
@ -739,7 +740,7 @@ RDFContainerImpl::GetNextValue(nsIRDFResource** aResult)
|
|||
nextValStr.Append("_");
|
||||
nextValStr.AppendInt(nextVal, 10);
|
||||
|
||||
rv = gRDFService->GetResource(nextValStr.get(), aResult);
|
||||
rv = gRDFService->GetResource(nextValStr, aResult);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Now increment the RDF:nextVal property.
|
||||
|
|
|
@ -157,18 +157,11 @@ RDFContainerUtilsImpl::IndexToOrdinalResource(PRInt32 aIndex, nsIRDFResource **a
|
|||
if (aIndex <= 0)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
// 16 digits should be plenty to hold a decimal version of a
|
||||
// PRInt32.
|
||||
char buf[sizeof(kRDFNameSpaceURI) + 16 + 1];
|
||||
|
||||
PL_strcpy(buf, kRDFNameSpaceURI);
|
||||
buf[sizeof(kRDFNameSpaceURI) - 1] = '_';
|
||||
nsCAutoString uri(kRDFNameSpaceURI);
|
||||
uri.Append('_');
|
||||
uri.AppendInt(aIndex);
|
||||
|
||||
PR_snprintf(buf + sizeof(kRDFNameSpaceURI), 16, "%ld", aIndex);
|
||||
|
||||
nsresult rv;
|
||||
|
||||
rv = gRDFService->GetResource(buf, aOrdinal);
|
||||
nsresult rv = gRDFService->GetResource(uri, aOrdinal);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get ordinal resource");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -371,11 +364,16 @@ RDFContainerUtilsImpl::RDFContainerUtilsImpl()
|
|||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_instanceOf);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "nextVal", &kRDF_nextVal);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "Bag", &kRDF_Bag);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "Seq", &kRDF_Seq);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "Alt", &kRDF_Alt);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
&kRDF_instanceOf);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
|
||||
&kRDF_nextVal);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Bag"),
|
||||
&kRDF_Bag);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Seq"),
|
||||
&kRDF_Seq);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Alt"),
|
||||
&kRDF_Alt);
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("1").get(), &kOne);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,12 +334,18 @@ RDFContentSinkImpl::RDFContentSinkImpl()
|
|||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
rv = gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_instanceOf);
|
||||
rv = gRDFService->GetResource(RDF_NAMESPACE_URI "Alt", &kRDF_Alt);
|
||||
rv = gRDFService->GetResource(RDF_NAMESPACE_URI "Bag", &kRDF_Bag);
|
||||
rv = gRDFService->GetResource(RDF_NAMESPACE_URI "Seq", &kRDF_Seq);
|
||||
rv = gRDFService->GetResource(RDF_NAMESPACE_URI "nextVal", &kRDF_nextVal);
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
&kRDF_instanceOf);
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Alt"),
|
||||
&kRDF_Alt);
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Bag"),
|
||||
&kRDF_Bag);
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Seq"),
|
||||
&kRDF_Seq);
|
||||
rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
|
||||
&kRDF_nextVal);
|
||||
}
|
||||
|
||||
|
||||
|
@ -764,7 +770,7 @@ RDFContentSinkImpl::ParseText(nsIRDFNode **aResult)
|
|||
case eRDFContentSinkParseMode_Resource:
|
||||
{
|
||||
nsIRDFResource *result;
|
||||
gRDFService->GetUnicodeResource(value.get(), &result);
|
||||
gRDFService->GetUnicodeResource(value, &result);
|
||||
*aResult = result;
|
||||
}
|
||||
break;
|
||||
|
@ -958,7 +964,7 @@ RDFContentSinkImpl::GetIdAboutAttribute(const PRUnichar** aAttributes,
|
|||
|
||||
rdf_MakeAbsoluteURI(NS_ConvertUTF8toUCS2(docURI), uri);
|
||||
|
||||
return gRDFService->GetUnicodeResource(uri.get(), aResource);
|
||||
return gRDFService->GetUnicodeResource(uri, aResource);
|
||||
}
|
||||
else if (attr.get() == kIdAtom) {
|
||||
if (aIsAnonymous)
|
||||
|
@ -979,7 +985,7 @@ RDFContentSinkImpl::GetIdAboutAttribute(const PRUnichar** aAttributes,
|
|||
|
||||
rdf_MakeAbsoluteURI(NS_ConvertUTF8toUCS2(docURI), name);
|
||||
|
||||
return gRDFService->GetUnicodeResource(name.get(), aResource);
|
||||
return gRDFService->GetUnicodeResource(name, aResource);
|
||||
}
|
||||
else if (attr.get() == kAboutEachAtom) {
|
||||
// XXX we don't deal with aboutEach...
|
||||
|
@ -1033,7 +1039,7 @@ RDFContentSinkImpl::GetResourceAttribute(const PRUnichar** aAttributes,
|
|||
mDocumentURL->GetSpec(documentURL);
|
||||
rdf_MakeAbsoluteURI(NS_ConvertUTF8toUCS2(documentURL), uri);
|
||||
|
||||
return gRDFService->GetUnicodeResource(uri.get(), aResource);
|
||||
return gRDFService->GetUnicodeResource(uri, aResource);
|
||||
}
|
||||
}
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -1096,7 +1102,7 @@ RDFContentSinkImpl::AddProperties(const PRUnichar** aAttributes,
|
|||
|
||||
// Add the assertion to RDF
|
||||
nsCOMPtr<nsIRDFResource> property;
|
||||
gRDFService->GetResource(propertyStr.get(), getter_AddRefs(property));
|
||||
gRDFService->GetResource(propertyStr, getter_AddRefs(property));
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> target;
|
||||
gRDFService->GetLiteral(v.get(), getter_AddRefs(target));
|
||||
|
@ -1238,7 +1244,7 @@ RDFContentSinkImpl::OpenObject(const PRUnichar* aName,
|
|||
typeStr += NS_ConvertUCS2toUTF8(attrName);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> type;
|
||||
rv = gRDFService->GetResource(typeStr.get(), getter_AddRefs(type));
|
||||
rv = gRDFService->GetResource(typeStr, getter_AddRefs(type));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = mDataSource->Assert(source, kRDF_type, type, PR_TRUE);
|
||||
|
@ -1277,7 +1283,7 @@ RDFContentSinkImpl::OpenProperty(const PRUnichar* aName, const PRUnichar** aAttr
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> property;
|
||||
rv = gRDFService->GetResource(propertyStr.get(), getter_AddRefs(property));
|
||||
rv = gRDFService->GetResource(propertyStr, getter_AddRefs(property));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// See if they've specified a 'resource' attribute, in which case
|
||||
|
|
|
@ -105,8 +105,7 @@ protected:
|
|||
PLDHashTable mDates;
|
||||
PLDHashTable mBlobs;
|
||||
|
||||
char mLastURIPrefix[16];
|
||||
PRInt32 mLastPrefixlen;
|
||||
nsCAutoString mLastURIPrefix;
|
||||
nsCOMPtr<nsIFactory> mLastFactory;
|
||||
nsCOMPtr<nsIFactory> mDefaultResourceFactory;
|
||||
|
||||
|
@ -859,8 +858,7 @@ IntImpl::EqualsInt(nsIRDFInt* intValue, PRBool* result)
|
|||
// RDFServiceImpl
|
||||
|
||||
RDFServiceImpl::RDFServiceImpl()
|
||||
: mNamedDataSources(nsnull),
|
||||
mLastPrefixlen(0)
|
||||
: mNamedDataSources(nsnull)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -983,23 +981,20 @@ IsLegalSchemeCharacter(const char aChar)
|
|||
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
|
||||
RDFServiceImpl::GetResource(const nsACString& aURI, nsIRDFResource** aResource)
|
||||
{
|
||||
// Sanity checks
|
||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||
if (! aURI)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
NS_PRECONDITION(aResource != nsnull, "null ptr");
|
||||
if (! aResource)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
PR_LOG(gLog, PR_LOG_DEBUG, ("rdfserv get-resource %s", aURI));
|
||||
const nsAFlatCString& flatURI = PromiseFlatCString(aURI);
|
||||
PR_LOG(gLog, PR_LOG_DEBUG, ("rdfserv get-resource %s", flatURI.get()));
|
||||
|
||||
// First, check the cache to see if we've already created and
|
||||
// registered this thing.
|
||||
PLDHashEntryHdr *hdr =
|
||||
PL_DHashTableOperate(&mResources, aURI, PL_DHASH_LOOKUP);
|
||||
PL_DHashTableOperate(&mResources, flatURI.get(), PL_DHASH_LOOKUP);
|
||||
|
||||
if (PL_DHASH_ENTRY_IS_BUSY(hdr)) {
|
||||
ResourceHashEntry *entry = NS_STATIC_CAST(ResourceHashEntry *, hdr);
|
||||
|
@ -1020,50 +1015,32 @@ RDFServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
|
|||
//
|
||||
// XXX Although it's really not correct, we'll allow underscore
|
||||
// characters ('_'), too.
|
||||
const char* p = aURI;
|
||||
while (IsLegalSchemeCharacter(*p))
|
||||
nsACString::const_iterator p, end;
|
||||
aURI.BeginReading(p);
|
||||
aURI.EndReading(end);
|
||||
while (IsLegalSchemeCharacter(*p) && p != end)
|
||||
++p;
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIFactory> factory;
|
||||
PRUint32 prefixlen = 0;
|
||||
|
||||
nsACString::const_iterator begin;
|
||||
aURI.BeginReading(begin);
|
||||
if (*p == ':') {
|
||||
// There _was_ a scheme. First see if it's the same scheme
|
||||
// that we just tried to use...
|
||||
prefixlen = (p - aURI);
|
||||
|
||||
if ((mLastFactory) && ((PRInt32)prefixlen == mLastPrefixlen) &&
|
||||
(aURI[0] == mLastURIPrefix[0]) &&
|
||||
(0 == PL_strncmp(aURI, mLastURIPrefix, prefixlen))) {
|
||||
if (mLastFactory && mLastURIPrefix.Equals(Substring(begin, p)))
|
||||
factory = mLastFactory;
|
||||
}
|
||||
else {
|
||||
// Try to find a factory using the component manager.
|
||||
static const char kRDFResourceFactoryContractIDPrefix[]
|
||||
= NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX;
|
||||
|
||||
PRInt32 pos = p - aURI;
|
||||
PRInt32 len = pos + sizeof(kRDFResourceFactoryContractIDPrefix) - 1;
|
||||
|
||||
// Safely convert to a C-string for the XPCOM APIs
|
||||
char buf[128];
|
||||
char* contractID = buf;
|
||||
if (len >= PRInt32(sizeof buf))
|
||||
contractID = (char *)nsMemory::Alloc(len + 1);
|
||||
|
||||
if (contractID == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
PL_strcpy(contractID, kRDFResourceFactoryContractIDPrefix);
|
||||
PL_strncpy(contractID + sizeof(kRDFResourceFactoryContractIDPrefix) - 1, aURI, pos);
|
||||
contractID[len] = '\0';
|
||||
nsACString::const_iterator begin;
|
||||
aURI.BeginReading(begin);
|
||||
nsCAutoString contractID;
|
||||
contractID = NS_LITERAL_CSTRING(NS_RDF_RESOURCE_FACTORY_CONTRACTID_PREFIX) +
|
||||
Substring(begin, p);
|
||||
|
||||
nsCID cid;
|
||||
rv = nsComponentManager::ContractIDToClassID(contractID, &cid);
|
||||
|
||||
if (contractID != buf)
|
||||
nsCRT::free(contractID);
|
||||
rv = nsComponentManager::ContractIDToClassID(contractID.get(), &cid);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = nsComponentManager::FindFactory(cid, getter_AddRefs(factory));
|
||||
|
@ -1071,10 +1048,9 @@ RDFServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Store the factory in our one-element cache.
|
||||
if ((prefixlen > 0) && (prefixlen < sizeof(mLastURIPrefix))) {
|
||||
if (p != begin) {
|
||||
mLastFactory = factory;
|
||||
PL_strncpyz(mLastURIPrefix, aURI, prefixlen + 1);
|
||||
mLastPrefixlen = prefixlen;
|
||||
mLastURIPrefix = Substring(begin, p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1088,10 +1064,9 @@ RDFServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
|
|||
factory = mDefaultResourceFactory;
|
||||
|
||||
// Store the factory in our one-element cache.
|
||||
if ((prefixlen > 0) && (prefixlen < sizeof(mLastURIPrefix))) {
|
||||
if (p != begin) {
|
||||
mLastFactory = factory;
|
||||
PL_strncpyz(mLastURIPrefix, aURI, prefixlen + 1);
|
||||
mLastPrefixlen = prefixlen;
|
||||
mLastURIPrefix = Substring(begin, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1101,7 +1076,7 @@ RDFServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
|
|||
|
||||
// Now initialize it with it's URI. At this point, the resource
|
||||
// implementation should register itself with the RDF service.
|
||||
rv = result->Init(aURI);
|
||||
rv = result->Init(flatURI.get());
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("unable to initialize resource");
|
||||
NS_RELEASE(result);
|
||||
|
@ -1113,13 +1088,9 @@ RDFServiceImpl::GetResource(const char* aURI, nsIRDFResource** aResource)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFServiceImpl::GetUnicodeResource(const PRUnichar* aURI, nsIRDFResource** aResource)
|
||||
RDFServiceImpl::GetUnicodeResource(const nsAString& aURI, nsIRDFResource** aResource)
|
||||
{
|
||||
NS_PRECONDITION(aURI != nsnull, "null ptr");
|
||||
if (! aURI)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
return GetResource(NS_ConvertUCS2toUTF8(aURI).get(), aResource);
|
||||
return GetResource(NS_ConvertUCS2toUTF8(aURI), aResource);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1166,7 +1137,7 @@ static PRInt32 kShift = 6;
|
|||
}
|
||||
|
||||
nsIRDFResource* resource;
|
||||
rv = GetResource(s.get(), &resource);
|
||||
rv = GetResource(s, &resource);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// XXX an ugly but effective way to make sure that this
|
||||
|
|
|
@ -60,22 +60,28 @@ nsRDFXMLSerializer::Create(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
|||
nsCOMPtr<nsIRDFService> rdf = do_GetService("@mozilla.org/rdf/rdf-service;1", &rv);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
rv = rdf->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_instanceOf);
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
&kRDF_instanceOf);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
rv = rdf->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
rv = rdf->GetResource(RDF_NAMESPACE_URI "nextVal", &kRDF_nextVal);
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
|
||||
&kRDF_nextVal);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
rv = rdf->GetResource(RDF_NAMESPACE_URI "Bag", &kRDF_Bag);
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Bag"),
|
||||
&kRDF_Bag);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
rv = rdf->GetResource(RDF_NAMESPACE_URI "Seq", &kRDF_Seq);
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Seq"),
|
||||
&kRDF_Seq);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
rv = rdf->GetResource(RDF_NAMESPACE_URI "Alt", &kRDF_Alt);
|
||||
rv = rdf->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "Alt"),
|
||||
&kRDF_Alt);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
rv = nsServiceManager::GetService("@mozilla.org/rdf/container-utils;1",
|
||||
|
|
|
@ -326,49 +326,64 @@ nsChromeRegistry::Init()
|
|||
(nsISupports**)&mRDFContainerUtils);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_selectedSkin, getter_AddRefs(mSelectedSkin));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_selectedSkin),
|
||||
getter_AddRefs(mSelectedSkin));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_selectedLocale, getter_AddRefs(mSelectedLocale));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_selectedLocale),
|
||||
getter_AddRefs(mSelectedLocale));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_baseURL, getter_AddRefs(mBaseURL));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_baseURL),
|
||||
getter_AddRefs(mBaseURL));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_packages, getter_AddRefs(mPackages));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_packages),
|
||||
getter_AddRefs(mPackages));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_package, getter_AddRefs(mPackage));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_package),
|
||||
getter_AddRefs(mPackage));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_name, getter_AddRefs(mName));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_name),
|
||||
getter_AddRefs(mName));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_image, getter_AddRefs(mImage));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_image),
|
||||
getter_AddRefs(mImage));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_locType, getter_AddRefs(mLocType));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_locType),
|
||||
getter_AddRefs(mLocType));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_allowScripts, getter_AddRefs(mAllowScripts));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_allowScripts),
|
||||
getter_AddRefs(mAllowScripts));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_hasOverlays, getter_AddRefs(mHasOverlays));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_hasOverlays),
|
||||
getter_AddRefs(mHasOverlays));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_hasStylesheets, getter_AddRefs(mHasStylesheets));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_hasStylesheets),
|
||||
getter_AddRefs(mHasStylesheets));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_skinVersion, getter_AddRefs(mSkinVersion));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_skinVersion),
|
||||
getter_AddRefs(mSkinVersion));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_localeVersion, getter_AddRefs(mLocaleVersion));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_localeVersion),
|
||||
getter_AddRefs(mLocaleVersion));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_packageVersion, getter_AddRefs(mPackageVersion));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_packageVersion),
|
||||
getter_AddRefs(mPackageVersion));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
rv = mRDFService->GetResource(kURICHROME_disabled, getter_AddRefs(mDisabled));
|
||||
rv = mRDFService->GetResource(nsDependentCString(kURICHROME_disabled),
|
||||
getter_AddRefs(mDisabled));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF resource");
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
|
@ -1251,11 +1266,11 @@ nsChromeRegistry::LoadDataSource(const nsACString &aFileName,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
nsChromeRegistry::GetResource(const nsCString& aURL,
|
||||
nsChromeRegistry::GetResource(const nsACString& aURL,
|
||||
nsIRDFResource** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (NS_FAILED(rv = mRDFService->GetResource(aURL.get(), aResult))) {
|
||||
if (NS_FAILED(rv = mRDFService->GetResource(aURL, aResult))) {
|
||||
NS_ERROR("Unable to retrieve a resource for this URL.");
|
||||
*aResult = nsnull;
|
||||
return rv;
|
||||
|
|
|
@ -93,7 +93,7 @@ protected:
|
|||
nsresult GetDynamicDataSource(nsIURI *aChromeURL, PRBool aIsOverlay, PRBool aUseProfile, PRBool aCreateDS, nsIRDFDataSource **aResult);
|
||||
nsresult GetDynamicInfo(nsIURI *aChromeURL, PRBool aIsOverlay, nsISimpleEnumerator **aResult);
|
||||
|
||||
nsresult GetResource(const nsCString& aChromeType, nsIRDFResource** aResult);
|
||||
nsresult GetResource(const nsACString& aChromeType, nsIRDFResource** aResult);
|
||||
|
||||
nsresult UpdateDynamicDataSource(nsIRDFDataSource *aDataSource,
|
||||
nsIRDFResource *aResource,
|
||||
|
|
|
@ -98,7 +98,6 @@ static NS_DEFINE_CID(kCharsetConverterManagerCID, NS_ICHARSETCONVERTERMANAGER_C
|
|||
|
||||
#define NS_MOZICON_SCHEME "moz-icon:"
|
||||
|
||||
static const char kURINC_FileSystemRoot[] = "NC:FilesRoot";
|
||||
static const char kFileProtocol[] = "file://";
|
||||
|
||||
|
||||
|
@ -294,8 +293,10 @@ FileSystemDataSource::FileSystemDataSource(void)
|
|||
{
|
||||
ieFavoritesDir = nsCRT::strdup(ieFavoritesURI);
|
||||
}
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "IEFavorite", &kNC_IEFavoriteObject);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "IEFavoriteFolder", &kNC_IEFavoriteFolder);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavorite"),
|
||||
&kNC_IEFavoriteObject);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavoriteFolder"),
|
||||
&kNC_IEFavoriteFolder);
|
||||
#endif
|
||||
|
||||
#ifdef XP_BEOS
|
||||
|
@ -310,22 +311,35 @@ FileSystemDataSource::FileSystemDataSource(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
gRDFService->GetResource(kURINC_FileSystemRoot, &kNC_FileSystemRoot);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "child", &kNC_Child);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name", &kNC_Name);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Icon", &kNC_Icon);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Content-Length", &kNC_Length);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "IsDirectory", &kNC_IsDirectory);
|
||||
gRDFService->GetResource(WEB_NAMESPACE_URI "LastModifiedDate", &kWEB_LastMod);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "FileSystemObject", &kNC_FileSystemObject);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "pulse", &kNC_pulse);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING("NC:FilesRoot"),
|
||||
&kNC_FileSystemRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
&kNC_Child);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
&kNC_Name);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
&kNC_URL);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Icon"),
|
||||
&kNC_Icon);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Content-Length"),
|
||||
&kNC_Length);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IsDirectory"),
|
||||
&kNC_IsDirectory);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastModifiedDate"),
|
||||
&kWEB_LastMod);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "FileSystemObject"),
|
||||
&kNC_FileSystemObject);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "pulse"),
|
||||
&kNC_pulse);
|
||||
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_InstanceOf);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
&kRDF_InstanceOf);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
|
||||
#ifdef USE_NC_EXTENSION
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "extension", &kNC_extension);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "extension"),
|
||||
&kNC_extension);
|
||||
#endif
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("true").get(), &kLiteralTrue);
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("false").get(), &kLiteralFalse);
|
||||
|
@ -1141,7 +1155,7 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult)
|
|||
#endif
|
||||
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
gRDFService->GetResource("file:///", getter_AddRefs(vol));
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING("file:///"), getter_AddRefs(vol));
|
||||
volumes->AppendElement(vol);
|
||||
#endif
|
||||
|
||||
|
@ -1307,13 +1321,8 @@ FileSystemDataSource::GetFolderList(nsIRDFResource *source, PRBool allowHidden,
|
|||
continue;
|
||||
}
|
||||
|
||||
// XXX We should use nsIFile::GetUnicodeLeafName().
|
||||
// But currently mozilla's xpcom/io is not unicode normalization.
|
||||
// And URI cannot use UTF-8 (On RFC2396, URI should use UTF-8)
|
||||
// So, we uses nsIFile::GetNativeLeafName() for performance...
|
||||
|
||||
nsCAutoString leafStr;
|
||||
if (NS_FAILED(rv = aFile->GetNativeLeafName(leafStr)))
|
||||
nsAutoString leafStr;
|
||||
if (NS_FAILED(rv = aFile->GetLeafName(leafStr)))
|
||||
break;
|
||||
if (leafStr.IsEmpty())
|
||||
continue;
|
||||
|
@ -1325,7 +1334,7 @@ FileSystemDataSource::GetFolderList(nsIRDFResource *source, PRBool allowHidden,
|
|||
fullURI.Append('/');
|
||||
}
|
||||
|
||||
char *escLeafStr = nsEscape(leafStr.get(), url_Path);
|
||||
char *escLeafStr = nsEscape(NS_ConvertUCS2toUTF8(leafStr).get(), url_Path);
|
||||
leafStr.Truncate();
|
||||
|
||||
if (!escLeafStr)
|
||||
|
@ -1354,7 +1363,7 @@ FileSystemDataSource::GetFolderList(nsIRDFResource *source, PRBool allowHidden,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> fileRes;
|
||||
gRDFService->GetResource(fullURI.get(), getter_AddRefs(fileRes));
|
||||
gRDFService->GetResource(fullURI, getter_AddRefs(fileRes));
|
||||
|
||||
nameArray->AppendElement(fileRes);
|
||||
|
||||
|
|
|
@ -234,15 +234,24 @@ nsresult nsExternalHelperAppService::InitDataSource()
|
|||
// initialize our resources if we haven't done so already...
|
||||
if (!kNC_Description)
|
||||
{
|
||||
rdf->GetResource(NC_RDF_DESCRIPTION, getter_AddRefs(kNC_Description));
|
||||
rdf->GetResource(NC_RDF_VALUE, getter_AddRefs(kNC_Value));
|
||||
rdf->GetResource(NC_RDF_FILEEXTENSIONS,getter_AddRefs(kNC_FileExtensions));
|
||||
rdf->GetResource(NC_RDF_PATH, getter_AddRefs(kNC_Path));
|
||||
rdf->GetResource(NC_RDF_SAVETODISK, getter_AddRefs(kNC_SaveToDisk));
|
||||
rdf->GetResource(NC_RDF_USESYSTEMDEFAULT,getter_AddRefs(kNC_UseSystemDefault));
|
||||
rdf->GetResource(NC_RDF_HANDLEINTERNAL,getter_AddRefs(kNC_HandleInternal));
|
||||
rdf->GetResource(NC_RDF_ALWAYSASK, getter_AddRefs(kNC_AlwaysAsk));
|
||||
rdf->GetResource(NC_RDF_PRETTYNAME, getter_AddRefs(kNC_PrettyName));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_DESCRIPTION),
|
||||
getter_AddRefs(kNC_Description));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_VALUE),
|
||||
getter_AddRefs(kNC_Value));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_FILEEXTENSIONS),
|
||||
getter_AddRefs(kNC_FileExtensions));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_PATH),
|
||||
getter_AddRefs(kNC_Path));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_SAVETODISK),
|
||||
getter_AddRefs(kNC_SaveToDisk));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_USESYSTEMDEFAULT),
|
||||
getter_AddRefs(kNC_UseSystemDefault));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_HANDLEINTERNAL),
|
||||
getter_AddRefs(kNC_HandleInternal));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_ALWAYSASK),
|
||||
getter_AddRefs(kNC_AlwaysAsk));
|
||||
rdf->GetResource(NS_LITERAL_CSTRING(NC_RDF_PRETTYNAME),
|
||||
getter_AddRefs(kNC_PrettyName));
|
||||
}
|
||||
|
||||
mDataSourceInitialized = PR_TRUE;
|
||||
|
@ -527,7 +536,7 @@ nsresult nsExternalHelperAppService::FillContentHandlerProperties(const char * a
|
|||
contentTypeHandlerNodeName.Append(aContentType);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> contentTypeHandlerNodeResource;
|
||||
aRDFService->GetResource(contentTypeHandlerNodeName.get(), getter_AddRefs(contentTypeHandlerNodeResource));
|
||||
aRDFService->GetResource(contentTypeHandlerNodeName, getter_AddRefs(contentTypeHandlerNodeResource));
|
||||
NS_ENSURE_TRUE(contentTypeHandlerNodeResource, NS_ERROR_FAILURE); // that's not good! we have an error in the rdf file
|
||||
|
||||
// now process the application handler information
|
||||
|
@ -562,7 +571,7 @@ nsresult nsExternalHelperAppService::FillContentHandlerProperties(const char * a
|
|||
nsCAutoString externalAppNodeName (NC_CONTENT_NODE_EXTERNALAPP_PREFIX);
|
||||
externalAppNodeName.Append(aContentType);
|
||||
nsCOMPtr<nsIRDFResource> externalAppNodeResource;
|
||||
aRDFService->GetResource(externalAppNodeName.get(), getter_AddRefs(externalAppNodeResource));
|
||||
aRDFService->GetResource(externalAppNodeName, getter_AddRefs(externalAppNodeResource));
|
||||
|
||||
if (externalAppNodeResource)
|
||||
{
|
||||
|
@ -602,7 +611,7 @@ PRBool nsExternalHelperAppService::MIMETypeIsInDataSource(const char * aContentT
|
|||
|
||||
// Get the mime type resource.
|
||||
nsCOMPtr<nsIRDFResource> contentTypeNodeResource;
|
||||
rv = rdf->GetResource(contentTypeNodeName.get(), getter_AddRefs(contentTypeNodeResource));
|
||||
rv = rdf->GetResource(contentTypeNodeName, getter_AddRefs(contentTypeNodeResource));
|
||||
if (NS_FAILED(rv)) return PR_FALSE;
|
||||
|
||||
// Test that there's a #value arc from the mimetype resource to the mimetype literal string.
|
||||
|
@ -644,7 +653,7 @@ nsresult nsExternalHelperAppService::GetMIMEInfoForMimeTypeFromDS(const char * a
|
|||
|
||||
// Get the mime type resource.
|
||||
nsCOMPtr<nsIRDFResource> contentTypeNodeResource;
|
||||
rv = rdf->GetResource(contentTypeNodeName.get(), getter_AddRefs(contentTypeNodeResource));
|
||||
rv = rdf->GetResource(contentTypeNodeName, getter_AddRefs(contentTypeNodeResource));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// we need a way to determine if this content type resource is really in the graph or not...
|
||||
|
|
|
@ -194,56 +194,98 @@ bm_AddRefGlobals()
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get charset alias service");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
gRDF->GetResource(kURINC_BookmarksRoot, &kNC_BookmarksRoot);
|
||||
gRDF->GetResource(kURINC_IEFavoritesRoot, &kNC_IEFavoritesRoot);
|
||||
gRDF->GetResource(kURINC_SystemBookmarksStaticRoot, &kNC_SystemBookmarksStaticRoot);
|
||||
gRDF->GetResource(kURINC_NewBookmarkFolder, &kNC_NewBookmarkFolder);
|
||||
gRDF->GetResource(kURINC_PersonalToolbarFolder, &kNC_PersonalToolbarFolder);
|
||||
gRDF->GetResource(kURINC_NewSearchFolder, &kNC_NewSearchFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(kURINC_BookmarksRoot),
|
||||
&kNC_BookmarksRoot);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(kURINC_IEFavoritesRoot),
|
||||
&kNC_IEFavoritesRoot);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(kURINC_SystemBookmarksStaticRoot),
|
||||
&kNC_SystemBookmarksStaticRoot);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(kURINC_NewBookmarkFolder),
|
||||
&kNC_NewBookmarkFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(kURINC_PersonalToolbarFolder),
|
||||
&kNC_PersonalToolbarFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(kURINC_NewSearchFolder),
|
||||
&kNC_NewSearchFolder);
|
||||
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "Bookmark", &kNC_Bookmark);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "BookmarkSeparator", &kNC_BookmarkSeparator);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "BookmarkAddDate", &kNC_BookmarkAddDate);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "Description", &kNC_Description);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "Folder", &kNC_Folder);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "FolderType", &kNC_FolderType);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "FolderGroup", &kNC_FolderGroup);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "IEFavorite", &kNC_IEFavorite);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "IEFavoriteFolder", &kNC_IEFavoriteFolder);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "Name", &kNC_Name);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "Icon", &kNC_Icon);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "ShortcutURL", &kNC_ShortcutURL);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
|
||||
gRDF->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
gRDF->GetResource(RDF_NAMESPACE_URI "nextVal", &kRDF_nextVal);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Bookmark"),
|
||||
&kNC_Bookmark);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "BookmarkSeparator"),
|
||||
&kNC_BookmarkSeparator);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "BookmarkAddDate"),
|
||||
&kNC_BookmarkAddDate);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Description"),
|
||||
&kNC_Description);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Folder"),
|
||||
&kNC_Folder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "FolderType"),
|
||||
&kNC_FolderType);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "FolderGroup"),
|
||||
&kNC_FolderGroup);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavorite"),
|
||||
&kNC_IEFavorite);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IEFavoriteFolder"),
|
||||
&kNC_IEFavoriteFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
&kNC_Name);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Icon"),
|
||||
&kNC_Icon);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "ShortcutURL"),
|
||||
&kNC_ShortcutURL);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
&kNC_URL);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "nextVal"),
|
||||
&kRDF_nextVal);
|
||||
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "LastModifiedDate", &kWEB_LastModifiedDate);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "LastVisitDate", &kWEB_LastVisitDate);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "LastCharset", &kWEB_LastCharset);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastModifiedDate"),
|
||||
&kWEB_LastModifiedDate);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastVisitDate"),
|
||||
&kWEB_LastVisitDate);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastCharset"),
|
||||
&kWEB_LastCharset);
|
||||
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "Schedule", &kWEB_Schedule);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "ScheduleFlag", &kWEB_ScheduleActive);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "status", &kWEB_Status);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "LastPingDate", &kWEB_LastPingDate);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "LastPingETag", &kWEB_LastPingETag);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "LastPingModDate", &kWEB_LastPingModDate);
|
||||
gRDF->GetResource(WEB_NAMESPACE_URI "LastPingContentLen", &kWEB_LastPingContentLen);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "Schedule"),
|
||||
&kWEB_Schedule);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "ScheduleFlag"),
|
||||
&kWEB_ScheduleActive);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "status"),
|
||||
&kWEB_Status);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastPingDate"),
|
||||
&kWEB_LastPingDate);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastPingETag"),
|
||||
&kWEB_LastPingETag);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastPingModDate"),
|
||||
&kWEB_LastPingModDate);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastPingContentLen"),
|
||||
&kWEB_LastPingContentLen);
|
||||
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "parent", &kNC_Parent);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "parent"), &kNC_Parent);
|
||||
|
||||
gRDF->GetLiteral(NS_LITERAL_STRING("true").get(), &kTrueLiteral);
|
||||
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=newbookmark", &kNC_BookmarkCommand_NewBookmark);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=newfolder", &kNC_BookmarkCommand_NewFolder);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=newseparator", &kNC_BookmarkCommand_NewSeparator);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=deletebookmark", &kNC_BookmarkCommand_DeleteBookmark);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=deletebookmarkfolder", &kNC_BookmarkCommand_DeleteBookmarkFolder);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=deletebookmarkseparator", &kNC_BookmarkCommand_DeleteBookmarkSeparator);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=setnewbookmarkfolder", &kNC_BookmarkCommand_SetNewBookmarkFolder);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=setpersonaltoolbarfolder",&kNC_BookmarkCommand_SetPersonalToolbarFolder);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=setnewsearchfolder", &kNC_BookmarkCommand_SetNewSearchFolder);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=import", &kNC_BookmarkCommand_Import);
|
||||
gRDF->GetResource(NC_NAMESPACE_URI "command?cmd=export", &kNC_BookmarkCommand_Export);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=newbookmark"),
|
||||
&kNC_BookmarkCommand_NewBookmark);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=newfolder"),
|
||||
&kNC_BookmarkCommand_NewFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=newseparator"),
|
||||
&kNC_BookmarkCommand_NewSeparator);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=deletebookmark"),
|
||||
&kNC_BookmarkCommand_DeleteBookmark);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=deletebookmarkfolder"),
|
||||
&kNC_BookmarkCommand_DeleteBookmarkFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=deletebookmarkseparator"),
|
||||
&kNC_BookmarkCommand_DeleteBookmarkSeparator);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=setnewbookmarkfolder"),
|
||||
&kNC_BookmarkCommand_SetNewBookmarkFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=setpersonaltoolbarfolder"),
|
||||
&kNC_BookmarkCommand_SetPersonalToolbarFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=setnewsearchfolder"),
|
||||
&kNC_BookmarkCommand_SetNewSearchFolder);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=import"),
|
||||
&kNC_BookmarkCommand_Import);
|
||||
gRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=export"),
|
||||
&kNC_BookmarkCommand_Export);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -580,13 +622,13 @@ BookmarkParser::Init(nsFileSpec *fileSpec, nsIRDFDataSource *aDataSource,
|
|||
for (field = gBookmarkFieldTable; field->mName; ++field)
|
||||
{
|
||||
str = field->mPropertyName;
|
||||
rv = gRDF->GetResource(str.get(), &field->mProperty);
|
||||
rv = gRDF->GetResource(str, &field->mProperty);
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
}
|
||||
for (field = gBookmarkHeaderFieldTable; field->mName; ++field)
|
||||
{
|
||||
str = field->mPropertyName;
|
||||
rv = gRDF->GetResource(str.get(), &field->mProperty);
|
||||
rv = gRDF->GetResource(str, &field->mProperty);
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
}
|
||||
|
||||
|
@ -964,7 +1006,7 @@ BookmarkParser::CreateAnonymousResource(nsIRDFResource** aResult)
|
|||
nsCAutoString uri(URINC_BOOKMARKS_ROOT_STRING "#$"); // let the compiler concat literals
|
||||
uri.AppendInt(++gNext, 16);
|
||||
|
||||
return gRDF->GetResource(uri.get(), aResult);
|
||||
return gRDF->GetResource(uri, aResult);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1336,7 +1378,7 @@ BookmarkParser::ParseResource(nsIRDFResource *arc, nsString& url, nsIRDFNode** a
|
|||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFResource> result;
|
||||
rv = gRDF->GetUnicodeResource(url.get(), getter_AddRefs(result));
|
||||
rv = gRDF->GetUnicodeResource(url, getter_AddRefs(result));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return result->QueryInterface(NS_GET_IID(nsIRDFNode), (void**) aResult);
|
||||
}
|
||||
|
@ -1471,7 +1513,7 @@ BookmarkParser::AddBookmark(nsCOMPtr<nsIRDFContainer> aContainer,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
if (NS_FAILED(rv = gRDF->GetResource(fullurlC.get(), getter_AddRefs(bookmark) )))
|
||||
if (NS_FAILED(rv = gRDF->GetResource(fullurlC, getter_AddRefs(bookmark) )))
|
||||
{
|
||||
NS_ERROR("unable to get bookmark resource");
|
||||
return(rv);
|
||||
|
@ -2712,7 +2754,7 @@ nsBookmarksService::CreateBookmark(const PRUnichar* aName, const char* aURL,
|
|||
|
||||
// Resource: Bookmark ID
|
||||
nsCOMPtr<nsIRDFResource> bookmarkResource;
|
||||
rv = gRDF->GetResource(aURL, getter_AddRefs(bookmarkResource));
|
||||
rv = gRDF->GetResource(nsDependentCString(aURL), getter_AddRefs(bookmarkResource));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -2892,7 +2934,7 @@ nsBookmarksService::IsBookmarked(const char *aURI, PRBool *isBookmarkedFlag)
|
|||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
if (NS_FAILED(rv = gRDF->GetResource(aURI, getter_AddRefs(bookmark))))
|
||||
if (NS_FAILED(rv = gRDF->GetResource(nsDependentCString(aURI), getter_AddRefs(bookmark))))
|
||||
return(rv);
|
||||
|
||||
rv = IsBookmarkedInternal(bookmark, isBookmarkedFlag);
|
||||
|
@ -2911,7 +2953,7 @@ nsBookmarksService::GetLastCharset(const char *aURI, PRUnichar **aLastCharset)
|
|||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
nsresult rv = nsnull;
|
||||
|
||||
if (NS_SUCCEEDED(rv = gRDF->GetResource(aURI, getter_AddRefs(bookmark) )))
|
||||
if (NS_SUCCEEDED(rv = gRDF->GetResource(nsDependentCString(aURI), getter_AddRefs(bookmark) )))
|
||||
{
|
||||
// Note: always use mInner!! Otherwise, could get into an infinite loop
|
||||
// due to Assert/Change calling UpdateBookmarkLastModifiedDate()
|
||||
|
@ -2947,7 +2989,7 @@ nsBookmarksService::UpdateBookmarkIcon(const char *aURL, const PRUnichar *iconUR
|
|||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
if (NS_FAILED(rv = gRDF->GetResource(aURL, getter_AddRefs(bookmark) )))
|
||||
if (NS_FAILED(rv = gRDF->GetResource(nsDependentCString(aURL), getter_AddRefs(bookmark) )))
|
||||
{
|
||||
NS_ERROR("unable to get bookmark resource");
|
||||
return(rv);
|
||||
|
@ -2972,7 +3014,7 @@ nsBookmarksService::RemoveBookmarkIcon(const char *aURL, const PRUnichar *iconUR
|
|||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
if (NS_FAILED(rv = gRDF->GetResource(aURL, getter_AddRefs(bookmark) )))
|
||||
if (NS_FAILED(rv = gRDF->GetResource(nsDependentCString(aURL), getter_AddRefs(bookmark) )))
|
||||
{
|
||||
NS_ERROR("unable to get bookmark resource");
|
||||
return(rv);
|
||||
|
@ -2998,7 +3040,7 @@ nsBookmarksService::UpdateLastVisitedDate(const char *aURL, const PRUnichar *aCh
|
|||
nsCOMPtr<nsIRDFResource> bookmark;
|
||||
nsresult rv;
|
||||
|
||||
if (NS_SUCCEEDED(rv = gRDF->GetResource(aURL, getter_AddRefs(bookmark) )))
|
||||
if (NS_SUCCEEDED(rv = gRDF->GetResource(nsDependentCString(aURL), getter_AddRefs(bookmark) )))
|
||||
{
|
||||
// Note: always use mInner!! Otherwise, could get into an infinite loop
|
||||
// due to Assert/Change calling UpdateBookmarkLastModifiedDate()
|
||||
|
@ -3720,7 +3762,7 @@ nsBookmarksService::getResourceFromLiteralNode(nsIRDFNode *node, nsIRDFResource
|
|||
{
|
||||
return(NS_ERROR_NULL_POINTER);
|
||||
}
|
||||
rv = gRDF->GetUnicodeResource(newURL, res);
|
||||
rv = gRDF->GetUnicodeResource(nsDependentString(newURL), res);
|
||||
return(rv);
|
||||
}
|
||||
|
||||
|
@ -4203,7 +4245,7 @@ nsBookmarksService::insertBookmarkItem(nsIRDFResource *aRelativeNode,
|
|||
const PRUnichar* uURL = nsnull;
|
||||
bookmarkURILiteral->GetValueConst(&uURL);
|
||||
if (uURL) {
|
||||
rv = gRDF->GetUnicodeResource(uURL, getter_AddRefs(newResource));
|
||||
rv = gRDF->GetUnicodeResource(nsDependentString(uURL), getter_AddRefs(newResource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
|
@ -4940,9 +4982,11 @@ nsBookmarksService::LoadBookmarks()
|
|||
|
||||
nsCOMPtr<nsIRDFResource> systemFolderResource;
|
||||
#if defined(XP_WIN)
|
||||
rv = gRDF->GetResource(systemBookmarksURL, getter_AddRefs(systemFolderResource));
|
||||
rv = gRDF->GetResource(nsDependentCString(systemBookmarksURL),
|
||||
getter_AddRefs(systemFolderResource));
|
||||
#elif defined(XP_MAC)
|
||||
rv = gRDF->GetResource(kURINC_IEFavoritesRoot, getter_AddRefs(systemFolderResource));
|
||||
rv = gRDF->GetResource(NS_LITERAL_CSTRING(kURINC_IEFavoritesRoot),
|
||||
getter_AddRefs(systemFolderResource));
|
||||
#endif
|
||||
|
||||
rv = container->RemoveElement(systemFolderResource, PR_TRUE);
|
||||
|
@ -4976,7 +5020,8 @@ nsBookmarksService::LoadBookmarks()
|
|||
}
|
||||
#elif defined(XP_WIN) || defined(XP_BEOS)
|
||||
nsCOMPtr<nsIRDFResource> systemFolderResource;
|
||||
rv = gRDF->GetResource(systemBookmarksURL, getter_AddRefs(systemFolderResource));
|
||||
rv = gRDF->GetResource(nsDependentCString(systemBookmarksURL),
|
||||
getter_AddRefs(systemFolderResource));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsAutoString systemBookmarksFolderTitle;
|
||||
|
|
|
@ -315,7 +315,7 @@ nsHTTPIndex::OnStartRequest(nsIRequest *request, nsISupports* aContext)
|
|||
uri->GetSpec(entryuriC);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> entry;
|
||||
rv = mDirRDF->GetResource(entryuriC.get(), getter_AddRefs(entry));
|
||||
rv = mDirRDF->GetResource(entryuriC, getter_AddRefs(entry));
|
||||
|
||||
NS_ConvertUTF8toUCS2 uriUnicode(entryuriC);
|
||||
|
||||
|
@ -439,7 +439,7 @@ nsHTTPIndex::OnIndexAvailable(nsIRequest* aRequest, nsISupports *aContext,
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIRDFResource> entry;
|
||||
rv = mDirRDF->GetResource(entryuriC.get(), getter_AddRefs(entry));
|
||||
rv = mDirRDF->GetResource(entryuriC, getter_AddRefs(entry));
|
||||
|
||||
// At this point, we'll (hopefully) have found the filename and
|
||||
// constructed a resource for it, stored in entry. So now take a
|
||||
|
@ -603,17 +603,26 @@ nsHTTPIndex::CommonInit()
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "child", getter_AddRefs(kNC_Child));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "loading", getter_AddRefs(kNC_Loading));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "Comment", getter_AddRefs(kNC_Comment));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "URL", getter_AddRefs(kNC_URL));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "Name", getter_AddRefs(kNC_Description));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "Content-Length", getter_AddRefs(kNC_ContentLength));
|
||||
mDirRDF->GetResource("http://home.netscape.com/WEB-rdf#LastModifiedDate",
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
getter_AddRefs(kNC_Child));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "loading"),
|
||||
getter_AddRefs(kNC_Loading));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Comment"),
|
||||
getter_AddRefs(kNC_Comment));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
getter_AddRefs(kNC_URL));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
getter_AddRefs(kNC_Description));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Content-Length"),
|
||||
getter_AddRefs(kNC_ContentLength));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastModifiedDate"),
|
||||
getter_AddRefs(kNC_LastModified));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "Content-Type", getter_AddRefs(kNC_ContentType));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "File-Type", getter_AddRefs(kNC_FileType));
|
||||
mDirRDF->GetResource(NC_NAMESPACE_URI "IsContainer", getter_AddRefs(kNC_IsContainer));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Content-Type"),
|
||||
getter_AddRefs(kNC_ContentType));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "File-Type"),
|
||||
getter_AddRefs(kNC_FileType));
|
||||
mDirRDF->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "IsContainer"),
|
||||
getter_AddRefs(kNC_IsContainer));
|
||||
|
||||
rv = mDirRDF->GetLiteral(NS_LITERAL_STRING("true").get(), getter_AddRefs(kTrueLiteral));
|
||||
if (NS_FAILED(rv)) return(rv);
|
||||
|
@ -667,7 +676,7 @@ nsHTTPIndex::Init(nsIURI* aBaseURL)
|
|||
|
||||
// Mark the base url as a container
|
||||
nsCOMPtr<nsIRDFResource> baseRes;
|
||||
mDirRDF->GetResource(mBaseURL.get(), getter_AddRefs(baseRes));
|
||||
mDirRDF->GetResource(mBaseURL, getter_AddRefs(baseRes));
|
||||
Assert(baseRes, kNC_IsContainer, kTrueLiteral, PR_TRUE);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -136,15 +136,15 @@ nsDownloadManager::Init()
|
|||
rv = CallGetService(kRDFServiceCID, &gRDFService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
gRDFService->GetResource("NC:DownloadsRoot", &gNC_DownloadsRoot);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "File", &gNC_File);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &gNC_URL);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name", &gNC_Name);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "ProgressMode", &gNC_ProgressMode);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "ProgressPercent", &gNC_ProgressPercent);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Transferred", &gNC_Transferred);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "DownloadState", &gNC_DownloadState);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "StatusText", &gNC_StatusText);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING("NC:DownloadsRoot"), &gNC_DownloadsRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "File"), &gNC_File);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"), &gNC_URL);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"), &gNC_Name);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "ProgressMode"), &gNC_ProgressMode);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "ProgressPercent"), &gNC_ProgressPercent);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Transferred"), &gNC_Transferred);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "DownloadState"), &gNC_DownloadState);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "StatusText"), &gNC_StatusText);
|
||||
|
||||
nsCAutoString downloadsDB;
|
||||
rv = GetProfileDownloadsFileURL(downloadsDB);
|
||||
|
@ -287,7 +287,7 @@ nsDownloadManager::AssertProgressInfoFor(const nsACString& aTargetPath)
|
|||
nsCOMPtr<nsIRDFResource> res;
|
||||
nsCOMPtr<nsIRDFLiteral> literal;
|
||||
|
||||
gRDFService->GetResource(PromiseFlatCString(aTargetPath).get(), getter_AddRefs(res));
|
||||
gRDFService->GetResource(aTargetPath, getter_AddRefs(res));
|
||||
|
||||
DownloadState state;
|
||||
internalDownload->GetDownloadState(&state);
|
||||
|
@ -434,7 +434,7 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
|
|||
NS_ConvertUCS2toUTF8 utf8Path(path);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> downloadRes;
|
||||
gRDFService->GetResource(utf8Path.get(), getter_AddRefs(downloadRes));
|
||||
gRDFService->GetResource(utf8Path, getter_AddRefs(downloadRes));
|
||||
|
||||
nsCOMPtr<nsIRDFNode> node;
|
||||
|
||||
|
@ -443,7 +443,7 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
|
|||
aSource->GetSpec(spec);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> urlResource;
|
||||
gRDFService->GetResource(spec.get(), getter_AddRefs(urlResource));
|
||||
gRDFService->GetResource(spec, getter_AddRefs(urlResource));
|
||||
mDataSource->GetTarget(downloadRes, gNC_URL, PR_TRUE, getter_AddRefs(node));
|
||||
if (node)
|
||||
rv = mDataSource->Change(downloadRes, gNC_URL, node, urlResource);
|
||||
|
@ -472,7 +472,7 @@ nsDownloadManager::AddDownload(nsIURI* aSource,
|
|||
|
||||
// Assert file information
|
||||
nsCOMPtr<nsIRDFResource> fileResource;
|
||||
gRDFService->GetResource(utf8Path.get(), getter_AddRefs(fileResource));
|
||||
gRDFService->GetResource(utf8Path, getter_AddRefs(fileResource));
|
||||
rv = mDataSource->Assert(downloadRes, gNC_File, fileResource, PR_TRUE);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -605,7 +605,7 @@ nsDownloadManager::RemoveDownload(const nsACString & aTargetPath)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> res;
|
||||
gRDFService->GetResource(PromiseFlatCString(aTargetPath).get(), getter_AddRefs(res));
|
||||
gRDFService->GetResource(aTargetPath, getter_AddRefs(res));
|
||||
|
||||
// remove all the arcs for this resource, and then remove it from the Seq
|
||||
nsCOMPtr<nsISimpleEnumerator> arcs;
|
||||
|
@ -1241,7 +1241,7 @@ nsDownload::SetDisplayName(const PRUnichar* aDisplayName)
|
|||
nsresult rv = mTarget->GetPath(path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
gRDFService->GetResource(NS_ConvertUCS2toUTF8(path).get(), getter_AddRefs(res));
|
||||
gRDFService->GetUnicodeResource(path, getter_AddRefs(res));
|
||||
|
||||
gRDFService->GetLiteral(aDisplayName, getter_AddRefs(nameLiteral));
|
||||
ds->Assert(res, gNC_Name, nameLiteral, PR_TRUE);
|
||||
|
|
|
@ -638,7 +638,7 @@ nsGlobalHistory::AddPageToDatabase(const char *aURL,
|
|||
|
||||
// For notifying observers, later...
|
||||
nsCOMPtr<nsIRDFResource> url;
|
||||
rv = gRDFService->GetResource(aURL, getter_AddRefs(url));
|
||||
rv = gRDFService->GetResource(nsDependentCString(aURL, len), getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFDate> date;
|
||||
|
@ -978,7 +978,7 @@ nsGlobalHistory::SetPageTitle(const char *aURL, const PRUnichar *aTitle)
|
|||
|
||||
// ...and update observers
|
||||
nsCOMPtr<nsIRDFResource> url;
|
||||
rv = gRDFService->GetResource(aURL, getter_AddRefs(url));
|
||||
rv = gRDFService->GetResource(nsDependentCString(aURL), getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> name;
|
||||
|
@ -1018,7 +1018,7 @@ nsGlobalHistory::RemovePage(const char *aURL)
|
|||
if (!mBatchesInProgress) {
|
||||
// get the resource so we can do the notification
|
||||
nsCOMPtr<nsIRDFResource> oldRowResource;
|
||||
gRDFService->GetResource(aURL, getter_AddRefs(oldRowResource));
|
||||
gRDFService->GetResource(nsDependentCString(aURL), getter_AddRefs(oldRowResource));
|
||||
NotifyFindUnassertions(oldRowResource, row);
|
||||
}
|
||||
|
||||
|
@ -1139,7 +1139,7 @@ nsGlobalHistory::RemoveMatchingRows(rowMatchCallback aMatchFunc,
|
|||
|
||||
const char* startPtr = (const char*) yarn.mYarn_Buf;
|
||||
nsCAutoString uri(Substring(startPtr, startPtr+yarn.mYarn_Fill));
|
||||
rv = gRDFService->GetResource(uri.get(), getter_AddRefs(resource));
|
||||
rv = gRDFService->GetResource(uri, getter_AddRefs(resource));
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get resource");
|
||||
if (NS_FAILED(rv))
|
||||
continue;
|
||||
|
@ -1244,7 +1244,7 @@ nsGlobalHistory::HidePage(const char *aURL)
|
|||
// HasAssertion() correctly checks the Hidden column to show that
|
||||
// the row is hidden
|
||||
nsCOMPtr<nsIRDFResource> urlResource;
|
||||
rv = gRDFService->GetResource(aURL, getter_AddRefs(urlResource));
|
||||
rv = gRDFService->GetResource(nsDependentCString(aURL), getter_AddRefs(urlResource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return NotifyFindUnassertions(urlResource, row);
|
||||
}
|
||||
|
@ -1675,7 +1675,7 @@ nsGlobalHistory::GetTarget(nsIRDFResource* aSource,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource;
|
||||
rv = gRDFService->GetResource(str.get(),
|
||||
rv = gRDFService->GetResource(str,
|
||||
getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -2313,20 +2313,32 @@ nsGlobalHistory::Init()
|
|||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Page", &kNC_Page);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Date", &kNC_Date);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "FirstVisitDate",
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Page"),
|
||||
&kNC_Page);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Date"),
|
||||
&kNC_Date);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "FirstVisitDate"),
|
||||
&kNC_FirstVisitDate);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "VisitCount", &kNC_VisitCount);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "AgeInDays", &kNC_AgeInDays);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name", &kNC_Name);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name?sort=true", &kNC_NameSort);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Hostname", &kNC_Hostname);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Referrer", &kNC_Referrer);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "child", &kNC_child);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
|
||||
gRDFService->GetResource("NC:HistoryRoot", &kNC_HistoryRoot);
|
||||
gRDFService->GetResource("NC:HistoryByDate", &kNC_HistoryByDate);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "VisitCount"),
|
||||
&kNC_VisitCount);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "AgeInDays"),
|
||||
&kNC_AgeInDays);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
&kNC_Name);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name?sort=true"),
|
||||
&kNC_NameSort);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Hostname"),
|
||||
&kNC_Hostname);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Referrer"),
|
||||
&kNC_Referrer);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
&kNC_child);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
&kNC_URL);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING("NC:HistoryRoot"),
|
||||
&kNC_HistoryRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING("NC:HistoryByDate"),
|
||||
&kNC_HistoryByDate);
|
||||
}
|
||||
|
||||
// register this as a named data source with the RDF service
|
||||
|
@ -2961,7 +2973,7 @@ nsGlobalHistory::GetRootDayQueries(nsISimpleEnumerator **aResult)
|
|||
uri = prefix;
|
||||
uri.AppendInt(i);
|
||||
uri.Append("&groupby=Hostname");
|
||||
rv = gRDFService->GetResource(uri.get(), getter_AddRefs(finduri));
|
||||
rv = gRDFService->GetResource(uri, getter_AddRefs(finduri));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
rv = CreateFindEnumerator(finduri, getter_AddRefs(findEnumerator));
|
||||
if (NS_FAILED(rv)) continue;
|
||||
|
@ -2973,7 +2985,7 @@ nsGlobalHistory::GetRootDayQueries(nsISimpleEnumerator **aResult)
|
|||
uri = FIND_BY_AGEINDAYS_PREFIX "isgreater" "&text=";
|
||||
uri.AppendInt(i-1);
|
||||
uri.Append("&groupby=Hostname");
|
||||
rv = gRDFService->GetResource(uri.get(), getter_AddRefs(finduri));
|
||||
rv = gRDFService->GetResource(uri, getter_AddRefs(finduri));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = CreateFindEnumerator(finduri, getter_AddRefs(findEnumerator));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -3241,7 +3253,7 @@ nsGlobalHistory::NotifyFindAssertions(nsIRDFResource *aSource,
|
|||
query.terms.AppendElement((void *)&ageterm);
|
||||
|
||||
GetFindUriPrefix(query, PR_TRUE, findUri);
|
||||
gRDFService->GetResource(findUri.get(), getter_AddRefs(childFindResource));
|
||||
gRDFService->GetResource(findUri, getter_AddRefs(childFindResource));
|
||||
NotifyAssert(kNC_HistoryByDate, kNC_child, childFindResource);
|
||||
|
||||
query.terms.Clear();
|
||||
|
@ -3256,7 +3268,7 @@ nsGlobalHistory::NotifyFindAssertions(nsIRDFResource *aSource,
|
|||
query.terms.AppendElement((void *)&hostterm);
|
||||
|
||||
GetFindUriPrefix(query, PR_FALSE, findUri);
|
||||
gRDFService->GetResource(findUri.get(), getter_AddRefs(childFindResource));
|
||||
gRDFService->GetResource(findUri, getter_AddRefs(childFindResource));
|
||||
NotifyAssert(parentFindResource, kNC_child, childFindResource);
|
||||
|
||||
query.terms.Clear();
|
||||
|
@ -3269,13 +3281,13 @@ nsGlobalHistory::NotifyFindAssertions(nsIRDFResource *aSource,
|
|||
query.groupBy = kToken_HostnameColumn; // create groupby=Hostname
|
||||
|
||||
GetFindUriPrefix(query, PR_TRUE, findUri);
|
||||
gRDFService->GetResource(findUri.get(), getter_AddRefs(parentFindResource));
|
||||
gRDFService->GetResource(findUri, getter_AddRefs(parentFindResource));
|
||||
|
||||
query.groupBy = 0; // create Hostname=<host>
|
||||
query.terms.AppendElement((void *)&hostterm);
|
||||
GetFindUriPrefix(query, PR_FALSE, findUri);
|
||||
findUri.Append(hostname); // append <host>
|
||||
gRDFService->GetResource(findUri.get(), getter_AddRefs(childFindResource));
|
||||
gRDFService->GetResource(findUri, getter_AddRefs(childFindResource));
|
||||
|
||||
NotifyAssert(parentFindResource, kNC_child, childFindResource);
|
||||
|
||||
|
@ -3334,7 +3346,7 @@ nsGlobalHistory::NotifyFindUnassertions(nsIRDFResource *aSource,
|
|||
query.terms.AppendElement((void *)&hostterm);
|
||||
GetFindUriPrefix(query, PR_FALSE, findUri);
|
||||
|
||||
gRDFService->GetResource(findUri.get(), getter_AddRefs(findResource));
|
||||
gRDFService->GetResource(findUri, getter_AddRefs(findResource));
|
||||
|
||||
NotifyUnassert(findResource, kNC_child, aSource);
|
||||
|
||||
|
@ -3344,7 +3356,7 @@ nsGlobalHistory::NotifyFindUnassertions(nsIRDFResource *aSource,
|
|||
query.terms.AppendElement((void *)&hostterm);
|
||||
GetFindUriPrefix(query, PR_FALSE, findUri);
|
||||
|
||||
gRDFService->GetResource(findUri.get(), getter_AddRefs(findResource));
|
||||
gRDFService->GetResource(findUri, getter_AddRefs(findResource));
|
||||
NotifyUnassert(findResource, kNC_child, aSource);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -3516,7 +3528,7 @@ nsGlobalHistory::URLEnumerator::ConvertToISupports(nsIMdbRow* aRow, nsISupports*
|
|||
nsCOMPtr<nsIRDFResource> resource;
|
||||
const char* startPtr = (const char*) yarn.mYarn_Buf;
|
||||
rv = gRDFService->GetResource(
|
||||
nsCAutoString(Substring(startPtr, startPtr+yarn.mYarn_Fill)).get(),
|
||||
Substring(startPtr, startPtr+yarn.mYarn_Fill),
|
||||
getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -3815,7 +3827,7 @@ nsGlobalHistory::SearchEnumerator::ConvertToISupports(nsIMdbRow* aRow,
|
|||
|
||||
const char* startPtr = (const char*)yarn.mYarn_Buf;
|
||||
rv = gRDFService->GetResource(
|
||||
nsCAutoString(Substring(startPtr, startPtr+yarn.mYarn_Fill)).get(),
|
||||
Substring(startPtr, startPtr+yarn.mYarn_Fill),
|
||||
getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -3839,7 +3851,7 @@ nsGlobalHistory::SearchEnumerator::ConvertToISupports(nsIMdbRow* aRow,
|
|||
findUri.Append(Substring(startPtr, startPtr+groupByValue.mYarn_Fill));
|
||||
findUri.Append('\0');
|
||||
|
||||
rv = gRDFService->GetResource(findUri.get(), getter_AddRefs(resource));
|
||||
rv = gRDFService->GetResource(findUri, getter_AddRefs(resource));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*aResult = resource;
|
||||
|
@ -3980,6 +3992,465 @@ nsGlobalHistory::OnStopLookup()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
<<<<<<< nsGlobalHistory.cpp
|
||||
|
||||
/**
|
||||
*
|
||||
* The input features into the autocomplete perceptron are as follows:
|
||||
*
|
||||
* Features 1 = Frequency and recency metric for page in history
|
||||
* (domain = positive real numbers)
|
||||
* Value decays fast with age of page
|
||||
* Uses HISTORY_FAST_DECAY_CONSTANT
|
||||
* Features 2 = Frequency and recency metric for page in history
|
||||
* (high for newer, more accessed pages)
|
||||
* Value decays slowly with age of page
|
||||
* Uses HISTORY_SLOW_DECAY_CONSTANT
|
||||
* Features 3 = Was the url typed by the user?
|
||||
* (domain = 0 or 1)
|
||||
* Features 4 = Recency metric for page in bookmarks
|
||||
* (domain = real number between 0 and 1)
|
||||
* Value decays fast with age of bookmark
|
||||
* Uses BOOKMARKS_FAST_DECAY_CONSTANT
|
||||
* Features 5 = Recency metric for page in bookmarks
|
||||
* (domain = real number between 0 and 1)
|
||||
* Value decays slowly with age of bookmark
|
||||
* Uses BOOKMARKS_SLOW_DECAY_CONSTANT
|
||||
*
|
||||
* Features 1 and Feature 2 details:
|
||||
*
|
||||
* As an example, say a page was first seen on Day 1 and accessed from then
|
||||
* until today (Day 4) with the following schedule:
|
||||
*
|
||||
* (Day 1, D times), (Day 2, C times), (Day 3, B times), (Day 4, A times)
|
||||
*
|
||||
* Then, the frequency+recency metric calculation for the page will be:
|
||||
*
|
||||
* FRMetric = A + (B * G) + (C * G^2) + (D * G^3)
|
||||
*
|
||||
* where G is the decay constant that takes values between 0 and 1.
|
||||
* Values close to 1 lead to slow decay with age.
|
||||
* Values close to 0 lead to fast decay with age.
|
||||
*
|
||||
* Feature 4 and Feature 5 only care about recency not frequency.
|
||||
*
|
||||
* So, if a bookmark was added X days earlier,
|
||||
*
|
||||
* Bookmark Feature Value = G^X.
|
||||
*
|
||||
* where G is the decay constant that takes values between 0 and 1.
|
||||
* Values close to 1 lead to slow decay with age.
|
||||
* Values close to 0 lead to fast decay with age.
|
||||
*
|
||||
* The rest of the url related features:
|
||||
*
|
||||
* Feature 6: Whether url ends in .htm or .html
|
||||
* Feature 7: Is it a .com URL?
|
||||
* Feature 8: Is it a .edu URL?
|
||||
* Feature 9: Is it a .org URL?
|
||||
* Feature 10: Is it a .net URL?
|
||||
* Feature 11: Is it a .gov URL?
|
||||
* Feature 12: Does the URL contain a ~ ?
|
||||
* Feature 13: Does the URL start with http:* ?
|
||||
* Feature 14: Does the URL start with ftp:// ?
|
||||
* Feature 15: Does the URL start with file:// ?
|
||||
* Feature 16: Does the URL start with gopher:// ?
|
||||
* Feature 17: Does the URL start with https:// ?
|
||||
* Feature 18: Does the host name end in a two letter country code?
|
||||
* Feature 19: Number of /s in the URL.
|
||||
* Feature 20: Number of ?s in the URL.
|
||||
* Feature 21: Number of &s in the URL.
|
||||
* Feature 22: Number of =s in the URL.
|
||||
* Feature 23: Number of #s in the URL.
|
||||
* Feature 24: Number of +s in the URL.
|
||||
* Feature 25: Number of .s in the URL.
|
||||
* Feature 26: Number of numerical [0-9] characters in the URL
|
||||
* Feature 27: Number of alphabetical [a-zA-Z] characters in the URL
|
||||
* Feature 28: Number of non-alphanumeric, non-[/?&=#+.] characters in the URL
|
||||
* Feature 29: Number of .s in the hostname
|
||||
* Feature 30: Number of numerical [0-9] characters in the hostname
|
||||
* Feature 31: Number of alphabetical [a-zA-Z] characters in the hostname
|
||||
* Feature 32: Number of non-alphanumeric, non-[/?&=#+.] characters in the hostname
|
||||
* Feature 33: Number of .s in the hostname if we omit initial "www." or "ftp." (if any)
|
||||
* Feature 34: Number of .s in the hostname if we omit ending ".XX" country code (if any)
|
||||
* Feature 35: Number of .s in the hostname if we omit initial "www." or "ftp"
|
||||
* and ending ".XX" country code (if any)
|
||||
* Feature 36: Number of characters in URL
|
||||
* Feature 37: Number of characters in hostname
|
||||
* Feature 38: Number of characters in hostname excluding initial "www." or "ftp."
|
||||
* Feature 39: Number of characters in URL excluding hostname
|
||||
* Feature 40: Number of characters in web page title
|
||||
* Feature 41: Is this a google search url?
|
||||
* Feature 42: Is this a netscape search url?
|
||||
* Feature 43: Is this a yahoo search url?
|
||||
* Feature 44: Dummy input hardcoded to 1
|
||||
*/
|
||||
|
||||
nsresult
|
||||
nsGlobalHistory::FillInputFeatures(nsAString &aUrl,
|
||||
PRFloat64 *aFeatures)
|
||||
{
|
||||
nsCOMPtr<nsIMdbRow> row;
|
||||
nsresult rv = NS_OK;
|
||||
PRInt32 ageInDays;
|
||||
PRInt64 lastDate;
|
||||
static nsCOMPtr<nsIBookmarksService> bs =
|
||||
do_GetService(NS_BOOKMARKS_SERVICE_CONTRACTID, &rv);
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsCAutoString curl, chost, cpath;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), aUrl);
|
||||
if (NS_SUCCEEDED(rv) && uri) {
|
||||
uri->GetSpec(curl);
|
||||
uri->GetHost(chost);
|
||||
uri->GetPath(cpath);
|
||||
}
|
||||
nsAutoString url(NS_ConvertUTF8toUCS2(curl).get());
|
||||
nsAutoString path(NS_ConvertUTF8toUCS2(cpath).get());
|
||||
nsAutoString host(NS_ConvertUTF8toUCS2(chost).get());
|
||||
ToLowerCase(url);
|
||||
ToLowerCase(host);
|
||||
ToLowerCase(path);
|
||||
|
||||
// Calculate the input features for this training example.
|
||||
rv = FindRow(kToken_URLColumn, curl.get(),
|
||||
getter_AddRefs(row));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// First, get the page in history related input features
|
||||
rv = GetRowValue(row, kToken_FRFastDecayColumn, &aFeatures[0]);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
rv = GetRowValue(row, kToken_LastVisitDateColumn, &lastDate);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
ageInDays = GetAgeInDays(NormalizeTime(GetNow()), lastDate);
|
||||
|
||||
aFeatures[0] *= pow(HISTORY_FAST_DECAY_CONSTANT, (PRFloat64) ageInDays);
|
||||
|
||||
rv = GetRowValue(row, kToken_FRSlowDecayColumn, &aFeatures[1]);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aFeatures[1] *= pow(HISTORY_SLOW_DECAY_CONSTANT, (PRFloat64) ageInDays);
|
||||
|
||||
aFeatures[2] = HasCell(mEnv, row, kToken_TypedColumn);
|
||||
|
||||
// Second, calculate the bookmark related input features.
|
||||
aFeatures[3] = aFeatures[4] = 0;
|
||||
if (bs) {
|
||||
PRBool bookmarked;
|
||||
rv = bs->IsBookmarked(curl.get(), &bookmarked);
|
||||
if (NS_SUCCEEDED(rv) && bookmarked) {
|
||||
// Get the date when the bookmark was added.
|
||||
PRInt64 addDate;
|
||||
nsCOMPtr<nsIRDFResource> rdfRes;
|
||||
|
||||
if (NS_SUCCEEDED(rv = gRDFService->GetResource(curl,
|
||||
getter_AddRefs(rdfRes)))) {
|
||||
nsCOMPtr<nsIRDFDataSource> bookmarkDS = do_QueryInterface(bs, &rv);
|
||||
if (NS_SUCCEEDED(rv) && bookmarkDS) {
|
||||
nsCOMPtr<nsIRDFNode> nodeType;
|
||||
rv = bookmarkDS->GetTarget(rdfRes, kRDF_Type, PR_TRUE,
|
||||
getter_AddRefs(nodeType));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (nodeType == kNC_Bookmark) {
|
||||
nsCOMPtr<nsIRDFNode> node;
|
||||
rv = bookmarkDS->GetTarget(rdfRes, kNC_BookmarkAddDate, PR_TRUE,
|
||||
getter_AddRefs(node));
|
||||
if (rv != NS_RDF_NO_VALUE && node) {
|
||||
nsCOMPtr<nsIRDFDate> rdfDate = do_QueryInterface(node, &rv);
|
||||
if (NS_SUCCEEDED(rv) && rdfDate) {
|
||||
rv = rdfDate->GetValue(&addDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
ageInDays = GetAgeInDays(NormalizeTime(GetNow()), addDate);
|
||||
aFeatures[3] = pow(BOOKMARK_FAST_DECAY_CONSTANT, ageInDays);
|
||||
aFeatures[4] = pow(BOOKMARK_SLOW_DECAY_CONSTANT, ageInDays);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Feature 6: Whether url ends in .htm or .html
|
||||
nsAString::const_iterator start, end;
|
||||
|
||||
path.BeginReading(start);
|
||||
path.EndReading(end);
|
||||
aFeatures[5] = FindInReadable(NS_LITERAL_STRING(".htm"), start, end);
|
||||
|
||||
// Feature 7: Is it a .com URL?
|
||||
host.BeginReading(start);
|
||||
host.EndReading(end);
|
||||
aFeatures[6] = FindInReadable(NS_LITERAL_STRING(".com"), start, end);
|
||||
|
||||
// Feature 8: Is it a .edu URL?
|
||||
host.BeginReading(start);
|
||||
host.EndReading(end);
|
||||
aFeatures[7] = FindInReadable(NS_LITERAL_STRING(".edu"), start, end);
|
||||
|
||||
// Feature 9: Is it a .org URL?
|
||||
host.BeginReading(start);
|
||||
host.EndReading(end);
|
||||
aFeatures[8] = FindInReadable(NS_LITERAL_STRING(".org"), start, end);
|
||||
|
||||
// Feature 10: Is it a .net URL?
|
||||
host.BeginReading(start);
|
||||
host.EndReading(end);
|
||||
aFeatures[9] = FindInReadable(NS_LITERAL_STRING(".net"), start, end);
|
||||
|
||||
// Feature 11: Is it a .gov URL?
|
||||
host.BeginReading(start);
|
||||
host.EndReading(end);
|
||||
aFeatures[10] = FindInReadable(NS_LITERAL_STRING(".gov"), start, end);
|
||||
|
||||
// Feature 12: Does the URL contain a ~ ?
|
||||
path.BeginReading(start);
|
||||
path.EndReading(end);
|
||||
aFeatures[11] = FindInReadable(NS_LITERAL_STRING("~"), start, end);
|
||||
|
||||
// Feature 13: Does the URL start with http:// ?
|
||||
PRBool isScheme;
|
||||
aFeatures[12] = aFeatures[13] = aFeatures[14] = aFeatures[15] = aFeatures[16] = 0;
|
||||
if (NS_SUCCEEDED(uri->SchemeIs("http", &isScheme))) {
|
||||
aFeatures[12] = isScheme;
|
||||
}
|
||||
// Feature 14: Does the URL start with ftp:// ?
|
||||
else if (NS_SUCCEEDED(uri->SchemeIs("ftp", &isScheme))) {
|
||||
aFeatures[13] = isScheme;
|
||||
}
|
||||
// Feature 15: Does the URL start with file:// ?
|
||||
else if (NS_SUCCEEDED(uri->SchemeIs("file", &isScheme))) {
|
||||
aFeatures[14] = isScheme;
|
||||
}
|
||||
// Feature 16: Does the URL start with gopher:// ?
|
||||
else if (NS_SUCCEEDED(uri->SchemeIs("gopher", &isScheme))) {
|
||||
aFeatures[15] = isScheme;
|
||||
}
|
||||
// Feature 17: Does the URL start with https:// ?
|
||||
else if (NS_SUCCEEDED(uri->SchemeIs("https", &isScheme))) {
|
||||
aFeatures[16] = isScheme;
|
||||
}
|
||||
|
||||
// Feature 18: Does the host name end in a two letter country code?
|
||||
PRInt32 hostLength = host.Length();
|
||||
if (host[hostLength - 1] == '.') {
|
||||
// Skip trailing dots in hostname if it exists. This will catch cases like
|
||||
// http://www.state.ca.us./state/portal/myca_homepage.jsp
|
||||
aFeatures[17] = (host.RFindChar('.', hostLength - 2) == (hostLength - 4));
|
||||
}
|
||||
else {
|
||||
aFeatures[17] = (host.RFindChar('.') == ((hostLength - 1) - 2));
|
||||
}
|
||||
|
||||
// Feature 19: Number of /s in the URL.
|
||||
aFeatures[18] = 0;
|
||||
// Feature 20: Number of ?s in the URL.
|
||||
aFeatures[19] = 0;
|
||||
// Feature 21: Number of &s in the URL.
|
||||
aFeatures[20] = 0;
|
||||
// Feature 22: Number of =s in the URL.
|
||||
aFeatures[21] = 0;
|
||||
// Feature 23: Number of #s in the URL.
|
||||
aFeatures[22] = 0;
|
||||
// Feature 24: Number of +s in the URL.
|
||||
aFeatures[23] = 0;
|
||||
// Feature 25: Number of .s in the URL.
|
||||
aFeatures[24] = 0;
|
||||
// Feature 26: Number of numerical [0-9] characters in the URL
|
||||
aFeatures[25] = 0;
|
||||
// Feature 27: Number of alphabetical [a-zA-Z] characters in the URL
|
||||
aFeatures[26] = 0;
|
||||
// Feature 28: Number of non-alphanumeric, non-[/?&=#+.] characters in the URL
|
||||
aFeatures[27] = 0;
|
||||
|
||||
url.BeginReading(start);
|
||||
url.EndReading(end);
|
||||
|
||||
PRUint32 size, i;
|
||||
for ( ; start != end; start.advance(size)) {
|
||||
const PRUnichar* buf = start.get();
|
||||
size = start.size_forward();
|
||||
|
||||
// fragment at 'buf' is 'size' characters long
|
||||
for (i = 0; i < size; *buf++, i++) {
|
||||
switch (*buf) {
|
||||
case '/':
|
||||
++aFeatures[18];
|
||||
break;
|
||||
|
||||
case '?':
|
||||
++aFeatures[19];
|
||||
break;
|
||||
|
||||
case '&':
|
||||
++aFeatures[20];
|
||||
break;
|
||||
|
||||
case '=':
|
||||
++aFeatures[21];
|
||||
break;
|
||||
|
||||
case '#':
|
||||
++aFeatures[22];
|
||||
break;
|
||||
|
||||
case '+':
|
||||
++aFeatures[23];
|
||||
break;
|
||||
|
||||
case '.':
|
||||
++aFeatures[24];
|
||||
break;
|
||||
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
++aFeatures[25];
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isalpha(*buf))
|
||||
++aFeatures[26];
|
||||
else
|
||||
++aFeatures[27];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate a bunch of hostname related features.
|
||||
|
||||
// Feature 29: Number of .s in the hostname
|
||||
aFeatures[28] = 0;
|
||||
// Feature 30: Number of numerical [0-9] characters in the hostname
|
||||
aFeatures[29] = 0;
|
||||
// Feature 31: Number of alphabetical [a-zA-Z] characters in the hostname
|
||||
aFeatures[30] = 0;
|
||||
// Feature 32: Number of non-alphanumeric, non-[.] characters in the hostname
|
||||
aFeatures[31] = 0;
|
||||
|
||||
size = chost.Length();
|
||||
for (i = 0; i < size; i++) {
|
||||
switch (chost[i]) {
|
||||
case '.':
|
||||
++aFeatures[28];
|
||||
break;
|
||||
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
++aFeatures[29];
|
||||
break;
|
||||
|
||||
default:
|
||||
if (isalpha(chost[i]))
|
||||
++aFeatures[30];
|
||||
else
|
||||
++aFeatures[31];
|
||||
}
|
||||
}
|
||||
|
||||
// Feature 33: Number of .s in the hostname if we omit initial "www." or "ftp." (if any)
|
||||
aFeatures[32] = aFeatures[28];
|
||||
// Feature 34: Number of .s in the hostname if we omit ending ".XX" country code (if any)
|
||||
aFeatures[33] = aFeatures[28];
|
||||
// Feature 35: Number of .s in the hostname if we omit initial "www." or "ftp"
|
||||
// and ending ".XX" country code (if any)
|
||||
aFeatures[34] = aFeatures[28];
|
||||
// Feature 36: Number of characters in hostname
|
||||
aFeatures[35] = chost.Length();
|
||||
// Feature 37: Number of characters in hostname excluding initial "www." or "ftp."
|
||||
aFeatures[36] = aFeatures[35];
|
||||
|
||||
if (chost.Find("www.") == 0 || chost.Find("ftp.") == 0) {
|
||||
--aFeatures[32];
|
||||
--aFeatures[34];
|
||||
aFeatures[36] -= 4;
|
||||
}
|
||||
|
||||
if (aFeatures[17]) {
|
||||
--aFeatures[33];
|
||||
--aFeatures[34];
|
||||
}
|
||||
|
||||
// Feature 38: Number of characters in URL
|
||||
aFeatures[37] = url.Length();
|
||||
|
||||
// Feature 39: Number of characters in URL excluding hostname
|
||||
aFeatures[38] = aFeatures[37] - aFeatures[35];
|
||||
|
||||
// Feature 40: Number of characters in web page title
|
||||
nsAutoString title;
|
||||
rv = GetRowValue(row, kToken_NameColumn, title);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
aFeatures[39] = title.Length();
|
||||
|
||||
// Feature 41: Is this a google search url?
|
||||
url.BeginReading(start);
|
||||
url.EndReading(end);
|
||||
aFeatures[40] = FindInReadable(NS_LITERAL_STRING("http://www.google.com/search"), start, end);
|
||||
|
||||
// Feature 42: Is this a netscape search url?
|
||||
url.BeginReading(start);
|
||||
url.EndReading(end);
|
||||
aFeatures[41] = FindInReadable(NS_LITERAL_STRING("http://search.netscape.com/nscp_results.adp"), start, end);
|
||||
|
||||
// Feature 43: Is this a yahoo search url?
|
||||
url.BeginReading(start);
|
||||
url.EndReading(end);
|
||||
aFeatures[42] = FindInReadable(NS_LITERAL_STRING("http://search.yahoo.com/bin/search"), start, end);
|
||||
|
||||
// Feature 44: This is a dummy input hardcoded to 1. It allows
|
||||
// the perceptron to represent functions that do not pass through the
|
||||
// origin.
|
||||
aFeatures[43] = 1;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGlobalHistory::WriteURLData(nsAString& aURL, PRFloat64* aURLFeatures)
|
||||
{
|
||||
nsCOMPtr<nsIMdbRow> row;
|
||||
nsresult rv = NS_OK;
|
||||
nsCAutoString dateStr, IDStr;
|
||||
PRInt64 rowID;
|
||||
|
||||
if (!mURLDataFile || !aURLFeatures)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Calculate the input features for this training example.
|
||||
rv = FindRowAndID(kToken_URLColumn, NS_ConvertUCS2toUTF8(aURL).get(),
|
||||
getter_AddRefs(row), &rowID);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!rowID) {
|
||||
AssignUniqueURLID(row, &rowID);
|
||||
}
|
||||
|
||||
PRInt64ToChars(rowID, IDStr);
|
||||
|
||||
fprintf(mURLDataFile, "<url id='%s'", IDStr.get());
|
||||
if (mDataCaptureMode == URLDATACAPTURE_WITH_URL_INFO) {
|
||||
fprintf(mURLDataFile, " path='%s'", NS_ConvertUCS2toUTF8(aURL).get());
|
||||
}
|
||||
PRInt64ToChars(PR_Now(), dateStr);
|
||||
fprintf(mURLDataFile, " time='%s'>\n", dateStr.get());
|
||||
|
||||
PRInt32 i;
|
||||
for (i = 0; i < AC_NUM_URL_FEATURES - 1; i++) {
|
||||
fprintf(mURLDataFile, "%.2f, ", aURLFeatures[i]);
|
||||
}
|
||||
|
||||
fprintf(mURLDataFile, "%.2f\n</url>\n", aURLFeatures[i]);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> 1.173
|
||||
NS_IMETHODIMP
|
||||
nsGlobalHistory::OnAutoComplete(const PRUnichar *searchString,
|
||||
nsIAutoCompleteResults *previousSearchResult,
|
||||
|
|
|
@ -459,7 +459,8 @@ nsCharsetMenu::nsCharsetMenu()
|
|||
res = nsComponentManager::CreateInstance(kRDFInMemoryDataSourceCID, nsnull,
|
||||
NS_GET_IID(nsIRDFDataSource), (void**) &mInner);
|
||||
|
||||
mRDFService->GetResource(kURINC_BrowserCharsetMenuRoot, &kNC_BrowserCharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserCharsetMenuRoot),
|
||||
&kNC_BrowserCharsetMenuRoot);
|
||||
}
|
||||
|
||||
//get pref service
|
||||
|
@ -635,22 +636,37 @@ nsresult nsCharsetMenu::Init()
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
//initialize all remaining RDF template nodes
|
||||
mRDFService->GetResource(kURINC_BrowserAutodetMenuRoot, &kNC_BrowserAutodetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_BrowserMoreCharsetMenuRoot, &kNC_BrowserMoreCharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_BrowserMore1CharsetMenuRoot, &kNC_BrowserMore1CharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_BrowserMore2CharsetMenuRoot, &kNC_BrowserMore2CharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_BrowserMore3CharsetMenuRoot, &kNC_BrowserMore3CharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_BrowserMore4CharsetMenuRoot, &kNC_BrowserMore4CharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_BrowserMore5CharsetMenuRoot, &kNC_BrowserMore5CharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_MaileditCharsetMenuRoot, &kNC_MaileditCharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_MailviewCharsetMenuRoot, &kNC_MailviewCharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_ComposerCharsetMenuRoot, &kNC_ComposerCharsetMenuRoot);
|
||||
mRDFService->GetResource(kURINC_DecodersRoot, &kNC_DecodersRoot);
|
||||
mRDFService->GetResource(kURINC_Name, &kNC_Name);
|
||||
mRDFService->GetResource(kURINC_Checked, &kNC_Checked);
|
||||
mRDFService->GetResource(kURINC_CharsetDetector, &kNC_CharsetDetector);
|
||||
mRDFService->GetResource(kURINC_BookmarkSeparator, &kNC_BookmarkSeparator);
|
||||
mRDFService->GetResource(kURINC_type, &kRDF_type);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserAutodetMenuRoot),
|
||||
&kNC_BrowserAutodetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMoreCharsetMenuRoot),
|
||||
&kNC_BrowserMoreCharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore1CharsetMenuRoot),
|
||||
&kNC_BrowserMore1CharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore2CharsetMenuRoot),
|
||||
&kNC_BrowserMore2CharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore3CharsetMenuRoot),
|
||||
&kNC_BrowserMore3CharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore4CharsetMenuRoot),
|
||||
&kNC_BrowserMore4CharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BrowserMore5CharsetMenuRoot),
|
||||
&kNC_BrowserMore5CharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_MaileditCharsetMenuRoot),
|
||||
&kNC_MaileditCharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_MailviewCharsetMenuRoot),
|
||||
&kNC_MailviewCharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_ComposerCharsetMenuRoot),
|
||||
&kNC_ComposerCharsetMenuRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_DecodersRoot),
|
||||
&kNC_DecodersRoot);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Name),
|
||||
&kNC_Name);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Checked),
|
||||
&kNC_Checked);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_CharsetDetector),
|
||||
&kNC_CharsetDetector);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_BookmarkSeparator),
|
||||
&kNC_BookmarkSeparator);
|
||||
mRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_type), &kRDF_type);
|
||||
|
||||
nsIRDFContainerUtils * rdfUtil = NULL;
|
||||
res = nsServiceManager::GetService(kRDFContainerUtilsCID,
|
||||
|
@ -728,9 +744,7 @@ nsresult nsCharsetMenu::SetCharsetCheckmark(nsString * aCharset,
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// find RDF node for given charset
|
||||
char csID[256];
|
||||
aCharset->ToCString(csID, sizeof(csID));
|
||||
res = mRDFService->GetResource(csID, getter_AddRefs(node));
|
||||
res = mRDFService->GetUnicodeResource(*aCharset, getter_AddRefs(node));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// set checkmark value
|
||||
|
@ -1258,9 +1272,7 @@ nsresult nsCharsetMenu::AddMenuItemToContainer(
|
|||
id.Append(cs);
|
||||
|
||||
// Make up a unique ID and create the RDF NODE
|
||||
char csID[256];
|
||||
id.ToCString(csID, sizeof(csID));
|
||||
res = mRDFService->GetResource(csID, getter_AddRefs(node));
|
||||
res = mRDFService->GetUnicodeResource(id, getter_AddRefs(node));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
const PRUnichar * title = aItem->mTitle.get();
|
||||
|
|
|
@ -228,14 +228,22 @@ RelatedLinksStreamListener::Init()
|
|||
NS_RELEASE(charsetConv);
|
||||
}
|
||||
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "child", &kNC_Child);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name", &kNC_Name);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "loading", &kNC_loading);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "BookmarkSeparator", &kNC_BookmarkSeparator);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "RelatedLinksTopic", &kNC_RelatedLinksTopic);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
gRDFService->GetResource(kURINC_RelatedLinksRoot, &kNC_RelatedLinksRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
&kNC_Child);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
&kNC_Name);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
&kNC_URL);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "loading"),
|
||||
&kNC_loading);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "BookmarkSeparator"),
|
||||
&kNC_BookmarkSeparator);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "RelatedLinksTopic"),
|
||||
&kNC_RelatedLinksTopic);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_RelatedLinksRoot),
|
||||
&kNC_RelatedLinksRoot);
|
||||
}
|
||||
|
||||
mParentArray.AppendElement(kNC_RelatedLinksRoot);
|
||||
|
@ -624,10 +632,14 @@ RelatedLinksHandlerImpl::Init()
|
|||
(nsISupports**) &gRDFService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
gRDFService->GetResource(kURINC_RelatedLinksRoot, &kNC_RelatedLinksRoot);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "RelatedLinksTopic", &kNC_RelatedLinksTopic);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "child", &kNC_Child);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_RelatedLinksRoot),
|
||||
&kNC_RelatedLinksRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "RelatedLinksTopic"),
|
||||
&kNC_RelatedLinksTopic);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
&kNC_Child);
|
||||
|
||||
nsCOMPtr<nsIPref> prefServ(do_GetService(kPrefCID, &rv));
|
||||
mRLServerURL = new nsString();
|
||||
|
|
|
@ -433,57 +433,106 @@ InternetSearchDataSource::InternetSearchDataSource(void)
|
|||
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF container utils");
|
||||
|
||||
gRDFService->GetResource(kURINC_SearchEngineRoot, &kNC_SearchEngineRoot);
|
||||
gRDFService->GetResource(kURINC_LastSearchRoot, &kNC_LastSearchRoot);
|
||||
gRDFService->GetResource(kURINC_SearchResultsSitesRoot, &kNC_SearchResultsSitesRoot);
|
||||
gRDFService->GetResource(kURINC_FilterSearchURLsRoot, &kNC_FilterSearchURLsRoot);
|
||||
gRDFService->GetResource(kURINC_FilterSearchSitesRoot, &kNC_FilterSearchSitesRoot);
|
||||
gRDFService->GetResource(kURINC_SearchCategoryRoot, &kNC_SearchCategoryRoot);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "SearchMode", &kNC_LastSearchMode);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_SearchEngineRoot),
|
||||
&kNC_SearchEngineRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_LastSearchRoot),
|
||||
&kNC_LastSearchRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_SearchResultsSitesRoot),
|
||||
&kNC_SearchResultsSitesRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_FilterSearchURLsRoot),
|
||||
&kNC_FilterSearchURLsRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_FilterSearchSitesRoot),
|
||||
&kNC_FilterSearchSitesRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_SearchCategoryRoot),
|
||||
&kNC_SearchCategoryRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "SearchMode"),
|
||||
&kNC_LastSearchMode);
|
||||
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "searchtype", &kNC_SearchType);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "SearchResult", &kNC_SearchResult);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "ref", &kNC_Ref);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "child", &kNC_Child);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "title", &kNC_Title);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "data", &kNC_Data);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name", &kNC_Name);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Description", &kNC_Description);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Version", &kNC_Version);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "actionButton", &kNC_actionButton);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "actionBar", &kNC_actionBar);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "searchForm", &kNC_searchForm);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "LastText", &kNC_LastText);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_InstanceOf);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "loading", &kNC_loading);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "HTML", &kNC_HTML);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Icon", &kNC_Icon);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "StatusIcon", &kNC_StatusIcon);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Banner", &kNC_Banner);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Site", &kNC_Site);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Relevance", &kNC_Relevance);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Relevance?sort=true", &kNC_RelevanceSort);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Date", &kNC_Date);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "PageRank", &kNC_PageRank);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Engine", &kNC_Engine);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Price", &kNC_Price);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Price?sort=true", &kNC_PriceSort);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Availability", &kNC_Availability);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "BookmarkSeparator", &kNC_BookmarkSeparator);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Update", &kNC_Update);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "UpdateIcon", &kNC_UpdateIcon);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "UpdateCheckDays", &kNC_UpdateCheckDays);
|
||||
gRDFService->GetResource(WEB_NAMESPACE_URI "LastPingDate", &kWEB_LastPingDate);
|
||||
gRDFService->GetResource(WEB_NAMESPACE_URI "LastPingModDate", &kWEB_LastPingModDate);
|
||||
gRDFService->GetResource(WEB_NAMESPACE_URI "LastPingContentLen", &kWEB_LastPingContentLen);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "searchtype"),
|
||||
&kNC_SearchType);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "SearchResult"),
|
||||
&kNC_SearchResult);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "ref"),
|
||||
&kNC_Ref);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
&kNC_Child);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "title"),
|
||||
&kNC_Title);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "data"),
|
||||
&kNC_Data);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
&kNC_Name);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Description"),
|
||||
&kNC_Description);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Version"),
|
||||
&kNC_Version);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "actionButton"),
|
||||
&kNC_actionButton);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "actionBar"),
|
||||
&kNC_actionBar);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "searchForm"),
|
||||
&kNC_searchForm);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "LastText"),
|
||||
&kNC_LastText);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
&kNC_URL);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
&kRDF_InstanceOf);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "loading"),
|
||||
&kNC_loading);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "HTML"),
|
||||
&kNC_HTML);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Icon"),
|
||||
&kNC_Icon);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "StatusIcon"),
|
||||
&kNC_StatusIcon);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Banner"),
|
||||
&kNC_Banner);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Site"),
|
||||
&kNC_Site);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Relevance"),
|
||||
&kNC_Relevance);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Relevance?sort=true"),
|
||||
&kNC_RelevanceSort);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Date"),
|
||||
&kNC_Date);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "PageRank"),
|
||||
&kNC_PageRank);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Engine"),
|
||||
&kNC_Engine);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Price"),
|
||||
&kNC_Price);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Price?sort=true"),
|
||||
&kNC_PriceSort);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Availability"),
|
||||
&kNC_Availability);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "BookmarkSeparator"),
|
||||
&kNC_BookmarkSeparator);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Update"),
|
||||
&kNC_Update);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "UpdateIcon"),
|
||||
&kNC_UpdateIcon);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "UpdateCheckDays"),
|
||||
&kNC_UpdateCheckDays);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastPingDate"),
|
||||
&kWEB_LastPingDate);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastPingModDate"),
|
||||
&kWEB_LastPingModDate);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(WEB_NAMESPACE_URI "LastPingContentLen"),
|
||||
&kWEB_LastPingContentLen);
|
||||
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "command?cmd=addtobookmarks", &kNC_SearchCommand_AddToBookmarks);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "command?cmd=addquerytobookmarks", &kNC_SearchCommand_AddQueryToBookmarks);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "command?cmd=filterresult", &kNC_SearchCommand_FilterResult);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "command?cmd=filtersite", &kNC_SearchCommand_FilterSite);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "command?cmd=clearfilters", &kNC_SearchCommand_ClearFilters);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=addtobookmarks"),
|
||||
&kNC_SearchCommand_AddToBookmarks);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=addquerytobookmarks"),
|
||||
&kNC_SearchCommand_AddQueryToBookmarks);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=filterresult"),
|
||||
&kNC_SearchCommand_FilterResult);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=filtersite"),
|
||||
&kNC_SearchCommand_FilterSite);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "command?cmd=clearfilters"),
|
||||
&kNC_SearchCommand_ClearFilters);
|
||||
|
||||
gRDFService->GetLiteral(NS_LITERAL_STRING("true").get(), &kTrueLiteral);
|
||||
|
||||
|
@ -1066,7 +1115,7 @@ InternetSearchDataSource::GetTarget(nsIRDFResource *source,
|
|||
nsCOMPtr<nsIRDFResource> category;
|
||||
nsCAutoString caturiC;
|
||||
caturiC.AssignWithConversion(catURI);
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(caturiC.get(),
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(caturiC,
|
||||
getter_AddRefs(category))))
|
||||
return(rv);
|
||||
|
||||
|
@ -1185,7 +1234,7 @@ InternetSearchDataSource::GetTargets(nsIRDFResource *source,
|
|||
nsCOMPtr<nsIRDFResource> category;
|
||||
nsCAutoString caturiC;
|
||||
caturiC.AssignWithConversion(catURI);
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(caturiC.get(),
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(caturiC,
|
||||
getter_AddRefs(category))))
|
||||
return(rv);
|
||||
|
||||
|
@ -1309,7 +1358,7 @@ InternetSearchDataSource::GetCategoryList()
|
|||
categoryStr.AppendWithConversion(catResURI);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> searchCategoryRes;
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(categoryStr.get(),
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(categoryStr,
|
||||
getter_AddRefs(searchCategoryRes)))) break;
|
||||
|
||||
nsCOMPtr<nsIRDFContainer> categoryContainer;
|
||||
|
@ -1523,7 +1572,7 @@ InternetSearchDataSource::HasArcOut(nsIRDFResource *source, nsIRDFResource *aArc
|
|||
if (!uri) return(NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> category;
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(uri,
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(nsDependentCString(uri),
|
||||
getter_AddRefs(category))))
|
||||
return(rv);
|
||||
|
||||
|
@ -1616,7 +1665,7 @@ InternetSearchDataSource::ArcLabelsOut(nsIRDFResource *source,
|
|||
if (!uri) return(NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> category;
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(uri,
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(nsDependentCString(uri),
|
||||
getter_AddRefs(category))))
|
||||
return(rv);
|
||||
|
||||
|
@ -2481,7 +2530,7 @@ InternetSearchDataSource::GetInternetSearchURL(const char *searchEngineURI,
|
|||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIRDFResource> engine;
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(searchEngineURI, getter_AddRefs(engine))))
|
||||
if (NS_FAILED(rv = gRDFService->GetResource(nsDependentCString(searchEngineURI), getter_AddRefs(engine))))
|
||||
return(rv);
|
||||
if (!engine) return(NS_ERROR_UNEXPECTED);
|
||||
|
||||
|
@ -3113,7 +3162,7 @@ InternetSearchDataSource::BeginSearchRequest(nsIRDFResource *source, PRBool doNe
|
|||
#endif
|
||||
|
||||
nsCOMPtr<nsIRDFResource> engine;
|
||||
gRDFService->GetResource(baseFilename, getter_AddRefs(engine));
|
||||
gRDFService->GetResource(nsDependentCString(baseFilename), getter_AddRefs(engine));
|
||||
nsCRT::free(baseFilename);
|
||||
baseFilename = nsnull;
|
||||
if (!engine) continue;
|
||||
|
@ -4021,7 +4070,7 @@ InternetSearchDataSource::SaveEngineInfoIntoGraph(nsIFile *file, nsIFile *icon,
|
|||
searchURL.Append(NS_LITERAL_STRING(".src"));
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(searchURL.get(),
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(searchURL,
|
||||
getter_AddRefs(searchRes)))) return(rv);
|
||||
|
||||
// save the basename reference
|
||||
|
@ -4029,7 +4078,7 @@ InternetSearchDataSource::SaveEngineInfoIntoGraph(nsIFile *file, nsIFile *icon,
|
|||
{
|
||||
basename.InsertWithConversion(kURINC_SearchCategoryEngineBasenamePrefix, 0);
|
||||
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(basename.get(),
|
||||
if (NS_FAILED(rv = gRDFService->GetUnicodeResource(basename,
|
||||
getter_AddRefs(categoryRes)))) return(rv);
|
||||
|
||||
nsCOMPtr<nsIRDFLiteral> searchLiteral;
|
||||
|
@ -4112,7 +4161,7 @@ InternetSearchDataSource::SaveEngineInfoIntoGraph(nsIFile *file, nsIFile *icon,
|
|||
nsAutoString catList;
|
||||
catList.AssignWithConversion(kURINC_SearchCategoryPrefix);
|
||||
catList.AppendWithConversion(catURI);
|
||||
gRDFService->GetUnicodeResource(catList.get(), getter_AddRefs(catRes));
|
||||
gRDFService->GetUnicodeResource(catList, getter_AddRefs(catRes));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIRDFContainer> container;
|
||||
|
|
|
@ -102,14 +102,21 @@ LocalSearchDataSource::LocalSearchDataSource(void)
|
|||
|
||||
PR_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "child", &kNC_Child);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "Name", &kNC_Name);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "URL", &kNC_URL);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "FindObject", &kNC_FindObject);
|
||||
gRDFService->GetResource(NC_NAMESPACE_URI "pulse", &kNC_pulse);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "child"),
|
||||
&kNC_Child);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "Name"),
|
||||
&kNC_Name);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "URL"),
|
||||
&kNC_URL);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "FindObject"),
|
||||
&kNC_FindObject);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "pulse"),
|
||||
&kNC_pulse);
|
||||
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "instanceOf", &kRDF_InstanceOf);
|
||||
gRDFService->GetResource(RDF_NAMESPACE_URI "type", &kRDF_type);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "instanceOf"),
|
||||
&kRDF_InstanceOf);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
|
||||
&kRDF_type);
|
||||
|
||||
gLocalSearchDataSource = this;
|
||||
}
|
||||
|
@ -573,7 +580,7 @@ LocalSearchDataSource::parseFindURL(nsIRDFResource *u, nsISupportsArray *array)
|
|||
continue;
|
||||
|
||||
nsCOMPtr<nsIRDFResource> property;
|
||||
rv = gRDFService->GetUnicodeResource(tokens[1].value.get(),
|
||||
rv = gRDFService->GetUnicodeResource(tokens[1].value,
|
||||
getter_AddRefs(property));
|
||||
|
||||
if (NS_FAILED(rv) || (rv == NS_RDF_NO_VALUE) || !property)
|
||||
|
|
|
@ -95,8 +95,9 @@ nsUrlbarHistory::nsUrlbarHistory():mLength(0)
|
|||
//printf("$$$$ Got RDF SERVICE $$$$\n");
|
||||
res = gRDFService->GetDataSource("rdf:localstore", getter_AddRefs(mDataSource));
|
||||
|
||||
res = gRDFService->GetResource("http://home.netscape.com/NC-rdf#child", &kNC_CHILD);
|
||||
res = gRDFService->GetResource("nc:urlbar-history", &kNC_URLBARHISTORY);
|
||||
res = gRDFService->GetResource(NS_LITERAL_CSTRING("http://home.netscape.com/NC-rdf#child"),
|
||||
&kNC_CHILD);
|
||||
res = gRDFService->GetResource(NS_LITERAL_CSTRING("nc:urlbar-history"), &kNC_URLBARHISTORY);
|
||||
}
|
||||
// Get the pref service
|
||||
res = nsServiceManager::GetService(kPrefServiceCID, NS_GET_IID(nsIPref),
|
||||
|
|
|
@ -72,9 +72,9 @@ nsWindowDataSource::Init()
|
|||
rv = CallGetService("@mozilla.org/rdf/rdf-service;1", &gRDFService);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
gRDFService->GetResource(kURINC_WindowRoot, &kNC_WindowRoot);
|
||||
gRDFService->GetResource(kURINC_Name, &kNC_Name);
|
||||
gRDFService->GetResource(kURINC_KeyIndex, &kNC_KeyIndex);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_WindowRoot), &kNC_WindowRoot);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_Name), &kNC_Name);
|
||||
gRDFService->GetResource(NS_LITERAL_CSTRING(kURINC_KeyIndex), &kNC_KeyIndex);
|
||||
}
|
||||
|
||||
mInner = do_CreateInstance("@mozilla.org/rdf/datasource;1?name=in-memory-datasource", &rv);
|
||||
|
@ -225,7 +225,7 @@ nsWindowDataSource::OnOpenWindow(nsIXULWindow *window)
|
|||
windowId.AppendInt(windowCount++, 10);
|
||||
|
||||
nsCOMPtr<nsIRDFResource> windowResource;
|
||||
gRDFService->GetResource(windowId.get(), getter_AddRefs(windowResource));
|
||||
gRDFService->GetResource(windowId, getter_AddRefs(windowResource));
|
||||
|
||||
nsVoidKey key(window);
|
||||
mWindowResources.Put(&key, windowResource);
|
||||
|
@ -355,7 +355,8 @@ nsWindowDataSource::GetWindowForResource(const char *aResourceString,
|
|||
nsIDOMWindowInternal** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIRDFResource> windowResource;
|
||||
gRDFService->GetResource(aResourceString, getter_AddRefs(windowResource));
|
||||
gRDFService->GetResource(nsDependentCString(aResourceString),
|
||||
getter_AddRefs(windowResource));
|
||||
|
||||
// now reverse-lookup in the hashtable
|
||||
findWindowClosure closure = { windowResource.get(), nsnull };
|
||||
|
|
Загрузка…
Ссылка в новой задаче