Merge mozilla-central to mozilla-inbound

This commit is contained in:
Ed Morley 2013-03-25 17:02:36 +00:00
commit 2d3e3ded1e
56 changed files with 242 additions and 583 deletions

View File

@ -542,9 +542,9 @@
key="focusChatBar"
command="Social:FocusChat"
class="show-only-for-keyboard"/>
<menuitem class="social-toggle-menuitem" command="Social:Toggle"/>
<menuseparator class="social-statusarea-separator"/>
<menuseparator class="social-provider-menu" hidden="true"/>
<menuitem class="social-toggle-menuitem" command="Social:Toggle"/>
<menuitem class="social-addons-menuitem" command="Social:Addons"
label="&social.addons.label;"/>
</menupopup>

View File

@ -170,12 +170,12 @@ let SocialUI = {
},
_updateMenuItems: function () {
if (!Social.provider)
let provider = Social.provider || Social.defaultProvider;
if (!provider)
return;
// The View->Sidebar and Menubar->Tools menu.
for (let id of ["menu_socialSidebar", "menu_socialAmbientMenu"])
document.getElementById(id).setAttribute("label", Social.provider.name);
document.getElementById(id).setAttribute("label", provider.name);
},
// This handles "ActivateSocialFeature" events fired against content documents

View File

@ -721,9 +721,9 @@
command="Social:ToggleNotifications"
label="&social.toggleNotifications.label;"
accesskey="&social.toggleNotifications.accesskey;"/>
<menuitem class="social-toggle-menuitem" command="Social:Toggle"/>
<menuseparator class="social-statusarea-separator"/>
<menuseparator class="social-provider-menu" hidden="true"/>
<menuitem class="social-toggle-menuitem" command="Social:Toggle"/>
<menuitem class="social-addons-menuitem" command="Social:Addons"
label="&social.addons.label;"/>
</menupopup>

View File

@ -282,7 +282,7 @@ PlacesViewBase.prototype = {
}
else {
let itemId = aPlacesNode.itemId;
if (PlacesUtils.uriTypes.indexOf(type) != -1) {
if (type == Ci.nsINavHistoryResultNode.RESULT_TYPE_URI) {
element = document.createElement("menuitem");
element.className = "menuitem-iconic bookmark-item menuitem-with-favicon";
element.setAttribute("scheme",

View File

@ -459,7 +459,6 @@ PlacesController.prototype = {
nodeData["separator"] = true;
break;
case Ci.nsINavHistoryResultNode.RESULT_TYPE_URI:
case Ci.nsINavHistoryResultNode.RESULT_TYPE_VISIT:
nodeData["link"] = true;
uri = NetUtil.newURI(node.uri);
if (PlacesUtils.nodeIsBookmark(node)) {

View File

@ -768,7 +768,7 @@ var PlacesSearchBox = {
query.searchTerms = filterString;
var options = currentOptions.clone();
// Make sure we're getting uri results.
options.resultType = currentOptions.RESULT_TYPE_URI;
options.resultType = currentOptions.RESULTS_AS_URI;
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
options.includeHidden = true;
currentView.load([query], options);
@ -784,7 +784,7 @@ var PlacesSearchBox = {
query.setTransitions([Ci.nsINavHistoryService.TRANSITION_DOWNLOAD], 1);
let options = currentOptions.clone();
// Make sure we're getting uri results.
options.resultType = currentOptions.RESULT_TYPE_URI;
options.resultType = currentOptions.RESULTS_AS_URI;
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
options.includeHidden = true;
currentView.load([query], options);

View File

@ -75,7 +75,7 @@
if (PlacesUtils.nodeIsHistoryContainer(queryNode) ||
options.resultType == options.RESULTS_AS_TAG_QUERY ||
options.resultType == options.RESULTS_AS_TAG_CONTENTS)
options.resultType = options.RESULT_TYPE_URI;
options.resultType = options.RESULTS_AS_URI;
var query = PlacesUtils.history.getNewQuery();
query.searchTerms = filterString;

View File

@ -675,7 +675,7 @@ this.PlacesUIUtils = {
getBestTitle: function PUIU_getBestTitle(aNode, aDoNotCutTitle) {
var title;
if (!aNode.title && PlacesUtils.uriTypes.indexOf(aNode.type) != -1) {
if (!aNode.title && PlacesUtils.nodeIsURI(aNode)) {
// if node title is empty, try to set the label using host and filename
// PlacesUtils._uri() will throw if aNode.uri is not a valid URI
try {

View File

@ -123,7 +123,7 @@ function propertyPanelShown(aPanel)
// NB: We pull the properties off the prototype, rather than off object itself,
// so that expandos like |constructor|, which the propPanel can't see, are not
// included.
for (let prop in Object.getPrototypeOf(content.document)) {
for (let prop in Object.getPrototypeOf(content.document).wrappedObject) {
if (prop == "inputEncoding") {
continue;
}

View File

@ -173,9 +173,7 @@ BookmarksView.prototype = {
let node = rootNode.getChild(i);
// Ignore folders, separators, undefined item types, etc.
if (node.type != node.RESULT_TYPE_URI &&
node.type != node.RESULT_TYPE_VISIT &&
node.type != node.RESULT_TYPE_FULL_VISIT)
if (node.type != node.RESULT_TYPE_URI)
continue;
this.addBookmark(node.itemId);

View File

@ -1996,13 +1996,6 @@ public:
static nsresult Atob(const nsAString& aAsciiString,
nsAString& aBinaryData);
/** If aJSArray is a Javascript array, this method iterates over its
* elements and appends values to aRetVal as nsIAtoms.
* @throw NS_ERROR_ILLEGAL_VALUE if aJSArray isn't a JS array.
*/
static nsresult JSArrayToAtomArray(JSContext* aCx, const JS::Value& aJSArray,
nsCOMArray<nsIAtom>& aRetVal);
/**
* Returns whether the input element passed in parameter has the autocomplete
* functionality enabled. It is taking into account the form owner.

View File

@ -79,7 +79,7 @@ interface nsIXMLHttpRequestUpload : nsIXMLHttpRequestEventTarget {
* you're aware of all the security implications. And then think twice about
* it.
*/
[scriptable, uuid(8e9768b4-339c-413c-a210-0c74934eb9e1)]
[scriptable, uuid(cd31a34e-71b5-4bea-8366-c926de9d3d62)]
interface nsIXMLHttpRequest : nsISupports
{
/**

View File

@ -6706,46 +6706,6 @@ nsContentUtils::TraceWrapper(nsWrapperCache* aCache, TraceCallback aCallback,
}
}
nsresult
nsContentUtils::JSArrayToAtomArray(JSContext* aCx, const JS::Value& aJSArray,
nsCOMArray<nsIAtom>& aRetVal)
{
JSAutoRequest ar(aCx);
if (!aJSArray.isObject()) {
return NS_ERROR_ILLEGAL_VALUE;
}
JSObject* obj = &aJSArray.toObject();
JSAutoCompartment ac(aCx, obj);
uint32_t length;
if (!JS_IsArrayObject(aCx, obj) || !JS_GetArrayLength(aCx, obj, &length)) {
return NS_ERROR_ILLEGAL_VALUE;
}
JSString* str = nullptr;
JS::Anchor<JSString *> deleteProtector(str);
for (uint32_t i = 0; i < length; ++i) {
jsval v;
if (!JS_GetElement(aCx, obj, i, &v) ||
!(str = JS_ValueToString(aCx, v))) {
return NS_ERROR_ILLEGAL_VALUE;
}
nsDependentJSString depStr;
if (!depStr.init(aCx, str)) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsCOMPtr<nsIAtom> a = do_GetAtom(depStr);
if (!a) {
return NS_ERROR_OUT_OF_MEMORY;
}
aRetVal.AppendObject(a);
}
return NS_OK;
}
// static
void
nsContentUtils::GetSelectionInTextControl(Selection* aSelection,

View File

@ -1565,7 +1565,7 @@ nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttr
if (value && value->Type() == nsAttrValue::eEnum) {
int32_t align = value->GetEnumValue();
if (aRuleData->mSIDs & NS_STYLE_INHERIT_BIT(Display)) {
nsCSSValue* cssFloat = aRuleData->ValueForCssFloat();
nsCSSValue* cssFloat = aRuleData->ValueForFloat();
if (cssFloat->GetUnit() == eCSSUnit_Null) {
if (align == NS_STYLE_TEXT_ALIGN_LEFT) {
cssFloat->SetIntValue(NS_STYLE_FLOAT_LEFT, eCSSUnit_Enumerated);

View File

@ -2081,8 +2081,6 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
return NS_OK;
}
pluginTag->SetHost(this);
// Add plugin tags such that the list is ordered by modification date,
// newest to oldest. This is ugly, it'd be easier with just about anything
// other than a single-directional linked list.

View File

@ -74,8 +74,7 @@ NS_IMPL_ISUPPORTS1(DOMMimeTypeImpl, nsIDOMMimeType)
/* nsPluginTag */
nsPluginTag::nsPluginTag(nsPluginTag* aPluginTag)
: mPluginHost(nullptr),
mName(aPluginTag->mName),
: mName(aPluginTag->mName),
mDescription(aPluginTag->mDescription),
mMimeTypes(aPluginTag->mMimeTypes),
mMimeDescriptions(aPluginTag->mMimeDescriptions),
@ -92,8 +91,7 @@ mNiceFileName()
}
nsPluginTag::nsPluginTag(nsPluginInfo* aPluginInfo)
: mPluginHost(nullptr),
mName(aPluginInfo->fName),
: mName(aPluginInfo->fName),
mDescription(aPluginInfo->fDescription),
mLibrary(nullptr),
mIsJavaPlugin(false),
@ -122,8 +120,7 @@ nsPluginTag::nsPluginTag(const char* aName,
int32_t aVariants,
int64_t aLastModifiedTime,
bool aArgsAreUTF8)
: mPluginHost(nullptr),
mName(aName),
: mName(aName),
mDescription(aDescription),
mLibrary(nullptr),
mIsJavaPlugin(false),
@ -276,11 +273,6 @@ nsresult nsPluginTag::EnsureMembersAreUTF8()
#endif
}
void nsPluginTag::SetHost(nsPluginHost * aHost)
{
mPluginHost = aHost;
}
NS_IMETHODIMP
nsPluginTag::GetDescription(nsACString& aDescription)
{
@ -344,7 +336,9 @@ nsPluginTag::SetEnabled(bool enabled)
SetPluginState(ePluginState_Enabled);
}
mPluginHost->UpdatePluginInfo(this);
if (nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst()) {
host->UpdatePluginInfo(this);
}
}
NS_IMETHODIMP
@ -388,7 +382,9 @@ nsPluginTag::SetBlocklisted(bool blocklisted)
Preferences::ClearUser(pref.get());
}
mPluginHost->UpdatePluginInfo(this);
if (nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst()) {
host->UpdatePluginInfo(this);
}
return NS_OK;
}
@ -418,7 +414,9 @@ nsPluginTag::SetClicktoplay(bool clicktoplay)
SetPluginState(ePluginState_Clicktoplay);
}
mPluginHost->UpdatePluginInfo(this);
if (nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst()) {
host->UpdatePluginInfo(this);
}
return NS_OK;
}

View File

@ -48,7 +48,6 @@ public:
bool aArgsAreUTF8 = false);
virtual ~nsPluginTag();
void SetHost(nsPluginHost * aHost);
void TryUnloadPlugin(bool inShutdown);
// plugin is enabled and not blocklisted
@ -69,7 +68,6 @@ public:
nsCString GetNiceFileName();
nsRefPtr<nsPluginTag> mNext;
nsPluginHost *mPluginHost;
nsCString mName; // UTF-8
nsCString mDescription; // UTF-8
nsTArray<nsCString> mMimeTypes; // UTF-8

View File

@ -141,6 +141,7 @@ MOCHITEST_FILES = \
test_bug817476.html \
test_bug823173.html \
test_bug850517.html \
test_bug848088.html \
$(NULL)
ifneq (Linux,$(OS_ARCH))

View File

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=848088
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 848088</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/** Test for Bug 848088 **/
function test(loopFor, setExpandoAt)
{
var list = document.getElementsByTagName("audio");
delete list.length;
var shouldHaveExpando = false;
var realLength = list.length;
for (var i = 0; i < loopFor; ++i) {
if (i == setExpandoAt) {
// Add an expando that shadows.
Object.defineProperty(list, "length", { value: "a" });
shouldHaveExpando = true;
}
var hasExpando = (list.length != realLength);
if (shouldHaveExpando != hasExpando) {
return false;
}
}
return true;
}
ok(test(200000, 100000), "Correctly detected expando on DOM list object");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=848088">Mozilla Bug 848088</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

View File

@ -12,13 +12,13 @@
DO_PROP(method, pref)
#define CSS_PROP_SHORTHAND(name, id, method, flags, pref) \
DO_PROP(method, pref)
#define CSS_PROP_DOMPROP_PREFIXED(val) Moz##val
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
#define CSS_PROP_LIST_EXCLUDE_INTERNAL
#include "nsCSSPropList.h"
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
#undef CSS_PROP_DOMPROP_PREFIXED
#undef CSS_PROP_PUBLIC_OR_PRIVATE
#undef CSS_PROP_SHORTHAND
#undef CSS_PROP

View File

@ -483,24 +483,20 @@ struct GetNativePropertyStub
JS_ASSERT_IF(expando, expando->isNative() && expando->getProto() == NULL);
masm.loadValue(expandoAddr, tempVal);
if (expando && expando->nativeLookup(cx, propName)) {
// Reference object has an expando that doesn't define the name.
// Check incoming object's expando and make sure it's an object.
// If checkExpando is true, we'll temporarily use register(s) for a ValueOperand.
// If we do that, we save the register(s) on stack before use and pop them
// on both exit paths.
// If the incoming object does not have an expando object then we're sure we're not
// shadowing.
masm.branchTestUndefined(Assembler::Equal, tempVal, &listBaseOk);
if (expando && !expando->nativeContains(cx, propName)) {
// Reference object has an expando object that doesn't define the name. Check that
// the incoming object has an expando object with the same shape.
masm.branchTestObject(Assembler::NotEqual, tempVal, &failListBaseCheck);
masm.extractObject(tempVal, tempVal.scratchReg());
masm.branchPtr(Assembler::Equal,
Address(tempVal.scratchReg(), JSObject::offsetOfShape()),
ImmGCPtr(expando->lastProperty()),
&listBaseOk);
} else {
// Reference object has no expando. Check incoming object and ensure
// it has no expando.
masm.branchTestUndefined(Assembler::Equal, tempVal, &listBaseOk);
}
// Failure case: restore the tempVal registers and jump to failures.

View File

@ -1300,7 +1300,7 @@ class GetPropCompiler : public PICStubCompiler
// that will complicate property lookups on them.
JS_ASSERT_IF(expando, expando->isNative() && expando->getProto() == NULL);
if (expando && expando->nativeLookup(cx, name) == NULL) {
if (expando && !expando->nativeContains(cx, name)) {
Jump expandoGuard = masm.testObject(Assembler::NotEqual, expandoAddress);
if (!shapeMismatches.append(expandoGuard))
return error();

View File

@ -24,9 +24,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500931
function go() {
var ifr = document.getElementById("ifr");
var doc = ifr.contentDocument;
ok(doc.toString().indexOf("XrayWrapper") >= 0, "doc is an XrayWrapper");
ok(Components.utils.isXrayWrapper(doc), "doc is an XrayWrapper");
var weak = Components.utils.getWeakReference(doc);
ok(weak.get().toString().indexOf("XrayWrapper") >= 0, "weak reference returns a wrapper");
ok(Components.utils.isXrayWrapper(weak.get()), "weak reference returns a wrapper");
SimpleTest.finish();
}

View File

@ -10,8 +10,8 @@ function a() {
l();
return "a";
};
var f = SpecialPowers.Components.lookupMethod(document, "title");
setTimeout(f, 0, o);
var f = Object.getOwnPropertyDescriptor(Document.prototype, "title").set;
setTimeout(f.bind(document), 0, o);
}
function l() {

View File

@ -332,9 +332,9 @@ struct nsPresArena::State {
// LIFO behavior for best cache utilization
result = list->mEntries.ElementAt(len - 1);
list->mEntries.RemoveElementAt(len - 1);
MOZ_MAKE_MEM_UNDEFINED(result, list->mEntrySize);
#if defined(DEBUG)
{
MOZ_MAKE_MEM_DEFINED(result, list->mEntrySize);
char* p = reinterpret_cast<char*>(result);
char* limit = p + list->mEntrySize;
for (; p < limit; p += sizeof(uintptr_t)) {
@ -351,6 +351,7 @@ struct nsPresArena::State {
}
}
#endif
MOZ_MAKE_MEM_UNDEFINED(result, list->mEntrySize);
return result;
}

View File

@ -32,10 +32,12 @@
-. 'method' is designed to be as input for CSS2Properties and similar
callers. It must always be the same as 'name' except it must use
InterCaps and all hyphens ('-') must be removed. Callers using this
parameter must also define the CSS_PROP_DOMPROP_PREFIXED(prop) macro,
either to be Moz ## prop or to just be prop, depending on whether they
want Moz prefixes or not (i.e., whether the use is for internal use
such as nsRuleData::ValueFor* or external use).
parameter must also define the CSS_PROP_PUBLIC_OR_PRIVATE(publicname_,
privatename_) macro to yield either publicname_ or privatename_.
The names differ in that publicname_ has Moz prefixes where they are
used, and also in CssFloat vs. Float. The caller's choice depends on
whether the use is for internal use such as eCSSProperty_* or
nsRuleData::ValueFor* or external use such as exposing DOM properties.
-. 'pref' is the name of a pref that controls whether the property
is enabled. The property is enabled if 'pref' is an empty string,
@ -76,6 +78,9 @@
#define DEFINED_CSS_PROP_SHORTHAND
#endif
#define CSS_PROP_DOMPROP_PREFIXED(name_) \
CSS_PROP_PUBLIC_OR_PRIVATE(Moz ## name_, name_)
#define CSS_PROP_NO_OFFSET (-1)
// Callers may define CSS_PROP_LIST_EXCLUDE_INTERNAL if they want to
@ -1654,7 +1659,7 @@ CSS_PROP_POSITION(
CSS_PROP_DISPLAY(
float,
float,
CssFloat,
CSS_PROP_PUBLIC_OR_PRIVATE(CssFloat, Float),
CSS_PROPERTY_PARSE_VALUE |
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER,
"",
@ -3640,3 +3645,5 @@ CSS_PROP_TABLE(
#undef CSS_PROP_SHORTHAND
#undef DEFINED_CSS_PROP_SHORTHAND
#endif
#undef CSS_PROP_DOMPROP_PREFIXED

View File

@ -2259,7 +2259,7 @@ static const nsCSSProperty gMozTransformSubpropTable[] = {
const nsCSSProperty *const
nsCSSProps::kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands] = {
#define CSS_PROP_DOMPROP_PREFIXED(prop_) prop_
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_
// Need an extra level of macro nesting to force expansion of method_
// params before they get pasted.
#define NSCSSPROPS_INNER_MACRO(method_) g##method_##SubpropTable,
@ -2268,7 +2268,7 @@ nsCSSProps::kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shortha
#include "nsCSSPropList.h"
#undef CSS_PROP_SHORTHAND
#undef NSCSSPROPS_INNER_MACRO
#undef CSS_PROP_DOMPROP_PREFIXED
#undef CSS_PROP_PUBLIC_OR_PRIVATE
};

View File

@ -638,7 +638,7 @@ nsComputedDOMStyle::DoGetClear()
}
CSSValue*
nsComputedDOMStyle::DoGetCssFloat()
nsComputedDOMStyle::DoGetFloat()
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mFloats,
@ -4766,7 +4766,7 @@ nsComputedDOMStyle::GetQueryablePropertyMap(uint32_t* aLength)
COMPUTED_STYLE_MAP_ENTRY(flex_grow, FlexGrow),
COMPUTED_STYLE_MAP_ENTRY(flex_shrink, FlexShrink),
#endif // MOZ_FLEXBOX
COMPUTED_STYLE_MAP_ENTRY(float, CssFloat),
COMPUTED_STYLE_MAP_ENTRY(float, Float),
//// COMPUTED_STYLE_MAP_ENTRY(font, Font),
COMPUTED_STYLE_MAP_ENTRY(font_family, FontFamily),
COMPUTED_STYLE_MAP_ENTRY(font_size, FontSize),

View File

@ -323,7 +323,7 @@ private:
/* Display properties */
mozilla::dom::CSSValue* DoGetBinding();
mozilla::dom::CSSValue* DoGetClear();
mozilla::dom::CSSValue* DoGetCssFloat();
mozilla::dom::CSSValue* DoGetFloat();
mozilla::dom::CSSValue* DoGetDisplay();
mozilla::dom::CSSValue* DoGetPosition();
mozilla::dom::CSSValue* DoGetClip();

View File

@ -60,7 +60,7 @@ public:
NS_IMETHOD GetParentRule(nsIDOMCSSRule * *aParentRule) MOZ_OVERRIDE = 0;
// WebIDL interface for CSS2Properties
#define CSS_PROP_DOMPROP_PREFIXED(prop_) Moz ## prop_
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
void \
@ -88,7 +88,7 @@ public:
#undef CSS_PROP_SHORTHAND
#undef CSS_PROP_LIST_EXCLUDE_INTERNAL
#undef CSS_PROP
#undef CSS_PROP_DOMPROP_PREFIXED
#undef CSS_PROP_PUBLIC_OR_PRIVATE
virtual void IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aPropName);

View File

@ -91,7 +91,7 @@ struct nsRuleData
* Like ValueFor(), the caller must check that the property is within
* mSIDs.
*/
#define CSS_PROP_DOMPROP_PREFIXED(prop_) prop_
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) privatename_
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, \
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
nsCSSValue* ValueFor##method_() { \
@ -114,7 +114,7 @@ struct nsRuleData
/* empty; backend-only structs are not in nsRuleData */
#include "nsCSSPropList.h"
#undef CSS_PROP
#undef CSS_PROP_DOMPROP_PREFIXED
#undef CSS_PROP_PUBLIC_OR_PRIVATE
#undef CSS_PROP_BACKENDONLY
private:

View File

@ -4781,7 +4781,7 @@ nsRuleNode::ComputeDisplayData(void* aStartStruct,
NS_STYLE_PAGE_BREAK_AUTO, 0, 0, 0, 0);
// float: enum, inherit, initial
SetDiscrete(*aRuleData->ValueForCssFloat(),
SetDiscrete(*aRuleData->ValueForFloat(),
display->mFloats, canStoreInRuleTree,
SETDSC_ENUMERATED, parentDisplay->mFloats,
NS_STYLE_FLOAT_NONE, 0, 0, 0, 0);

View File

@ -17,7 +17,7 @@ struct PropertyInfo {
const PropertyInfo gLonghandProperties[] = {
#define CSS_PROP_DOMPROP_PREFIXED(prop_) Moz ## prop_
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
#define CSS_PROP(name_, id_, method_, flags_, pref_, parsevariant_, kwtable_, \
stylestruct_, stylestructoffset_, animtype_) \
{ #name_, #method_, pref_ },
@ -25,7 +25,7 @@ const PropertyInfo gLonghandProperties[] = {
#include "nsCSSPropList.h"
#undef CSS_PROP
#undef CSS_PROP_DOMPROP_PREFIXED
#undef CSS_PROP_PUBLIC_OR_PRIVATE
};
@ -50,7 +50,7 @@ const char* gLonghandPropertiesWithDOMProp[] = {
const PropertyInfo gShorthandProperties[] = {
#define CSS_PROP_DOMPROP_PREFIXED(prop_) Moz ## prop_
#define CSS_PROP_PUBLIC_OR_PRIVATE(publicname_, privatename_) publicname_
// Need an extra level of macro nesting to force expansion of method_
// params before they get pasted.
#define LISTCSSPROPERTIES_INNER_MACRO(method_) #method_
@ -61,7 +61,7 @@ const PropertyInfo gShorthandProperties[] = {
#undef CSS_PROP_SHORTHAND
#undef LISTCSSPROPERTIES_INNER_MACRO
#undef CSS_PROP_DOMPROP_PREFIXED
#undef CSS_PROP_PUBLIC_OR_PRIVATE
#define CSS_PROP_ALIAS(name_, id_, method_, pref_) \
{ #name_, #method_, pref_ },

View File

@ -344,7 +344,7 @@ public class UpdateService extends IntentService {
private MessageDigest createMessageDigest(String hashFunction) {
String javaHashFunction = null;
if ("sha512".equals(hashFunction)) {
if ("sha512".equalsIgnoreCase(hashFunction)) {
javaHashFunction = "SHA-512";
} else {
Log.e(LOGTAG, "Unhandled hash function: " + hashFunction);

View File

@ -3375,7 +3375,6 @@ Tab.prototype = {
viewportW = screenW;
viewportH = screenH;
}
console.log("Use autosize: " + viewportW + "x" + viewportH);
} else {
viewportW = metadata.width;
viewportH = metadata.height;
@ -3384,9 +3383,7 @@ Tab.prototype = {
let maxInitialZoom = metadata.defaultZoom || metadata.maxZoom;
if (maxInitialZoom && viewportW) {
viewportW = Math.max(viewportW, screenW / maxInitialZoom);
console.log("Use max: " + viewportW + " or " + (screenW / maxInitialZoom));
}
console.log("Use max: " + viewportW + " or " + (screenW / maxInitialZoom));
let validW = viewportW > 0;
let validH = viewportH > 0;

View File

@ -721,6 +721,13 @@ Database::InitSchema(bool* aDatabaseMigrated)
// Firefox 14 uses schema version 21.
if (currentSchemaVersion < 22) {
rv = MigrateV22Up();
NS_ENSURE_SUCCESS(rv, rv);
}
// Firefox 22 uses schema version 22.
// Schema Upgrades must add migration code here.
rv = UpdateBookmarkRootTitles();
@ -1873,6 +1880,21 @@ Database::MigrateV21Up()
return NS_OK;
}
nsresult
Database::MigrateV22Up()
{
MOZ_ASSERT(NS_IsMainThread());
// Reset all session IDs to 0 since we don't support them anymore.
// We don't set them to NULL to avoid breaking downgrades.
nsresult rv = mMainConn->ExecuteSimpleSQL(NS_LITERAL_CSTRING(
"UPDATE moz_historyvisits SET session = 0"
));
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
}
void
Database::Shutdown()
{

View File

@ -15,7 +15,7 @@
// This is the schema version. Update it at any schema change and add a
// corresponding migrateVxx method below.
#define DATABASE_SCHEMA_VERSION 21
#define DATABASE_SCHEMA_VERSION 22
// Fired after Places inited.
#define TOPIC_PLACES_INIT_COMPLETE "places-init-complete"
@ -272,6 +272,7 @@ protected:
nsresult MigrateV19Up();
nsresult MigrateV20Up();
nsresult MigrateV21Up();
nsresult MigrateV22Up();
nsresult UpdateBookmarkRootTitles();
nsresult CheckAndUpdateGUIDs();

View File

@ -69,7 +69,6 @@ struct VisitData {
VisitData()
: placeId(0)
, visitId(0)
, sessionId(0)
, hidden(true)
, typed(false)
, transitionType(UINT32_MAX)
@ -85,7 +84,6 @@ struct VisitData {
nsIURI* aReferrer = NULL)
: placeId(0)
, visitId(0)
, sessionId(0)
, hidden(true)
, typed(false)
, transitionType(UINT32_MAX)
@ -138,7 +136,6 @@ struct VisitData {
int64_t placeId;
nsCString guid;
int64_t visitId;
int64_t sessionId;
nsCString spec;
nsString revHost;
bool hidden;
@ -516,9 +513,8 @@ public:
// to the database, thus cannot be queried and we don't notify them.
if (mPlace.transitionType != nsINavHistoryService::TRANSITION_EMBED) {
navHistory->NotifyOnVisit(uri, mPlace.visitId, mPlace.visitTime,
mPlace.sessionId, mReferrer.visitId,
mPlace.transitionType, mPlace.guid,
mPlace.hidden);
mReferrer.visitId, mPlace.transitionType,
mPlace.guid, mPlace.hidden);
}
nsCOMPtr<nsIObserverService> obsService =
@ -612,7 +608,7 @@ public:
nsCOMPtr<mozIVisitInfo> visit =
new VisitInfo(mPlace.visitId, mPlace.visitTime, mPlace.transitionType,
referrerURI.forget(), mPlace.sessionId);
referrerURI.forget());
PlaceInfo::VisitsArray visits;
(void)visits.AppendElement(visit);
@ -841,26 +837,6 @@ private:
for (nsTArray<VisitData>::size_type i = 0; i < mPlaces.Length(); i++) {
mReferrers[i].spec = mPlaces[i].referrerSpec;
// If we are inserting a place into an empty mPlaces array, we need to
// check to make sure we do not store a bogus session id that is higher
// than the current maximum session id.
if (i == 0) {
int64_t newSessionId = navHistory->GetNewSessionID();
if (mPlaces[0].sessionId > newSessionId) {
mPlaces[0].sessionId = newSessionId;
}
}
// Speculatively get a new session id for our visit if the current session
// id is non-valid or if it is larger than the current largest session id.
// While it is true that we will use the session id from the referrer if
// the visit was "recent" enough, we cannot call this method off of the
// main thread, so we have to consume an id now.
if (mPlaces[i].sessionId <= 0 ||
(i > 0 && mPlaces[i].sessionId >= mPlaces[0].sessionId)) {
mPlaces[i].sessionId = navHistory->GetNewSessionID();
}
#ifdef DEBUG
nsCOMPtr<nsIURI> uri;
(void)NS_NewURI(getter_AddRefs(uri), mPlaces[i].spec);
@ -953,7 +929,7 @@ private:
// If we have a visitTime, we want information on that specific visit.
if (_place.visitTime) {
stmt = mHistory->GetStatement(
"SELECT id, session, visit_date "
"SELECT id, visit_date "
"FROM moz_historyvisits "
"WHERE place_id = (SELECT id FROM moz_places WHERE url = :page_url) "
"AND visit_date = :visit_date "
@ -970,7 +946,7 @@ private:
// Otherwise, we want information about the most recent visit.
else {
stmt = mHistory->GetStatement(
"SELECT id, session, visit_date "
"SELECT id, visit_date "
"FROM moz_historyvisits "
"WHERE place_id = (SELECT id FROM moz_places WHERE url = :page_url) "
"ORDER BY visit_date DESC "
@ -992,9 +968,7 @@ private:
rv = stmt->GetInt64(0, &_place.visitId);
NS_ENSURE_SUCCESS(rv, false);
rv = stmt->GetInt64(1, &_place.sessionId);
NS_ENSURE_SUCCESS(rv, false);
rv = stmt->GetInt64(2, reinterpret_cast<int64_t*>(&_place.visitTime));
rv = stmt->GetInt64(1, reinterpret_cast<int64_t*>(&_place.visitTime));
NS_ENSURE_SUCCESS(rv, false);
// If we have been given a visit threshold start time, go ahead and
@ -1008,8 +982,8 @@ private:
}
/**
* Fetches information about a referrer and sets the session id for aPlace if
* it was a recent visit or not.
* Fetches information about a referrer for aPlace if it was a recent
* visit or not.
*
* @param aReferrer
* The VisitData for the referrer. This will be populated with
@ -1025,17 +999,7 @@ private:
return;
}
// If we had a referrer, we want to know about its last visit to put this
// new visit into the same session.
bool recentVisit = FetchVisitInfo(aReferrer, aPlace.visitTime);
// At this point, we know the referrer's session id, which this new visit
// should also share.
if (recentVisit) {
aPlace.sessionId = aReferrer.sessionId;
}
// However, if it isn't recent enough, we don't care to log anything about
// the referrer and we'll start a new session.
else {
if (!FetchVisitInfo(aReferrer, aPlace.visitTime)) {
// We must change both the place and referrer to indicate that we will
// not be using the referrer's data. This behavior has test coverage, so
// if this invariant changes, we'll know.
@ -1061,7 +1025,7 @@ private:
stmt = mHistory->GetStatement(
"INSERT INTO moz_historyvisits "
"(from_visit, place_id, visit_date, visit_type, session) "
"VALUES (:from_visit, :page_id, :visit_date, :visit_type, :session) "
"VALUES (:from_visit, :page_id, :visit_date, :visit_type, 0) "
);
NS_ENSURE_STATE(stmt);
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("page_id"), _place.placeId);
@ -1071,7 +1035,7 @@ private:
stmt = mHistory->GetStatement(
"INSERT INTO moz_historyvisits "
"(from_visit, place_id, visit_date, visit_type, session) "
"VALUES (:from_visit, (SELECT id FROM moz_places WHERE url = :page_url), :visit_date, :visit_type, :session) "
"VALUES (:from_visit, (SELECT id FROM moz_places WHERE url = :page_url), :visit_date, :visit_type, 0) "
);
NS_ENSURE_STATE(stmt);
rv = URIBinder::Bind(stmt, NS_LITERAL_CSTRING("page_url"), _place.spec);
@ -1090,9 +1054,6 @@ private:
rv = stmt->BindInt32ByName(NS_LITERAL_CSTRING("visit_type"),
transitionType);
NS_ENSURE_SUCCESS(rv, rv);
rv = stmt->BindInt64ByName(NS_LITERAL_CSTRING("session"),
_place.sessionId);
NS_ENSURE_SUCCESS(rv, rv);
mozStorageStatementScoper scoper(stmt);
rv = stmt->Execute();
@ -2645,15 +2606,6 @@ History::UpdatePlaces(const JS::Value& aPlaceInfos,
continue;
}
// The session id is optional.
rv = GetIntFromJSObject(aCtx, visit, "sessionId", &data.sessionId);
if (rv == NS_ERROR_INVALID_ARG) {
data.sessionId = 0;
}
else {
NS_ENSURE_SUCCESS(rv, rv);
}
// The referrer is optional.
nsCOMPtr<nsIURI> referrer = GetURIFromJSObject(aCtx, visit,
"referrerURI");

View File

@ -44,6 +44,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/commonjs/sdk/core/promise.js");
XPCOMUtils.defineLazyModuleGetter(this, "Deprecated",
"resource://gre/modules/Deprecated.jsm");
// The minimum amount of transactions before starting a batch. Usually we do
// do incremental updates, a batch will cause views to completely
// refresh instead.
@ -67,7 +70,12 @@ function QI_node(aNode, aIID) {
}
return result;
}
function asVisit(aNode) QI_node(aNode, Ci.nsINavHistoryVisitResultNode);
function asVisit(aNode) {
Deprecated.warning(
"asVisit is deprecated and will be removed in a future version",
"https://bugzilla.mozilla.org/show_bug.cgi?id=561450");
return aNode;
};
function asContainer(aNode) QI_node(aNode, Ci.nsINavHistoryContainerResultNode);
function asQuery(aNode) QI_node(aNode, Ci.nsINavHistoryQueryResultNode);
@ -171,8 +179,7 @@ this.PlacesUtils = {
* @returns true if the node is a Bookmark separator, false otherwise
*/
nodeIsSeparator: function PU_nodeIsSeparator(aNode) {
return (aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR);
return aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR;
},
/**
@ -182,8 +189,13 @@ this.PlacesUtils = {
* @returns true if the node is a visit item, false otherwise
*/
nodeIsVisit: function PU_nodeIsVisit(aNode) {
var type = aNode.type;
return type == Ci.nsINavHistoryResultNode.RESULT_TYPE_VISIT;
Deprecated.warning(
"nodeIsVisit is deprecated ans will be removed in a future version",
"https://bugzilla.mozilla.org/show_bug.cgi?id=561450");
return this.nodeIsURI(aNode) && aNode.parent &&
this.nodeIsQuery(aNode.parent) &&
asQuery(aNode.parent).queryOptions.resultType ==
Ci.nsINavHistoryQueryOptions.RESULTS_AS_VISIT;
},
/**
@ -192,10 +204,14 @@ this.PlacesUtils = {
* A result node
* @returns true if the node is a URL item, false otherwise
*/
uriTypes: [Ci.nsINavHistoryResultNode.RESULT_TYPE_URI,
Ci.nsINavHistoryResultNode.RESULT_TYPE_VISIT],
get uriTypes() {
Deprecated.warning(
"uriTypes is deprecated ans will be removed in a future version",
"https://bugzilla.mozilla.org/show_bug.cgi?id=561450");
return [Ci.nsINavHistoryResultNode.RESULT_TYPE_URI];
},
nodeIsURI: function PU_nodeIsURI(aNode) {
return this.uriTypes.indexOf(aNode.type) != -1;
return aNode.type == Ci.nsINavHistoryResultNode.RESULT_TYPE_URI;
},
/**

View File

@ -14,13 +14,11 @@ namespace places {
VisitInfo::VisitInfo(int64_t aVisitId,
PRTime aVisitDate,
uint32_t aTransitionType,
already_AddRefed<nsIURI> aReferrer,
int64_t aSessionId)
already_AddRefed<nsIURI> aReferrer)
: mVisitId(aVisitId)
, mVisitDate(aVisitDate)
, mTransitionType(aTransitionType)
, mReferrer(aReferrer)
, mSessionId(aSessionId)
{
}
@ -55,13 +53,6 @@ VisitInfo::GetReferrerURI(nsIURI** _referrer)
return NS_OK;
}
NS_IMETHODIMP
VisitInfo::GetSessionId(int64_t* _sessionId)
{
*_sessionId = mSessionId;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
//// nsISupports

View File

@ -21,14 +21,13 @@ public:
NS_DECL_MOZIVISITINFO
VisitInfo(int64_t aVisitId, PRTime aVisitDate, uint32_t aTransitionType,
already_AddRefed<nsIURI> aReferrer, int64_t aSessionId);
already_AddRefed<nsIURI> aReferrer);
private:
const int64_t mVisitId;
const PRTime mVisitDate;
const uint32_t mTransitionType;
nsCOMPtr<nsIURI> mReferrer;
const int64_t mSessionId;
};
} // namespace places

View File

@ -11,7 +11,7 @@ interface nsIVariant;
#include "jsapi.h"
%}
[scriptable, uuid(1a3b1260-4bdb-45d0-a306-dc377dd9baa4)]
[scriptable, uuid(41e4ccc9-f0c8-4cd7-9753-7a38514b8488)]
interface mozIVisitInfo : nsISupports
{
/**
@ -36,13 +36,6 @@ interface mozIVisitInfo : nsISupports
* The referring URI of this visit. This may be null.
*/
readonly attribute nsIURI referrerURI;
/**
* The sessionId of this visit.
*
* @see nsINavHistory.idl
*/
readonly attribute long long sessionId;
};
[scriptable, uuid(ad83e137-c92a-4b7b-b67e-0a318811f91e)]

View File

@ -50,11 +50,14 @@ interface nsINavHistoryResultNode : nsISupports
* corresponding specialized result node interface.
*/
const unsigned long RESULT_TYPE_URI = 0; // nsINavHistoryResultNode
const unsigned long RESULT_TYPE_VISIT = 1; // nsINavHistoryVisitResultNode
// Visit nodes are deprecated and unsupported.
// This line exists just to avoid reusing the value:
// const unsigned long RESULT_TYPE_VISIT = 1;
// Full visit nodes are deprecated and unsupported.
// This line exists just to avoid reusing the value:
// const unsigned long RESULT_TYPE_FULL_VISIT = 2; // nsINavHistoryFullVisitResultNode
// const unsigned long RESULT_TYPE_FULL_VISIT = 2;
// Dynamic containers are deprecated and unsupported.
// This const exists just to avoid reusing the value:
@ -154,22 +157,6 @@ interface nsINavHistoryResultNode : nsISupports
};
/**
* When you request RESULT_TYPE_VISIT from query options, you will get this
* interface for each item, which includes the session ID so that we can
* group items from the same session together.
*/
[scriptable, uuid(8e2c5a86-b33d-4fa6-944b-559af7e95fcd)]
interface nsINavHistoryVisitResultNode : nsINavHistoryResultNode
{
/**
* This indicates the session ID of the * visit. This is used for session
* grouping when a tree view is sorted by date.
*/
readonly attribute long long sessionId;
};
/**
* Base class for container results. This includes all types of groupings.
* Bookmark folders and places queries will be QueryResultNodes which extends
@ -636,7 +623,7 @@ interface nsINavHistoryObserver : nsISupports
*
* @param aVisitID ID of the visit that was just created.
* @param aTime Time of the visit
* @param aSessionID The ID of one connected sequence of visits.
* @param aSessionID No longer supported (always set to 0).
* @param aReferringID The ID of the visit the user came from. 0 if empty.
* @param aTransitionType One of nsINavHistory.TRANSITION_*
* @param aGUID The unique ID associated with the page.
@ -1304,7 +1291,7 @@ interface nsINavHistoryService : nsISupports
/**
* Returns true if this URI would be added to the history. You don't have to
* worry about calling this, addPageToSession/addURI will always check before
* worry about calling this, adding a visit will always check before
* actually adding the page. This function is public because some components
* may want to check if this page would go in the history (i.e. for
* annotations).

View File

@ -50,10 +50,10 @@
using namespace mozilla;
// These columns sit to the right of the kGetInfoIndex_* columns.
const int32_t nsNavBookmarks::kGetChildrenIndex_Position = 15;
const int32_t nsNavBookmarks::kGetChildrenIndex_Type = 16;
const int32_t nsNavBookmarks::kGetChildrenIndex_PlaceID = 17;
const int32_t nsNavBookmarks::kGetChildrenIndex_Guid = 18;
const int32_t nsNavBookmarks::kGetChildrenIndex_Position = 14;
const int32_t nsNavBookmarks::kGetChildrenIndex_Type = 15;
const int32_t nsNavBookmarks::kGetChildrenIndex_PlaceID = 16;
const int32_t nsNavBookmarks::kGetChildrenIndex_Guid = 17;
using namespace mozilla::places;
@ -1061,7 +1061,7 @@ nsNavBookmarks::GetDescendantChildren(int64_t aFolderId,
// item_child, and folder_child from moz_bookmarks.
nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
"SELECT h.id, h.url, IFNULL(b.title, h.title), h.rev_host, h.visit_count, "
"h.last_visit_date, f.url, null, b.id, b.dateAdded, b.lastModified, "
"h.last_visit_date, f.url, b.id, b.dateAdded, b.lastModified, "
"b.parent, null, h.frecency, h.hidden, b.position, b.type, b.fk, "
"b.guid "
"FROM moz_bookmarks b "
@ -1765,7 +1765,7 @@ nsNavBookmarks::QueryFolderChildren(
// item_child, and folder_child from moz_bookmarks.
nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(
"SELECT h.id, h.url, IFNULL(b.title, h.title), h.rev_host, h.visit_count, "
"h.last_visit_date, f.url, null, b.id, b.dateAdded, b.lastModified, "
"h.last_visit_date, f.url, b.id, b.dateAdded, b.lastModified, "
"b.parent, null, h.frecency, h.hidden, b.position, b.type, b.fk, "
"b.guid "
"FROM moz_bookmarks b "
@ -1899,7 +1899,7 @@ nsNavBookmarks::QueryFolderChildrenAsync(
// item_child, and folder_child from moz_bookmarks.
nsCOMPtr<mozIStorageAsyncStatement> stmt = mDB->GetAsyncStatement(
"SELECT h.id, h.url, IFNULL(b.title, h.title), h.rev_host, h.visit_count, "
"h.last_visit_date, f.url, null, b.id, b.dateAdded, b.lastModified, "
"h.last_visit_date, f.url, b.id, b.dateAdded, b.lastModified, "
"b.parent, null, h.frecency, h.hidden, b.position, b.type, b.fk, "
"b.guid "
"FROM moz_bookmarks b "

View File

@ -243,14 +243,13 @@ const int32_t nsNavHistory::kGetInfoIndex_RevHost = 3;
const int32_t nsNavHistory::kGetInfoIndex_VisitCount = 4;
const int32_t nsNavHistory::kGetInfoIndex_VisitDate = 5;
const int32_t nsNavHistory::kGetInfoIndex_FaviconURL = 6;
const int32_t nsNavHistory::kGetInfoIndex_SessionId = 7;
const int32_t nsNavHistory::kGetInfoIndex_ItemId = 8;
const int32_t nsNavHistory::kGetInfoIndex_ItemDateAdded = 9;
const int32_t nsNavHistory::kGetInfoIndex_ItemLastModified = 10;
const int32_t nsNavHistory::kGetInfoIndex_ItemParentId = 11;
const int32_t nsNavHistory::kGetInfoIndex_ItemTags = 12;
const int32_t nsNavHistory::kGetInfoIndex_Frecency = 13;
const int32_t nsNavHistory::kGetInfoIndex_Hidden = 14;
const int32_t nsNavHistory::kGetInfoIndex_ItemId = 7;
const int32_t nsNavHistory::kGetInfoIndex_ItemDateAdded = 8;
const int32_t nsNavHistory::kGetInfoIndex_ItemLastModified = 9;
const int32_t nsNavHistory::kGetInfoIndex_ItemParentId = 10;
const int32_t nsNavHistory::kGetInfoIndex_ItemTags = 11;
const int32_t nsNavHistory::kGetInfoIndex_Frecency = 12;
const int32_t nsNavHistory::kGetInfoIndex_Hidden = 13;
PLACES_FACTORY_SINGLETON_IMPLEMENTATION(nsNavHistory, gHistoryService)
@ -260,7 +259,6 @@ nsNavHistory::nsNavHistory()
, mBatchDBTransaction(nullptr)
, mCachedNow(0)
, mExpireNowTimer(nullptr)
, mLastSessionID(0)
, mHistoryEnabled(true)
, mNumVisitsForFrecency(10)
, mTagsFolder(-1)
@ -505,38 +503,10 @@ nsNavHistory::LoadPrefs()
}
int64_t
nsNavHistory::GetNewSessionID()
{
// Use cached value if already initialized.
if (mLastSessionID)
return ++mLastSessionID;
// Extract the last session ID, so we know where to pick up. There is no
// index over sessions so we use the visit_date index.
nsCOMPtr<mozIStorageStatement> selectSession;
nsresult rv = mDB->MainConn()->CreateStatement(NS_LITERAL_CSTRING(
"SELECT session FROM moz_historyvisits "
"ORDER BY visit_date DESC "
), getter_AddRefs(selectSession));
NS_ENSURE_SUCCESS(rv, 0);
bool hasSession;
if (NS_SUCCEEDED(selectSession->ExecuteStep(&hasSession)) && hasSession) {
mLastSessionID = selectSession->AsInt64(0) + 1;
}
else {
mLastSessionID = 1;
}
return mLastSessionID;
}
void
nsNavHistory::NotifyOnVisit(nsIURI* aURI,
int64_t aVisitID,
PRTime aTime,
int64_t aSessionID,
int64_t referringVisitID,
int32_t aTransitionType,
const nsACString& aGUID,
@ -555,7 +525,7 @@ nsNavHistory::NotifyOnVisit(nsIURI* aURI,
NOTIFY_OBSERVERS(mCanNotify, mCacheObservers, mObservers,
nsINavHistoryObserver,
OnVisit(aURI, aVisitID, aTime, aSessionID,
OnVisit(aURI, aVisitID, aTime, 0,
referringVisitID, aTransitionType, aGUID, aHidden));
}
@ -1424,7 +1394,7 @@ PlacesSQLQueryBuilder::SelectAsURI()
mQueryString = NS_LITERAL_CSTRING(
"SELECT h.id, h.url, h.title AS page_title, h.rev_host, h.visit_count, "
"h.last_visit_date, f.url, null, null, null, null, null, ") +
"h.last_visit_date, f.url, null, null, null, null, ") +
tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_places h "
"LEFT JOIN moz_favicons f ON h.favicon_id = f.id "
@ -1449,7 +1419,7 @@ PlacesSQLQueryBuilder::SelectAsURI()
mQueryString = NS_LITERAL_CSTRING(
"SELECT b2.fk, h.url, COALESCE(b2.title, h.title) AS page_title, "
"h.rev_host, h.visit_count, h.last_visit_date, f.url, null, b2.id, "
"h.rev_host, h.visit_count, h.last_visit_date, f.url, b2.id, "
"b2.dateAdded, b2.lastModified, b2.parent, ") +
tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_bookmarks b2 "
@ -1473,7 +1443,7 @@ PlacesSQLQueryBuilder::SelectAsURI()
tagsSqlFragment);
mQueryString = NS_LITERAL_CSTRING(
"SELECT b.fk, h.url, COALESCE(b.title, h.title) AS page_title, "
"h.rev_host, h.visit_count, h.last_visit_date, f.url, null, b.id, "
"h.rev_host, h.visit_count, h.last_visit_date, f.url, b.id, "
"b.dateAdded, b.lastModified, b.parent, ") +
tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_bookmarks b "
@ -1506,7 +1476,7 @@ PlacesSQLQueryBuilder::SelectAsVisit()
tagsSqlFragment);
mQueryString = NS_LITERAL_CSTRING(
"SELECT h.id, h.url, h.title AS page_title, h.rev_host, h.visit_count, "
"v.visit_date, f.url, v.session, null, null, null, null, ") +
"v.visit_date, f.url, null, null, null, null, ") +
tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_places h "
"JOIN moz_historyvisits v ON h.id = v.place_id "
@ -1542,7 +1512,7 @@ PlacesSQLQueryBuilder::SelectAsDay()
mQueryString = nsPrintfCString(
"SELECT null, "
"'place:type=%ld&sort=%ld&beginTime='||beginTime||'&endTime='||endTime, "
"dayTitle, null, null, beginTime, null, null, null, null, null, null, null "
"dayTitle, null, null, beginTime, null, null, null, null, null, null "
"FROM (", // TOUTER BEGIN
resultType,
sortingMode);
@ -1745,7 +1715,7 @@ PlacesSQLQueryBuilder::SelectAsSite()
mQueryString = nsPrintfCString(
"SELECT null, 'place:type=%ld&sort=%ld&domain=&domainIsHost=true'%s, "
":localhost, :localhost, null, null, null, null, null, null, null, null "
":localhost, :localhost, null, null, null, null, null, null, null "
"WHERE EXISTS ( "
"SELECT h.id FROM moz_places h "
"%s "
@ -1758,7 +1728,7 @@ PlacesSQLQueryBuilder::SelectAsSite()
"UNION ALL "
"SELECT null, "
"'place:type=%ld&sort=%ld&domain='||host||'&domainIsHost=true'%s, "
"host, host, null, null, null, null, null, null, null, null "
"host, host, null, null, null, null, null, null, null "
"FROM ( "
"SELECT get_unreversed_host(h.rev_host) AS host "
"FROM moz_places h "
@ -1797,7 +1767,7 @@ PlacesSQLQueryBuilder::SelectAsTag()
mQueryString = nsPrintfCString(
"SELECT null, 'place:folder=' || id || '&queryType=%d&type=%ld', "
"title, null, null, null, null, null, null, dateAdded, "
"title, null, null, null, null, null, dateAdded, "
"lastModified, null, null, null "
"FROM moz_bookmarks "
"WHERE parent = %lld",
@ -2031,7 +2001,7 @@ nsNavHistory::ConstructQueryString(
// smart bookmark.
queryString = NS_LITERAL_CSTRING(
"SELECT h.id, h.url, h.title AS page_title, h.rev_host, h.visit_count, h.last_visit_date, "
"f.url, null, null, null, null, null, ") +
"f.url, null, null, null, null, ") +
tagsSqlFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_places h "
"LEFT OUTER JOIN moz_favicons f ON h.favicon_id = f.id "
@ -3881,15 +3851,10 @@ nsNavHistory::RowToResult(mozIStorageValueArray* aRow,
resultNode.forget(aResult);
return NS_OK;
}
// now we know the result type is some kind of visit (regular or full)
// session
int64_t session = aRow->AsInt64(kGetInfoIndex_SessionId);
if (aOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_VISIT) {
nsRefPtr<nsNavHistoryResultNode> resultNode =
new nsNavHistoryVisitResultNode(url, title, accessCount, time,
favicon, session);
new nsNavHistoryResultNode(url, title, accessCount, time, favicon);
nsAutoString tags;
rv = aRow->GetString(kGetInfoIndex_ItemTags, tags);
@ -3993,7 +3958,7 @@ nsNavHistory::VisitIdToResultNode(int64_t visitId,
// Should match kGetInfoIndex_* (see GetQueryResults)
statement = mDB->GetStatement(NS_LITERAL_CSTRING(
"SELECT h.id, h.url, h.title, h.rev_host, h.visit_count, "
"v.visit_date, f.url, v.session, null, null, null, null, "
"v.visit_date, f.url, null, null, null, null, "
) + tagsFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_places h "
"JOIN moz_historyvisits v ON h.id = v.place_id "
@ -4007,7 +3972,7 @@ nsNavHistory::VisitIdToResultNode(int64_t visitId,
// Should match kGetInfoIndex_* (see GetQueryResults)
statement = mDB->GetStatement(NS_LITERAL_CSTRING(
"SELECT h.id, h.url, h.title, h.rev_host, h.visit_count, "
"h.last_visit_date, f.url, null, null, null, null, null, "
"h.last_visit_date, f.url, null, null, null, null, "
) + tagsFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_places h "
"JOIN moz_historyvisits v ON h.id = v.place_id "
@ -4052,7 +4017,7 @@ nsNavHistory::BookmarkIdToResultNode(int64_t aBookmarkId, nsNavHistoryQueryOptio
// Should match kGetInfoIndex_*
nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(NS_LITERAL_CSTRING(
"SELECT b.fk, h.url, COALESCE(b.title, h.title), "
"h.rev_host, h.visit_count, h.last_visit_date, f.url, null, b.id, "
"h.rev_host, h.visit_count, h.last_visit_date, f.url, b.id, "
"b.dateAdded, b.lastModified, b.parent, "
) + tagsFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_bookmarks b "
@ -4092,7 +4057,7 @@ nsNavHistory::URIToResultNode(nsIURI* aURI,
// Should match kGetInfoIndex_*
nsCOMPtr<mozIStorageStatement> stmt = mDB->GetStatement(NS_LITERAL_CSTRING(
"SELECT h.id, :page_url, h.title, h.rev_host, h.visit_count, "
"h.last_visit_date, f.url, null, null, null, null, null, "
"h.last_visit_date, f.url, null, null, null, null, "
) + tagsFragment + NS_LITERAL_CSTRING(", h.frecency, h.hidden "
"FROM moz_places h "
"LEFT JOIN moz_favicons f ON h.favicon_id = f.id "

View File

@ -210,7 +210,6 @@ public:
static const int32_t kGetInfoIndex_VisitCount;
static const int32_t kGetInfoIndex_VisitDate;
static const int32_t kGetInfoIndex_FaviconURL;
static const int32_t kGetInfoIndex_SessionId;
static const int32_t kGetInfoIndex_ItemId;
static const int32_t kGetInfoIndex_ItemDateAdded;
static const int32_t kGetInfoIndex_ItemLastModified;
@ -401,15 +400,12 @@ public:
return mNumVisitsForFrecency;
}
int64_t GetNewSessionID();
/**
* Fires onVisit event to nsINavHistoryService observers
*/
void NotifyOnVisit(nsIURI* aURI,
int64_t aVisitID,
PRTime aTime,
int64_t aSessionID,
int64_t referringVisitID,
int32_t aTransitionType,
const nsACString& aGUID,
@ -536,9 +532,6 @@ protected:
const nsACString& url);
void ExpireNonrecentEvents(RecentEventHash* hashTable);
// Sessions tracking.
int64_t mLastSessionID;
#ifdef MOZ_XUL
nsresult AutoCompleteFeedback(int32_t aIndex,
nsIAutoCompleteController *aController);

View File

@ -292,19 +292,6 @@ nsNavHistoryResultNode::GetGeneratingOptions()
return nullptr;
}
NS_IMPL_ISUPPORTS_INHERITED1(nsNavHistoryVisitResultNode,
nsNavHistoryResultNode,
nsINavHistoryVisitResultNode)
nsNavHistoryVisitResultNode::nsNavHistoryVisitResultNode(
const nsACString& aURI, const nsACString& aTitle, uint32_t aAccessCount,
PRTime aTime, const nsACString& aIconURI, int64_t aSession) :
nsNavHistoryResultNode(aURI, aTitle, aAccessCount, aTime, aIconURI),
mSessionId(aSession)
{
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsNavHistoryContainerResultNode, nsNavHistoryResultNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mResult)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChildren)
@ -2491,7 +2478,7 @@ nsNavHistoryQueryResultNode::OnVisit(nsIURI* aURI, int64_t aVisitId,
if (!history->EvaluateQueryForNode(mQueries, mOptions, addition))
return NS_OK; // don't need to include in our query
if (addition->IsVisit()) {
if (mOptions->ResultType() == nsNavHistoryQueryOptions::RESULTS_AS_VISIT) {
// If this is a visit type query, just insert the new visit. We never
// update visits, only add or remove them.
rv = InsertSortedChild(addition);

View File

@ -26,7 +26,6 @@ class nsNavHistoryQueryOptions;
class nsNavHistoryContainerResultNode;
class nsNavHistoryFolderResultNode;
class nsNavHistoryQueryResultNode;
class nsNavHistoryVisitResultNode;
/**
* hashkey wrapper using int64_t KeyType
@ -290,9 +289,9 @@ public:
// would take a vtable slot for every one of (potentially very many) nodes.
// Note that GetType() already has a vtable slot because its on the iface.
bool IsTypeContainer(uint32_t type) {
return (type == nsINavHistoryResultNode::RESULT_TYPE_QUERY ||
type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER ||
type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER_SHORTCUT);
return type == nsINavHistoryResultNode::RESULT_TYPE_QUERY ||
type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER ||
type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER_SHORTCUT;
}
bool IsContainer() {
uint32_t type;
@ -300,25 +299,16 @@ public:
return IsTypeContainer(type);
}
static bool IsTypeURI(uint32_t type) {
return (type == nsINavHistoryResultNode::RESULT_TYPE_URI ||
type == nsINavHistoryResultNode::RESULT_TYPE_VISIT);
return type == nsINavHistoryResultNode::RESULT_TYPE_URI;
}
bool IsURI() {
uint32_t type;
GetType(&type);
return IsTypeURI(type);
}
static bool IsTypeVisit(uint32_t type) {
return type == nsINavHistoryResultNode::RESULT_TYPE_VISIT;
}
bool IsVisit() {
uint32_t type;
GetType(&type);
return IsTypeVisit(type);
}
static bool IsTypeFolder(uint32_t type) {
return (type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER ||
type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER_SHORTCUT);
return type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER ||
type == nsINavHistoryResultNode::RESULT_TYPE_FOLDER_SHORTCUT;
}
bool IsFolder() {
uint32_t type;
@ -326,7 +316,7 @@ public:
return IsTypeFolder(type);
}
static bool IsTypeQuery(uint32_t type) {
return (type == nsINavHistoryResultNode::RESULT_TYPE_QUERY);
return type == nsINavHistoryResultNode::RESULT_TYPE_QUERY;
}
bool IsQuery() {
uint32_t type;
@ -336,16 +326,12 @@ public:
bool IsSeparator() {
uint32_t type;
GetType(&type);
return (type == nsINavHistoryResultNode::RESULT_TYPE_SEPARATOR);
return type == nsINavHistoryResultNode::RESULT_TYPE_SEPARATOR;
}
nsNavHistoryContainerResultNode* GetAsContainer() {
NS_ASSERTION(IsContainer(), "Not a container");
return reinterpret_cast<nsNavHistoryContainerResultNode*>(this);
}
nsNavHistoryVisitResultNode* GetAsVisit() {
NS_ASSERTION(IsVisit(), "Not a visit");
return reinterpret_cast<nsNavHistoryVisitResultNode*>(this);
}
nsNavHistoryFolderResultNode* GetAsFolder() {
NS_ASSERTION(IsFolder(), "Not a folder");
return reinterpret_cast<nsNavHistoryFolderResultNode*>(this);
@ -385,32 +371,6 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsNavHistoryResultNode, NS_NAVHISTORYRESULTNODE_IID)
// nsNavHistoryVisitResultNode
#define NS_IMPLEMENT_VISITRESULT \
NS_IMETHOD GetUri(nsACString& aURI) { aURI = mURI; return NS_OK; } \
NS_IMETHOD GetSessionId(int64_t* aSessionId) \
{ *aSessionId = mSessionId; return NS_OK; }
class nsNavHistoryVisitResultNode : public nsNavHistoryResultNode,
public nsINavHistoryVisitResultNode
{
public:
nsNavHistoryVisitResultNode(const nsACString& aURI, const nsACString& aTitle,
uint32_t aAccessCount, PRTime aTime,
const nsACString& aIconURI, int64_t aSession);
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_COMMON_RESULTNODE_TO_BASE
NS_IMETHOD GetType(uint32_t* type)
{ *type = nsNavHistoryResultNode::RESULT_TYPE_VISIT; return NS_OK; }
NS_IMPLEMENT_VISITRESULT
public:
int64_t mSessionId;
};
// nsNavHistoryContainerResultNode
//

View File

@ -239,7 +239,6 @@ function isBookmarkAltered(aWin){
let options = aWin.PlacesUtils.history.getNewQueryOptions();
options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
options.maxResults = 1; // should only expect a new bookmark
options.resultType = options.RESULT_TYPE_VISIT;
let query = aWin.PlacesUtils.history.getNewQuery();
query.setFolders([aWin.PlacesUtils.bookmarks.bookmarksMenuFolder], 1);

View File

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const CURRENT_SCHEMA_VERSION = 21;
const CURRENT_SCHEMA_VERSION = 22;
const NS_APP_USER_PROFILE_50_DIR = "ProfD";
const NS_APP_PROFILE_DIR_STARTUP = "ProfDS";

View File

@ -19,8 +19,6 @@ HTTPSVR.registerPathHandler(PERMA_REDIR_PATH, permaRedirHandler);
HTTPSVR.registerPathHandler(TEMP_REDIR_PATH, tempRedirHandler);
HTTPSVR.registerPathHandler(FOUND_PATH, foundHandler);
const EXPECTED_SESSION_ID = 1;
const STATUS = {
REDIRECT_PERMANENT: [301, "Moved Permanently"],
REDIRECT_TEMPORARY: [302, "Moved"],
@ -75,7 +73,7 @@ function run_test() {
function continue_test() {
let stmt = DBConn().createStatement(
"SELECT v.id, h.url, v.from_visit, v.visit_date, v.visit_type, v.session " +
"SELECT v.id, h.url, v.from_visit, v.visit_date, v.visit_type " +
"FROM moz_historyvisits v " +
"JOIN moz_places h on h.id = v.place_id " +
"ORDER BY v.id ASC");
@ -83,18 +81,15 @@ function continue_test() {
{ id: 1,
url: PERMA_REDIR_URL,
from_visit: 0,
visit_type: Ci.nsINavHistoryService.TRANSITION_LINK,
session: EXPECTED_SESSION_ID },
visit_type: Ci.nsINavHistoryService.TRANSITION_LINK },
{ id: 2,
url: TEMP_REDIR_URL,
from_visit: 1,
visit_type: Ci.nsINavHistoryService.TRANSITION_REDIRECT_PERMANENT,
session: EXPECTED_SESSION_ID },
visit_type: Ci.nsINavHistoryService.TRANSITION_REDIRECT_PERMANENT },
{ id: 3,
url: FOUND_URL,
from_visit: 2,
visit_type: Ci.nsINavHistoryService.TRANSITION_REDIRECT_TEMPORARY,
session: EXPECTED_SESSION_ID },
visit_type: Ci.nsINavHistoryService.TRANSITION_REDIRECT_TEMPORARY },
];
try {
while(stmt.executeStep()) {
@ -105,7 +100,6 @@ function continue_test() {
do_check_eq(stmt.row.url, comparator.url);
do_check_eq(stmt.row.from_visit, comparator.from_visit);
do_check_eq(stmt.row.visit_type, comparator.visit_type);
do_check_eq(stmt.row.session, comparator.session);
}
}
finally {

View File

@ -55,13 +55,13 @@ add_task(function test_execute()
let node = root.getChild(index);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_VISIT);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
node = root.getChild(++index);
do_check_eq(node.uri, site + "blank.gif");
do_check_eq(node.type, options.RESULTS_AS_VISIT);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
node = root.getChild(++index);
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_VISIT);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
@ -86,10 +86,10 @@ add_task(function test_execute()
let node = root.getChild(index);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_VISIT);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
node = root.getChild(++index);
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_VISIT);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
@ -113,7 +113,7 @@ add_task(function test_execute()
let node = root.getChild(i);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_URI);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
@ -136,7 +136,7 @@ add_task(function test_execute()
let node = root.getChild(i);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_URI);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
});

View File

@ -49,7 +49,7 @@ add_task(function test_execute()
let node = root.getChild(i);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_URI);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
@ -72,7 +72,7 @@ add_task(function test_execute()
let node = root.getChild(i);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, options.RESULTS_AS_URI);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
});

View File

@ -515,93 +515,6 @@ function test_nonnsIURI_referrerURI_ignored()
yield promiseAsyncUpdates();
}
function test_invalid_sessionId_ignored()
{
let place = {
uri: NetUtil.newURI(TEST_DOMAIN +
"test_invalid_sessionId_ignored"),
visits: [
new VisitInfo(),
],
};
place.visits[0].sessionId = 0;
do_check_false(yield promiseIsURIVisited(place.uri));
let placesResult = yield promiseUpdatePlaces(place);
if (placesResult.errors.length > 0) {
do_throw("Unexpected error.");
}
let placeInfo = placesResult.results[0];
do_check_true(yield promiseIsURIVisited(placeInfo.uri));
// Check to make sure we do not persist bogus sessionId with the visit.
let visit = placeInfo.visits[0];
do_check_neq(visit.sessionId, place.visits[0].sessionId);
// Check to make sure we do not persist bogus sessionId in database.
let stmt = DBConn().createStatement(
"SELECT session " +
"FROM moz_historyvisits " +
"WHERE id = :visit_id"
);
stmt.params.visit_id = visit.visitId;
do_check_true(stmt.executeStep());
do_check_neq(stmt.row.session, place.visits[0].sessionId);
stmt.finalize();
yield promiseAsyncUpdates();
}
function test_unstored_sessionId_ignored()
{
let place = {
uri: NetUtil.newURI(TEST_DOMAIN +
"test_unstored_sessionId_ignored"),
visits: [
new VisitInfo(),
],
};
// Find max session id in database.
let stmt = DBConn().createStatement(
"SELECT MAX(session) as max_session " +
"FROM moz_historyvisits"
);
do_check_true(stmt.executeStep());
let maxSessionId = stmt.row.max_session;
stmt.finalize();
// Create bogus sessionId that is not in database.
place.visits[0].sessionId = maxSessionId + 10;
do_check_false(yield promiseIsURIVisited(place.uri));
let placesResult = yield promiseUpdatePlaces(place);
if (placesResult.errors.length > 0) {
do_throw("Unexpected error.");
}
let placeInfo = placesResult.results[0];
do_check_true(yield promiseIsURIVisited(placeInfo.uri));
// Check to make sure we do not persist bogus sessionId with the visit.
let visit = placeInfo.visits[0];
do_check_neq(visit.sessionId, place.visits[0].sessionId);
// Check to make sure we do not persist bogus sessionId in the database.
let stmt = DBConn().createStatement(
"SELECT MAX(session) as max_session " +
"FROM moz_historyvisits"
);
do_check_true(stmt.executeStep());
// Max sessionId should increase by 1 because we will generate a new
// non-bogus sessionId.
let newMaxSessionId = stmt.row.max_session;
do_check_eq(maxSessionId + 1, newMaxSessionId);
stmt.finalize();
yield promiseAsyncUpdates();
}
function test_old_referrer_ignored()
{
// This tests that a referrer for a visit which is not recent (specifically,
@ -791,7 +704,6 @@ function test_add_visit()
// Check mozIVisitInfo properties.
do_check_eq(visit.visitId, 0);
do_check_eq(visit.sessionId, 0);
}
// But they should be valid for non-embed visits.
else {
@ -801,7 +713,6 @@ function test_add_visit()
// Check mozIVisitInfo properties.
do_check_true(visit.visitId > 0);
do_check_true(visit.sessionId > 0);
}
// If we have had all of our callbacks, continue running tests.
@ -875,21 +786,6 @@ function test_properties_saved()
do_check_eq(stmt.row.count, EXPECTED_COUNT);
stmt.finalize();
// mozIVisitInfo::sessionId
stmt = DBConn().createStatement(
"SELECT COUNT(1) AS count " +
"FROM moz_places h " +
"JOIN moz_historyvisits v " +
"ON h.id = v.place_id " +
"WHERE h.url = :page_url " +
"AND v.session = :session_id "
);
stmt.params.page_url = uri.spec;
stmt.params.session_id = visit.sessionId;
do_check_true(stmt.executeStep());
do_check_eq(stmt.row.count, EXPECTED_COUNT);
stmt.finalize();
// mozIPlaceInfo::title
stmt = DBConn().createStatement(
"SELECT COUNT(1) AS count " +
@ -953,7 +849,6 @@ function test_referrer_saved()
do_check_false(yield promiseIsURIVisited(places[1].uri));
let resultCount = 0;
let referrerSessionId;
let placesResult = yield promiseUpdatePlaces(places);
if (placesResult.errors.length > 0) {
do_throw("Unexpected error.");
@ -964,11 +859,8 @@ function test_referrer_saved()
let visit = placeInfo.visits[0];
// We need to insert all of our visits before we can test conditions.
if (++resultCount != places.length) {
referrerSessionId = visit.sessionId;
} else {
if (++resultCount == places.length) {
do_check_true(places[0].uri.equals(visit.referrerURI));
do_check_eq(visit.sessionId, referrerSessionId);
let stmt = DBConn().createStatement(
"SELECT COUNT(1) AS count " +
@ -991,43 +883,6 @@ function test_referrer_saved()
}
}
function test_sessionId_saved()
{
let place = {
uri: NetUtil.newURI(TEST_DOMAIN + "test_sessionId_saved"),
visits: [
new VisitInfo(),
],
};
place.visits[0].sessionId = 3;
do_check_false(yield promiseIsURIVisited(place.uri));
let placesResult = yield promiseUpdatePlaces(place);
if (placesResult.errors.length > 0) {
do_throw("Unexpected error.");
}
let placeInfo = placesResult.results[0];
let uri = placeInfo.uri;
do_check_true(yield promiseIsURIVisited(uri));
let visit = placeInfo.visits[0];
do_check_eq(visit.sessionId, place.visits[0].sessionId);
let stmt = DBConn().createStatement(
"SELECT COUNT(1) AS count " +
"FROM moz_historyvisits " +
"WHERE place_id = (SELECT id FROM moz_places WHERE url = :page_url) " +
"AND session = :session_id "
);
stmt.params.page_url = uri.spec;
stmt.params.session_id = visit.sessionId;
do_check_true(stmt.executeStep());
do_check_eq(stmt.row.count, 1);
stmt.finalize();
yield promiseAsyncUpdates();
}
function test_guid_change_saved()
{
// First, add a visit for it.
@ -1237,51 +1092,6 @@ function test_visit_notifies()
yield promiseAsyncUpdates();
}
function test_referrer_sessionId_persists()
{
// This test ensures that a visit that has a valid referrer also gets
// the sessionId of the referrer.
let referrerPlace = {
uri: NetUtil.newURI(TEST_DOMAIN + "test_referrer_sessionId_persists_ref"),
visits: [
new VisitInfo(),
],
};
// First we add the referrer visit, and then the main visit with referrer
// attached. We ensure that the sessionId is maintained across the updates.
do_check_false(yield promiseIsURIVisited(referrerPlace.uri));
let placesResult = yield promiseUpdatePlaces(referrerPlace);
if (placesResult.errors.length > 0) {
do_throw("Unexpected error.");
}
let placeInfo = placesResult.results[0];
do_check_true(yield promiseIsURIVisited(referrerPlace.uri));
let sessionId = placeInfo.visits[0].sessionId;
do_check_neq(sessionId, null);
let place = {
uri: NetUtil.newURI(TEST_DOMAIN + "test_referrer_sessionId_persists"),
visits: [
new VisitInfo(),
],
};
place.visits[0].referrerURI = referrerPlace.uri;
do_check_false(yield promiseIsURIVisited(place.uri));
placesResult = yield promiseUpdatePlaces(place);
if (placesResult.errors.length > 0) {
do_throw("Unexpected error.");
}
placeInfo = placesResult.results[0];
do_check_true(yield promiseIsURIVisited(place.uri));
do_check_eq(placeInfo.visits[0].sessionId, sessionId);
yield promiseAsyncUpdates();
}
// test with empty mozIVisitInfoCallback object
function test_callbacks_not_supplied()
{
@ -1331,8 +1141,6 @@ function test_callbacks_not_supplied()
test_duplicate_guid_errors,
test_invalid_referrerURI_ignored,
test_nonnsIURI_referrerURI_ignored,
test_invalid_sessionId_ignored,
test_unstored_sessionId_ignored,
test_old_referrer_ignored,
test_place_id_ignored,
test_handleCompletion_called_when_complete,
@ -1340,13 +1148,11 @@ function test_callbacks_not_supplied()
test_properties_saved,
test_guid_saved,
test_referrer_saved,
test_sessionId_saved,
test_guid_change_saved,
test_title_change_saved,
test_no_title_does_not_clear_title,
test_title_change_notifies,
test_visit_notifies,
test_referrer_sessionId_persists,
test_callbacks_not_supplied,
].forEach(add_task);

View File

@ -61,7 +61,7 @@ add_task(function test_execute()
var node = root.getChild(i);
// test node properties in RESULTS_AS_VISIT
do_check_eq(node.uri, testURI.spec);
do_check_eq(node.type, options.RESULTS_AS_VISIT);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
// TODO: change query type to RESULTS_AS_FULL_VISIT and test this
//do_check_eq(node.transitionType, histsvc.TRANSITION_TYPED);
}

View File

@ -62,7 +62,7 @@ add_task(function test_onVisit() {
do_check_true(aURI.equals(testuri));
do_check_true(aVisitID > 0);
do_check_eq(aTime, testtime);
do_check_true(aSessionID > 0);
do_check_eq(aSessionID, 0);
do_check_eq(aReferringID, 0);
do_check_eq(aTransitionType, TRANSITION_TYPED);
do_check_guid_for_uri(aURI, aGUID);
@ -82,7 +82,7 @@ add_task(function test_onVisit() {
do_check_true(aURI.equals(testuri));
do_check_true(aVisitID > 0);
do_check_eq(aTime, testtime);
do_check_true(aSessionID > 0);
do_check_eq(aSessionID, 0);
do_check_eq(aReferringID, 0);
do_check_eq(aTransitionType, TRANSITION_FRAMED_LINK);
do_check_guid_for_uri(aURI, aGUID);