зеркало из https://github.com/mozilla/pjs.git
Merge mozilla-central into mozilla-inbound
This commit is contained in:
Коммит
0b57460761
|
@ -215,8 +215,6 @@ getUriCB(AtkHyperlink *aLink, gint aLinkIndex)
|
|||
nsAccessible* hyperlink = get_accessible_hyperlink(aLink);
|
||||
NS_ENSURE_TRUE(hyperlink, nsnull);
|
||||
|
||||
MaiAtkHyperlink *maiAtkHyperlink = MAI_ATK_HYPERLINK(aLink);
|
||||
|
||||
nsCOMPtr<nsIURI> uri = hyperlink->GetAnchorURI(aLinkIndex);
|
||||
if (!uri)
|
||||
return nsnull;
|
||||
|
|
|
@ -125,7 +125,7 @@ nsContextMenu.prototype = {
|
|||
} catch (ex) {}
|
||||
}
|
||||
// Check if this could be a valid url, just missing the protocol.
|
||||
else if (/^(?:\w+\.)+\D\S*$/.test(linkText)) {
|
||||
else if (/^(?:[a-z\d-]+\.)+[a-z]+$/i.test(linkText)) {
|
||||
// Now let's see if this is an intentional link selection. Our guess is
|
||||
// based on whether the selection begins/ends with whitespace or is
|
||||
// preceded/followed by a non-word character.
|
||||
|
|
|
@ -554,8 +554,7 @@ var gSyncSetup = {
|
|||
else
|
||||
gSyncUtils.openAddedClientFirstrun();
|
||||
}
|
||||
|
||||
Weave.Service.syncOnIdle(1);
|
||||
Weave.Utils.nextTick(Weave.Service.sync, Weave.Service);
|
||||
},
|
||||
|
||||
onWizardCancel: function () {
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
let doc, range, selection;
|
||||
function setSelection(el1, el2, index1, index2) {
|
||||
while (el1.nodeType != Node.TEXT_NODE)
|
||||
el1 = el1.firstChild;
|
||||
while (el2.nodeType != Node.TEXT_NODE)
|
||||
el2 = el2.firstChild;
|
||||
|
||||
selection.removeAllRanges();
|
||||
range.setStart(el1, index1);
|
||||
range.setEnd(el2, index2);
|
||||
|
@ -82,6 +87,14 @@ function runSelectionTests() {
|
|||
testExpected(false, "Link options should show for triple-click selections");
|
||||
selection.selectAllChildren(span4);
|
||||
testLinkExpected("http://www.example.com/", "Linkified text should open the correct link", span4.firstChild);
|
||||
|
||||
mainDiv.innerHTML = "(open-suse.ru)";
|
||||
setSelection(mainDiv, mainDiv, 1, 13);
|
||||
testExpected(false, "Link options should show for open-suse.ru");
|
||||
testLinkExpected("http://open-suse.ru/", "Linkified text should open the correct link");
|
||||
setSelection(mainDiv, mainDiv, 1, 14);
|
||||
testExpected(true, "Link options should not show for 'open-suse.ru)'");
|
||||
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
}
|
||||
|
@ -98,5 +111,5 @@ function test() {
|
|||
}, true);
|
||||
|
||||
content.location =
|
||||
"data:text/html,Test For Non-Hyperlinked url selection";
|
||||
"data:text/html;charset=UTF-8,Test For Non-Hyperlinked url selection";
|
||||
}
|
||||
|
|
|
@ -114,7 +114,6 @@ CPPSRCS = \
|
|||
nsHTMLContentSerializer.cpp \
|
||||
nsImageLoadingContent.cpp \
|
||||
nsLineBreaker.cpp \
|
||||
nsLoadListenerProxy.cpp \
|
||||
nsMappedAttributeElement.cpp \
|
||||
nsMappedAttributes.cpp \
|
||||
nsNameSpaceManager.cpp \
|
||||
|
|
|
@ -1129,7 +1129,9 @@ nsContentUtils::CheckSameOrigin(nsINode *aTrustedNode,
|
|||
NS_PRECONDITION(aTrustedNode, "There must be a trusted node");
|
||||
|
||||
PRBool isSystem = PR_FALSE;
|
||||
sSecurityManager->SubjectPrincipalIsSystem(&isSystem);
|
||||
nsresult rv = sSecurityManager->SubjectPrincipalIsSystem(&isSystem);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isSystem) {
|
||||
// we're running as system, grant access to the node.
|
||||
|
||||
|
@ -1195,7 +1197,8 @@ nsContentUtils::CanCallerAccess(nsIDOMNode *aNode)
|
|||
// with the system principal games? But really, there should be a simpler
|
||||
// API here, dammit.
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
sSecurityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = sSecurityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
if (!subjectPrincipal) {
|
||||
// we're running as system, grant access to the node.
|
||||
|
@ -1217,7 +1220,8 @@ nsContentUtils::CanCallerAccess(nsPIDOMWindow* aWindow)
|
|||
// with the system principal games? But really, there should be a simpler
|
||||
// API here, dammit.
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
sSecurityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = sSecurityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
if (!subjectPrincipal) {
|
||||
// we're running as system, grant access to the node.
|
||||
|
|
|
@ -179,7 +179,8 @@ nsDOMFileReader::Init()
|
|||
nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
if (secMan) {
|
||||
secMan->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = secMan->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
NS_ENSURE_STATE(subjectPrincipal);
|
||||
mPrincipal = subjectPrincipal;
|
||||
|
|
|
@ -406,7 +406,8 @@ nsDOMParser::Initialize(nsISupports* aOwner, JSContext* cx, JSObject* obj,
|
|||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(secMan, NS_ERROR_UNEXPECTED);
|
||||
|
||||
secMan->GetSubjectPrincipal(getter_AddRefs(prin));
|
||||
nsresult rv = secMan->GetSubjectPrincipal(getter_AddRefs(prin));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We're called from JS; there better be a subject principal, really.
|
||||
NS_ENSURE_TRUE(prin, NS_ERROR_UNEXPECTED);
|
||||
|
@ -463,7 +464,8 @@ nsDOMParser::Init(nsIPrincipal *aPrincipal, nsIURI *aDocumentURI,
|
|||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(secMan, NS_ERROR_UNEXPECTED);
|
||||
|
||||
secMan->GetSubjectPrincipal(getter_AddRefs(principal));
|
||||
nsresult rv = secMan->GetSubjectPrincipal(getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// We're called from JS; there better be a subject principal, really.
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_UNEXPECTED);
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsLoadListenerProxy.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
|
||||
nsLoadListenerProxy::nsLoadListenerProxy(nsWeakPtr aParent) : mParent(aParent)
|
||||
{
|
||||
}
|
||||
|
||||
nsLoadListenerProxy::~nsLoadListenerProxy()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsLoadListenerProxy, nsIDOMEventListener,
|
||||
nsIDOMLoadListener)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadListenerProxy::HandleEvent(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLoadListener> listener(do_QueryReferent(mParent));
|
||||
|
||||
if (listener) {
|
||||
return listener->HandleEvent(aEvent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadListenerProxy::Load(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLoadListener> listener(do_QueryReferent(mParent));
|
||||
|
||||
if (listener) {
|
||||
return listener->Load(aEvent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadListenerProxy::BeforeUnload(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLoadListener> listener(do_QueryReferent(mParent));
|
||||
|
||||
if (listener) {
|
||||
return listener->BeforeUnload(aEvent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadListenerProxy::Unload(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLoadListener> listener(do_QueryReferent(mParent));
|
||||
|
||||
if (listener) {
|
||||
return listener->Unload(aEvent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadListenerProxy::Abort(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLoadListener> listener(do_QueryReferent(mParent));
|
||||
|
||||
if (listener) {
|
||||
return listener->Abort(aEvent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadListenerProxy::Error(nsIDOMEvent* aEvent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMLoadListener> listener(do_QueryReferent(mParent));
|
||||
|
||||
if (listener) {
|
||||
return listener->Error(aEvent);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef nsLoadListenerProxy_h
|
||||
#define nsLoadListenerProxy_h
|
||||
|
||||
#include "nsIDOMLoadListener.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//
|
||||
// This class exists to prevent a circular reference between
|
||||
// the loaded document and the actual loader instance request. The
|
||||
// request owns the document. While the document is loading,
|
||||
// the request is a load listener, held onto by the document.
|
||||
// The proxy class breaks the circularity by filling in as the
|
||||
// load listener and holding a weak reference to the request
|
||||
// object.
|
||||
//
|
||||
/////////////////////////////////////////////
|
||||
|
||||
class nsLoadListenerProxy : public nsIDOMLoadListener {
|
||||
public:
|
||||
nsLoadListenerProxy(nsWeakPtr aParent);
|
||||
virtual ~nsLoadListenerProxy();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMEventListener
|
||||
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
|
||||
|
||||
// nsIDOMLoadListener
|
||||
NS_IMETHOD Load(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD BeforeUnload(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Unload(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Abort(nsIDOMEvent* aEvent);
|
||||
NS_IMETHOD Error(nsIDOMEvent* aEvent);
|
||||
|
||||
protected:
|
||||
nsWeakPtr mParent;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -55,7 +55,6 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsLoadListenerProxy.h"
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsCrossSiteListenerProxy.h"
|
||||
|
||||
|
|
|
@ -480,7 +480,8 @@ nsXMLHttpRequest::Init()
|
|||
nsIScriptSecurityManager *secMan = nsContentUtils::GetSecurityManager();
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
if (secMan) {
|
||||
secMan->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = secMan->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
NS_ENSURE_STATE(subjectPrincipal);
|
||||
mPrincipal = subjectPrincipal;
|
||||
|
|
|
@ -448,8 +448,11 @@ nsDOMDataTransfer::MozGetDataAt(const nsAString& aFormat,
|
|||
// data from the same principal.
|
||||
nsIPrincipal* principal = nsnull;
|
||||
if (mEventType != NS_DRAGDROP_DROP && mEventType != NS_DRAGDROP_DRAGDROP &&
|
||||
!nsContentUtils::IsCallerTrustedForCapability("UniversalBrowserRead"))
|
||||
principal = GetCurrentPrincipal();
|
||||
!nsContentUtils::IsCallerTrustedForCapability("UniversalBrowserRead")) {
|
||||
nsresult rv = NS_OK;
|
||||
principal = GetCurrentPrincipal(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
PRUint32 count = item.Length();
|
||||
for (PRUint32 i = 0; i < count; i++) {
|
||||
|
@ -475,8 +478,9 @@ nsDOMDataTransfer::MozGetDataAt(const nsAString& aFormat,
|
|||
NS_ENSURE_TRUE(sp, NS_ERROR_DOM_SECURITY_ERR);
|
||||
nsIPrincipal* dataPrincipal = sp->GetPrincipal();
|
||||
NS_ENSURE_TRUE(dataPrincipal, NS_ERROR_DOM_SECURITY_ERR);
|
||||
NS_ENSURE_TRUE(principal || (principal = GetCurrentPrincipal()),
|
||||
NS_ENSURE_TRUE(principal || (principal = GetCurrentPrincipal(&rv)),
|
||||
NS_ERROR_DOM_SECURITY_ERR);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
PRBool equals = PR_FALSE;
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(principal->Equals(dataPrincipal, &equals)) && equals,
|
||||
NS_ERROR_DOM_SECURITY_ERR);
|
||||
|
@ -517,7 +521,10 @@ nsDOMDataTransfer::MozSetDataAt(const nsAString& aFormat,
|
|||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
return SetDataWithPrincipal(aFormat, aData, aIndex, GetCurrentPrincipal());
|
||||
nsresult rv = NS_OK;
|
||||
nsIPrincipal* principal = GetCurrentPrincipal(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return SetDataWithPrincipal(aFormat, aData, aIndex, principal);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -532,7 +539,9 @@ nsDOMDataTransfer::MozClearDataAt(const nsAString& aFormat, PRUint32 aIndex)
|
|||
nsAutoString format;
|
||||
GetRealFormat(aFormat, format);
|
||||
|
||||
nsIPrincipal* principal = GetCurrentPrincipal();
|
||||
nsresult rv = NS_OK;
|
||||
nsIPrincipal* principal = GetCurrentPrincipal(&rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// if the format is empty, clear all formats
|
||||
PRBool clearall = format.IsEmpty();
|
||||
|
@ -798,12 +807,14 @@ nsDOMDataTransfer::SetDataWithPrincipal(const nsAString& aFormat,
|
|||
}
|
||||
|
||||
nsIPrincipal*
|
||||
nsDOMDataTransfer::GetCurrentPrincipal()
|
||||
nsDOMDataTransfer::GetCurrentPrincipal(nsresult* rv)
|
||||
{
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> currentPrincipal;
|
||||
ssm->GetSubjectPrincipal(getter_AddRefs(currentPrincipal));
|
||||
*rv = ssm->GetSubjectPrincipal(getter_AddRefs(currentPrincipal));
|
||||
NS_ENSURE_SUCCESS(*rv, nsnull);
|
||||
|
||||
if (!currentPrincipal)
|
||||
ssm->GetSystemPrincipal(getter_AddRefs(currentPrincipal));
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ protected:
|
|||
}
|
||||
|
||||
// returns a weak reference to the current principal
|
||||
nsIPrincipal* GetCurrentPrincipal();
|
||||
nsIPrincipal* GetCurrentPrincipal(nsresult* rv);
|
||||
|
||||
// converts some formats used for compatibility in aInFormat into aOutFormat.
|
||||
// Text and text/unicode become text/plain, and URL becomes text/uri-list
|
||||
|
|
|
@ -181,15 +181,12 @@ _TEST_FILES = \
|
|||
test_bug458037.xhtml \
|
||||
test_bug556645.html \
|
||||
test_bug551670.html \
|
||||
test_bug346485.html \
|
||||
test_bug555567.html \
|
||||
test_bug557620.html \
|
||||
test_bug565538.html \
|
||||
test_bug456229.html \
|
||||
test_bug546995.html \
|
||||
test_bug377624.html \
|
||||
test_bug551846.html \
|
||||
test_bug562932.html \
|
||||
test_bug564001.html \
|
||||
test_bug566046.html \
|
||||
test_bug567938-1.html \
|
||||
|
@ -203,12 +200,7 @@ _TEST_FILES = \
|
|||
test_bug345624-1.html \
|
||||
test_bug345624-2.html \
|
||||
test_bug561640.html \
|
||||
test_bug345822.html \
|
||||
test_bug555559.html \
|
||||
test_bug344615.html \
|
||||
test_bug345512.html \
|
||||
test_bug566064.html \
|
||||
test_bug566160.html \
|
||||
test_bug582412-1.html \
|
||||
test_bug582412-2.html \
|
||||
test_bug558788-1.html \
|
||||
|
@ -223,12 +215,10 @@ _TEST_FILES = \
|
|||
test_bug593689.html \
|
||||
test_bug555840.html \
|
||||
test_bug561636.html \
|
||||
test_bug556013.html \
|
||||
test_bug590363.html \
|
||||
test_bug557628-1.html \
|
||||
test_bug557628-2.html \
|
||||
test_bug592802.html \
|
||||
test_bug589696.html \
|
||||
test_bug595429.html \
|
||||
test_bug595447.html \
|
||||
test_bug595449.html \
|
||||
|
|
|
@ -46,6 +46,16 @@ include $(topsrcdir)/config/rules.mk
|
|||
_TEST_FILES = \
|
||||
save_restore_radio_groups.sjs \
|
||||
test_save_restore_radio_groups.html \
|
||||
test_mozistextfield.html \
|
||||
test_input_email.html \
|
||||
test_input_url.html \
|
||||
test_pattern_attribute.html \
|
||||
test_required_attribute.html \
|
||||
test_novalidate_attribute.html \
|
||||
test_formaction_attribute.html \
|
||||
test_formnovalidate_attribute.html \
|
||||
test_label_control_attribute.html \
|
||||
test_output_element.html \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
|
|
@ -147,7 +147,7 @@ function checkFormSubmission()
|
|||
*/
|
||||
|
||||
is(frames['submit_frame'].location.href,
|
||||
'http://mochi.test:8888/tests/content/html/content/test/foo?a=afield&b=bfield',
|
||||
'http://mochi.test:8888/tests/content/html/content/test/forms/foo?a=afield&b=bfield',
|
||||
"The output element value should not be submitted");
|
||||
SimpleTest.finish();
|
||||
}
|
|
@ -12,8 +12,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=561634
|
|||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=561634">Mozilla Bug 561634</a>
|
||||
<p id="display"></p>
|
||||
<!--<div id="content" style="display: none">-->
|
||||
<div id="content">
|
||||
<div id="content" style="display: none;">
|
||||
<form>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -72,12 +71,6 @@ function checkInvalid()
|
|||
ok(!f.checkValidity(),
|
||||
"A form with at least one invalid element is invalid");
|
||||
|
||||
// Check event is fired
|
||||
i.addEventListener("invalid", function (e) {
|
||||
ok(true, "invalid event should have been fired on invalid elements");
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
|
||||
f.removeChild(i2);
|
||||
f.removeChild(i);
|
||||
}
|
||||
|
@ -107,22 +100,26 @@ function checkInvalidEvent()
|
|||
|
||||
f.checkValidity();
|
||||
|
||||
SimpleTest.executeSoon(function () {
|
||||
setTimeout(function() {
|
||||
ok(invalidEventForInvalidElement,
|
||||
"invalid event should be fired on invalid elements");
|
||||
ok(!invalidEventForValidElement,
|
||||
"invalid event should not be fired on valid elements");
|
||||
});
|
||||
|
||||
f.removeChild(i2);
|
||||
f.removeChild(i);
|
||||
f.removeChild(i2);
|
||||
f.removeChild(i);
|
||||
|
||||
SimpleTest.finish();
|
||||
}, 0);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
checkEmptyForm();
|
||||
checkBarredFromConstraintValidation();
|
||||
checkValid();
|
||||
checkInvalid();
|
||||
checkInvalidEvent();
|
||||
checkInvalidEvent(); // will call finish().
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "nsICachingChannel.h"
|
||||
#include "nsURILoader.h"
|
||||
#include "nsIAsyncVerifyRedirectCallback.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
|
||||
#define HTTP_OK_CODE 200
|
||||
#define HTTP_PARTIAL_RESPONSE_CODE 206
|
||||
|
@ -331,7 +332,7 @@ nsMediaChannelStream::OnStopRequest(nsIRequest* aRequest, nsresult aStatus)
|
|||
mLoadInBackground = PR_FALSE;
|
||||
|
||||
nsLoadFlags loadFlags;
|
||||
nsresult rv = mChannel->GetLoadFlags(&loadFlags);
|
||||
DebugOnly<nsresult> rv = mChannel->GetLoadFlags(&loadFlags);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadFlags() failed!");
|
||||
|
||||
loadFlags &= ~nsIRequest::LOAD_BACKGROUND;
|
||||
|
|
|
@ -1265,7 +1265,8 @@ txMozillaXSLTProcessor::Initialize(nsISupports* aOwner, JSContext* cx,
|
|||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(secMan, NS_ERROR_UNEXPECTED);
|
||||
|
||||
secMan->GetSubjectPrincipal(getter_AddRefs(prin));
|
||||
nsresult rv = secMan->GetSubjectPrincipal(getter_AddRefs(prin));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(prin, NS_ERROR_UNEXPECTED);
|
||||
|
||||
return Init(prin);
|
||||
|
|
|
@ -443,7 +443,6 @@ nsXULPrototypeCache::WritePrototype(nsXULPrototypeDocument* aPrototypeDocument)
|
|||
// has completed.
|
||||
RemoveFromCacheSet(protoURI);
|
||||
|
||||
PRInt32 count = mCacheURITable.Count();
|
||||
nsCOMPtr<nsIObjectOutputStream> oos;
|
||||
rv = GetOutputStream(protoURI, getter_AddRefs(oos));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -1328,7 +1328,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsGlobalWindow)
|
|||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIScriptGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindowInternal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMWindow2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMJSWindow)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
|
||||
|
@ -1410,10 +1409,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
|
|||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOuterWindow)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOpenerScriptPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager)
|
||||
if (tmp->mListenerManager) {
|
||||
tmp->mListenerManager->Disconnect();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mListenerManager)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSessionStorage)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mApplicationCache)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocumentPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDoc)
|
||||
|
||||
// Unlink stuff from nsPIDOMWindow
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mChromeEventHandler)
|
||||
|
@ -3238,18 +3241,6 @@ nsGlobalWindow::GetApplicationCache(nsIDOMOfflineResourceList **aApplicationCach
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::CreateBlobURL(nsIDOMBlob* aBlob, nsAString& aURL)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::RevokeBlobURL(const nsAString& aURL)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetCrypto(nsIDOMCrypto** aCrypto)
|
||||
{
|
||||
|
@ -10086,6 +10077,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGlobalChromeWindow,
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsGlobalChromeWindow,
|
||||
nsGlobalWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mBrowserDOMWindow)
|
||||
if (tmp->mMessageManager) {
|
||||
static_cast<nsFrameMessageManager*>(
|
||||
tmp->mMessageManager.get())->Disconnect();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mMessageManager)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
DOMCI_DATA(ChromeWindow, nsGlobalChromeWindow)
|
||||
|
||||
// QueryInterface implementation for nsGlobalChromeWindow
|
||||
|
|
|
@ -326,9 +326,6 @@ public:
|
|||
// nsIDOMWindow
|
||||
NS_DECL_NSIDOMWINDOW
|
||||
|
||||
// nsIDOMWindow2
|
||||
NS_DECL_NSIDOMWINDOW2
|
||||
|
||||
// nsIDOMWindowInternal
|
||||
NS_DECL_NSIDOMWINDOWINTERNAL
|
||||
|
||||
|
@ -1026,8 +1023,8 @@ public:
|
|||
mCleanMessageManager = PR_FALSE;
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED_NO_UNLINK(nsGlobalChromeWindow,
|
||||
nsGlobalWindow)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGlobalChromeWindow,
|
||||
nsGlobalWindow)
|
||||
|
||||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
||||
nsCOMPtr<nsIChromeFrameMessageManager> mMessageManager;
|
||||
|
|
|
@ -80,8 +80,8 @@ class nsIArray;
|
|||
class nsPIWindowRoot;
|
||||
|
||||
#define NS_PIDOMWINDOW_IID \
|
||||
{ 0x176e69ce, 0x25d3, 0x4f2a, \
|
||||
{ 0x9d, 0x99, 0x81, 0xa3, 0x9a, 0xfd, 0xe2, 0xf0 } }
|
||||
{ 0x6c05ae9d, 0x4ad1, 0x4e92, \
|
||||
{ 0x9c, 0x95, 0xd3, 0x54, 0xea, 0x0f, 0xb9, 0x48 } }
|
||||
|
||||
class nsPIDOMWindow : public nsIDOMWindowInternal
|
||||
{
|
||||
|
@ -92,7 +92,7 @@ public:
|
|||
|
||||
virtual void ActivateOrDeactivate(PRBool aActivate) = 0;
|
||||
|
||||
// this is called GetTopWindowRoot to avoid conflicts with nsIDOMWindow2::GetWindowRoot
|
||||
// this is called GetTopWindowRoot to avoid conflicts with nsIDOMWindow::GetWindowRoot
|
||||
virtual already_AddRefed<nsPIWindowRoot> GetTopWindowRoot() = 0;
|
||||
|
||||
virtual void SetActive(PRBool aActive)
|
||||
|
|
|
@ -50,7 +50,6 @@ SDK_XPIDLSRCS = \
|
|||
domstubs.idl \
|
||||
nsIDOMBarProp.idl \
|
||||
nsIDOMWindow.idl \
|
||||
nsIDOMWindow2.idl \
|
||||
nsIDOMWindowCollection.idl \
|
||||
nsIDOMWindowUtils.idl \
|
||||
$(NULL)
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
interface nsIDOMOfflineResourceList;
|
||||
interface nsISelection;
|
||||
|
||||
/**
|
||||
|
@ -50,7 +51,7 @@ interface nsISelection;
|
|||
* @see <http://www.whatwg.org/html/#window>
|
||||
*/
|
||||
|
||||
[scriptable, uuid(ff7d278f-93db-4078-b89a-058c8e1270b4)]
|
||||
[scriptable, uuid(90fec5b7-c58b-463f-a147-f91b6b104a96)]
|
||||
interface nsIDOMWindow : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -59,11 +60,19 @@ interface nsIDOMWindow : nsISupports
|
|||
readonly attribute nsIDOMDocument document;
|
||||
|
||||
/**
|
||||
* Accessor for this window's parent window, or the window itself if
|
||||
* there is no parent, or if the parent is of different type
|
||||
* (i.e. this does not cross chrome-content boundaries).
|
||||
* Set/Get the name of this window.
|
||||
*
|
||||
* This attribute is "replaceable" in JavaScript
|
||||
*/
|
||||
readonly attribute nsIDOMWindow parent;
|
||||
attribute DOMString name;
|
||||
|
||||
/**
|
||||
* Accessor for the object that controls whether or not scrollbars
|
||||
* are shown in this window.
|
||||
*
|
||||
* This attribute is "replaceable" in JavaScript
|
||||
*/
|
||||
readonly attribute nsIDOMBarProp scrollbars;
|
||||
|
||||
/**
|
||||
* Accessor for the root of this hierarchy of windows. This root may
|
||||
|
@ -75,34 +84,19 @@ interface nsIDOMWindow : nsISupports
|
|||
readonly attribute nsIDOMWindow top;
|
||||
|
||||
/**
|
||||
* Accessor for the object that controls whether or not scrollbars
|
||||
* are shown in this window.
|
||||
*
|
||||
* This attribute is "replaceable" in JavaScript
|
||||
* Accessor for this window's parent window, or the window itself if
|
||||
* there is no parent, or if the parent is of different type
|
||||
* (i.e. this does not cross chrome-content boundaries).
|
||||
*/
|
||||
readonly attribute nsIDOMBarProp scrollbars;
|
||||
readonly attribute nsIDOMWindow parent;
|
||||
|
||||
/**
|
||||
* Accessor for the child windows in this window.
|
||||
* Get the application cache object for this window.
|
||||
*/
|
||||
[noscript] readonly attribute nsIDOMWindowCollection frames;
|
||||
readonly attribute nsIDOMOfflineResourceList applicationCache;
|
||||
|
||||
/**
|
||||
* Set/Get the name of this window.
|
||||
*
|
||||
* This attribute is "replaceable" in JavaScript
|
||||
*/
|
||||
attribute DOMString name;
|
||||
/**
|
||||
* Set/Get the document scale factor as a multiplier on the default
|
||||
* size. When setting this attribute, a NS_ERROR_NOT_IMPLEMENTED
|
||||
* error may be returned by implementations not supporting
|
||||
* zoom. Implementations not supporting zoom should return 1.0 all
|
||||
* the time for the Get operation. 1.0 is equals normal size,
|
||||
* i.e. no zoom.
|
||||
*/
|
||||
[noscript] attribute float textZoom;
|
||||
|
||||
// CSSOM-View
|
||||
/**
|
||||
* Accessor for the current x scroll position in this window in
|
||||
* pixels.
|
||||
|
@ -130,11 +124,45 @@ interface nsIDOMWindow : nsISupports
|
|||
*/
|
||||
void scrollBy(in long xScrollDif, in long yScrollDif);
|
||||
|
||||
|
||||
// DOM Range
|
||||
/**
|
||||
* Method for accessing this window's selection object.
|
||||
*/
|
||||
nsISelection getSelection();
|
||||
|
||||
|
||||
// CSSOM
|
||||
/**
|
||||
* @see <http://dev.w3.org/csswg/cssom/#dom-window-getcomputedstyle>
|
||||
*/
|
||||
nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt,
|
||||
[optional] in DOMString pseudoElt);
|
||||
|
||||
|
||||
// Mozilla extensions
|
||||
/**
|
||||
* Get the window root for this window. This is useful for hooking
|
||||
* up event listeners to this window and every other window nested
|
||||
* in the window root.
|
||||
*/
|
||||
[noscript] readonly attribute nsIDOMEventTarget windowRoot;
|
||||
|
||||
/**
|
||||
* Accessor for the child windows in this window.
|
||||
*/
|
||||
[noscript] readonly attribute nsIDOMWindowCollection frames;
|
||||
|
||||
/**
|
||||
* Set/Get the document scale factor as a multiplier on the default
|
||||
* size. When setting this attribute, a NS_ERROR_NOT_IMPLEMENTED
|
||||
* error may be returned by implementations not supporting
|
||||
* zoom. Implementations not supporting zoom should return 1.0 all
|
||||
* the time for the Get operation. 1.0 is equals normal size,
|
||||
* i.e. no zoom.
|
||||
*/
|
||||
[noscript] attribute float textZoom;
|
||||
|
||||
/**
|
||||
* Method for scrolling this window by a number of lines.
|
||||
*/
|
||||
|
@ -149,10 +177,4 @@ interface nsIDOMWindow : nsISupports
|
|||
* Method for sizing this window to the content in the window.
|
||||
*/
|
||||
void sizeToContent();
|
||||
|
||||
/**
|
||||
* @see <http://dev.w3.org/csswg/cssom/#dom-window-getcomputedstyle>
|
||||
*/
|
||||
nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt,
|
||||
[optional] in DOMString pseudoElt);
|
||||
};
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Marco Pesenti Gritti <marco@gnome.org>
|
||||
* Portions created by the Initial Developer are Copyright (C) 2004
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMWindow.idl"
|
||||
|
||||
interface nsIDOMOfflineResourceList;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
[scriptable, uuid(e2796e00-14de-4ce0-acfe-0374bc0e715d)]
|
||||
interface nsIDOMWindow2 : nsIDOMWindow
|
||||
{
|
||||
/**
|
||||
* Get the window root for this window. This is useful for hooking
|
||||
* up event listeners to this window and every other window nested
|
||||
* in the window root.
|
||||
*/
|
||||
[noscript] readonly attribute nsIDOMEventTarget windowRoot;
|
||||
|
||||
/**
|
||||
* Get the application cache object for this window.
|
||||
*/
|
||||
readonly attribute nsIDOMOfflineResourceList applicationCache;
|
||||
|
||||
/**
|
||||
* Deprecated, but can't remove yet since we don't want to change interfaces.
|
||||
*/
|
||||
[noscript] DOMString createBlobURL(in nsIDOMBlob blob);
|
||||
[noscript] void revokeBlobURL(in DOMString URL);
|
||||
};
|
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDOMWindow2.idl"
|
||||
#include "nsIDOMWindow.idl"
|
||||
|
||||
%{ C++
|
||||
#include "jspubtd.h"
|
||||
|
@ -49,9 +49,10 @@ interface nsIDOMLocation;
|
|||
interface nsIVariant;
|
||||
interface nsIAnimationFrameListener;
|
||||
interface nsIDOMMediaQueryList;
|
||||
interface nsIDOMBlob;
|
||||
|
||||
[scriptable, uuid(3a7b0839-b9d6-42ff-8ba6-910aba60a966)]
|
||||
interface nsIDOMWindowInternal : nsIDOMWindow2
|
||||
[scriptable, uuid(9d96565f-2064-4d2f-b0e0-6f67a1fad89c)]
|
||||
interface nsIDOMWindowInternal : nsIDOMWindow
|
||||
{
|
||||
readonly attribute nsIDOMWindowInternal window;
|
||||
|
||||
|
|
|
@ -137,8 +137,9 @@ static PRBool
|
|||
IsCallerSecure()
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
nsContentUtils::GetSecurityManager()->
|
||||
GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = nsContentUtils::GetSecurityManager()->
|
||||
GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
if (!subjectPrincipal) {
|
||||
// No subject principal means no code is running. Default to not
|
||||
|
@ -161,7 +162,7 @@ IsCallerSecure()
|
|||
}
|
||||
|
||||
PRBool isHttps = PR_FALSE;
|
||||
nsresult rv = innerUri->SchemeIs("https", &isHttps);
|
||||
rv = innerUri->SchemeIs("https", &isHttps);
|
||||
|
||||
return NS_SUCCEEDED(rv) && isHttps;
|
||||
}
|
||||
|
@ -1470,8 +1471,9 @@ nsDOMStorage::CanUseStorage(PRPackedBool* aSessionOnly)
|
|||
return PR_TRUE;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
nsContentUtils::GetSecurityManager()->
|
||||
GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = nsContentUtils::GetSecurityManager()->
|
||||
GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
// if subjectPrincipal were null we'd have returned after
|
||||
// IsCallerChrome().
|
||||
|
@ -1533,7 +1535,8 @@ nsDOMStorage::CacheStoragePermissions()
|
|||
return PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
ssm->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = ssm->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, PR_FALSE);
|
||||
|
||||
NS_ASSERTION(mSecurityChecker, "Has non-null mSecurityChecker");
|
||||
return mSecurityChecker->CanAccess(subjectPrincipal);
|
||||
|
|
|
@ -1460,10 +1460,12 @@ PRUint32 nsWindowWatcher::CalculateChromeFlags(const char *aFeatures,
|
|||
NS_ENSURE_TRUE(securityManager, NS_ERROR_FAILURE);
|
||||
|
||||
PRBool isChrome = PR_FALSE;
|
||||
securityManager->SubjectPrincipalIsSystem(&isChrome);
|
||||
nsresult rv = securityManager->SubjectPrincipalIsSystem(&isChrome);
|
||||
if (NS_FAILED(rv)) {
|
||||
isChrome = PR_FALSE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch;
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, PR_TRUE);
|
||||
|
||||
|
@ -1984,7 +1986,10 @@ nsWindowWatcher::SizeOpenedDocShellItem(nsIDocShellTreeItem *aDocShellItem,
|
|||
nsCOMPtr<nsIDOMChromeWindow> chromeWin(do_QueryInterface(aParent));
|
||||
|
||||
PRBool isChrome = PR_FALSE;
|
||||
securityManager->SubjectPrincipalIsSystem(&isChrome);
|
||||
nsresult rv = securityManager->SubjectPrincipalIsSystem(&isChrome);
|
||||
if (NS_FAILED(rv)) {
|
||||
isChrome = PR_FALSE;
|
||||
}
|
||||
|
||||
// Only enable special priveleges for chrome when chrome calls
|
||||
// open() on a chrome window
|
||||
|
|
|
@ -89,6 +89,7 @@
|
|||
#include "nsCSSRendering.h"
|
||||
#include "FrameLayerBuilder.h"
|
||||
#include "nsRenderingContext.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -3984,7 +3985,7 @@ nsBlockFrame::SplitFloat(nsBlockReflowState& aState,
|
|||
if (nextInFlow) {
|
||||
nsContainerFrame *oldParent =
|
||||
static_cast<nsContainerFrame*>(nextInFlow->GetParent());
|
||||
nsresult rv = oldParent->StealFrame(aState.mPresContext, nextInFlow);
|
||||
DebugOnly<nsresult> rv = oldParent->StealFrame(aState.mPresContext, nextInFlow);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "StealFrame failed");
|
||||
if (oldParent != this) {
|
||||
ReparentFrame(nextInFlow, oldParent, this);
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
|
||||
#include "nsINameSpaceManager.h"
|
||||
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nsBlockDebugFlags.h"
|
||||
|
@ -941,7 +942,7 @@ nsBlockReflowState::PushFloatPastBreak(nsIFrame *aFloat)
|
|||
|
||||
// Put the float on the pushed floats list, even though it
|
||||
// isn't actually a continuation.
|
||||
nsresult rv = mBlock->StealFrame(mPresContext, aFloat);
|
||||
DebugOnly<nsresult> rv = mBlock->StealFrame(mPresContext, aFloat);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "StealFrame should succeed");
|
||||
AppendPushedFloat(aFloat);
|
||||
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
#include "ImageLayers.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -773,7 +774,7 @@ nsImageFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
|
|||
{
|
||||
// XXX The caller doesn't account for constraints of the height,
|
||||
// min-height, and max-height properties.
|
||||
nscoord result;
|
||||
DebugOnly<nscoord> result;
|
||||
DISPLAY_MIN_WIDTH(this, result);
|
||||
nsPresContext *presContext = PresContext();
|
||||
EnsureIntrinsicSizeAndRatio(presContext);
|
||||
|
@ -786,7 +787,7 @@ nsImageFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
|
|||
{
|
||||
// XXX The caller doesn't account for constraints of the height,
|
||||
// min-height, and max-height properties.
|
||||
nscoord result;
|
||||
DebugOnly<nscoord> result;
|
||||
DISPLAY_PREF_WIDTH(this, result);
|
||||
nsPresContext *presContext = PresContext();
|
||||
EnsureIntrinsicSizeAndRatio(presContext);
|
||||
|
|
|
@ -1383,7 +1383,7 @@ nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext,
|
|||
window.window = &gWorld;
|
||||
npprint.print.embedPrint.platformPrint = gWorld;
|
||||
npprint.print.embedPrint.window = window;
|
||||
nsresult rv = pi->Print(&npprint);
|
||||
pi->Print(&npprint);
|
||||
|
||||
::CGContextTranslateCTM(cgContext, 0.0f, float(window.height));
|
||||
::CGContextScaleCTM(cgContext, 1.0f, -1.0f);
|
||||
|
|
|
@ -113,7 +113,9 @@
|
|||
#include "gfxContext.h"
|
||||
#include "gfxTextRunWordCache.h"
|
||||
#include "gfxImageSurface.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#undef NOISY_BLINK
|
||||
|
@ -461,7 +463,7 @@ UnhookTextRunFromFrames(gfxTextRun* aTextRun, nsTextFrame* aStartContinuation)
|
|||
|
||||
if (aTextRun->GetFlags() & nsTextFrameUtils::TEXT_IS_SIMPLE_FLOW) {
|
||||
nsIFrame* userDataFrame = static_cast<nsIFrame*>(aTextRun->GetUserData());
|
||||
PRBool found =
|
||||
DebugOnly<PRBool> found =
|
||||
ClearAllTextRunReferences(static_cast<nsTextFrame*>(userDataFrame),
|
||||
aTextRun, aStartContinuation);
|
||||
NS_ASSERTION(!aStartContinuation || found,
|
||||
|
|
|
@ -1576,14 +1576,15 @@ nsCSSStyleSheet::SubjectSubsumesInnerPrincipal() const
|
|||
nsContentUtils::GetSecurityManager();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> subjectPrincipal;
|
||||
securityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
nsresult rv = securityManager->GetSubjectPrincipal(getter_AddRefs(subjectPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!subjectPrincipal) {
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
}
|
||||
|
||||
PRBool subsumes;
|
||||
nsresult rv = subjectPrincipal->Subsumes(mInner->mPrincipal, &subsumes);
|
||||
rv = subjectPrincipal->Subsumes(mInner->mPrincipal, &subsumes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (subsumes) {
|
||||
|
|
|
@ -345,8 +345,6 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
|||
nsHtml5OtherDocUpdate update(node->GetOwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
|
||||
nsIDocument* document = node->GetCurrentDoc();
|
||||
|
||||
PRInt32 len = attributes->getLength();
|
||||
for (PRInt32 i = len; i > 0;) {
|
||||
--i;
|
||||
|
|
|
@ -2013,7 +2013,8 @@ nsCrypto::GenerateCRMFRequest(nsIDOMCRMFObject** aReturn)
|
|||
NS_ENSURE_TRUE(secMan, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principals;
|
||||
secMan->GetSubjectPrincipal(getter_AddRefs(principals));
|
||||
nsresult rv = secMan->GetSubjectPrincipal(getter_AddRefs(principals));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(principals, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCryptoRunArgs *args = new nsCryptoRunArgs();
|
||||
|
@ -2031,7 +2032,7 @@ nsCrypto::GenerateCRMFRequest(nsIDOMCRMFObject** aReturn)
|
|||
if (!cryptoRunnable)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = NS_DispatchToMainThread(cryptoRunnable);
|
||||
rv = NS_DispatchToMainThread(cryptoRunnable);
|
||||
if (NS_FAILED(rv))
|
||||
delete cryptoRunnable;
|
||||
|
||||
|
|
|
@ -111,8 +111,17 @@ PASSWORDS_STORE_BATCH_SIZE: 50, // same as MOBILE_BATCH_SIZE
|
|||
|
||||
// score thresholds for early syncs
|
||||
SINGLE_USER_THRESHOLD: 1000,
|
||||
MULTI_DESKTOP_THRESHOLD: 500,
|
||||
MULTI_MOBILE_THRESHOLD: 100,
|
||||
MULTI_DEVICE_THRESHOLD: 300,
|
||||
|
||||
// Other score increment constants
|
||||
SCORE_INCREMENT_SMALL: 1,
|
||||
SCORE_INCREMENT_MEDIUM: 10,
|
||||
|
||||
// Instant sync score increment
|
||||
SCORE_INCREMENT_XLARGE: 300 + 1, //MULTI_DEVICE_THRESHOLD + 1
|
||||
|
||||
// Delay before incrementing global score
|
||||
SCORE_UPDATE_DELAY: 100,
|
||||
|
||||
// File IO Flags
|
||||
MODE_RDONLY: 0x01,
|
||||
|
|
|
@ -211,6 +211,11 @@ Store.prototype = {
|
|||
for each (let record in records) {
|
||||
try {
|
||||
this.applyIncoming(record);
|
||||
} catch (ex if (ex.code == Engine.prototype.eEngineAbortApplyIncoming)) {
|
||||
// This kind of exception should have a 'cause' attribute, which is an
|
||||
// originating exception.
|
||||
// ex.cause will carry its stack with it when rethrown.
|
||||
throw ex.cause;
|
||||
} catch (ex) {
|
||||
this._log.warn("Failed to apply incoming record " + record.id);
|
||||
this._log.warn("Encountered exception: " + Utils.exceptionStr(ex));
|
||||
|
@ -362,6 +367,10 @@ Engine.prototype = {
|
|||
_storeObj: Store,
|
||||
_trackerObj: Tracker,
|
||||
|
||||
// Local 'constant'.
|
||||
// Signal to the engine that processing further records is pointless.
|
||||
eEngineAbortApplyIncoming: "error.engine.abort.applyincoming",
|
||||
|
||||
get prefName() this.name,
|
||||
get enabled() Svc.Prefs.get("engine." + this.prefName, false),
|
||||
set enabled(val) Svc.Prefs.set("engine." + this.prefName, !!val),
|
||||
|
@ -659,9 +668,22 @@ SyncEngine.prototype = {
|
|||
// Reset previousFailed for each sync since previously failed items may not fail again.
|
||||
this.previousFailed = [];
|
||||
|
||||
// Used (via exceptions) to allow the record handler/reconciliation/etc.
|
||||
// methods to signal that they would like processing of incoming records to
|
||||
// cease.
|
||||
let aborting = undefined;
|
||||
|
||||
function doApplyBatch() {
|
||||
this._tracker.ignoreAll = true;
|
||||
failed = failed.concat(this._store.applyIncomingBatch(applyBatch));
|
||||
try {
|
||||
failed = failed.concat(this._store.applyIncomingBatch(applyBatch));
|
||||
} catch (ex) {
|
||||
// Catch any error that escapes from applyIncomingBatch. At present
|
||||
// those will all be abort events.
|
||||
this._log.warn("Got exception " + Utils.exceptionStr(ex) +
|
||||
", aborting processIncoming.");
|
||||
aborting = ex;
|
||||
}
|
||||
this._tracker.ignoreAll = false;
|
||||
applyBatch = [];
|
||||
}
|
||||
|
@ -684,6 +706,10 @@ SyncEngine.prototype = {
|
|||
// called for every incoming record.
|
||||
let self = this;
|
||||
newitems.recordHandler = function(item) {
|
||||
if (aborting) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Grab a later last modified if possible
|
||||
if (self.lastModified == null || item.modified > self.lastModified)
|
||||
self.lastModified = item.modified;
|
||||
|
@ -737,6 +763,10 @@ SyncEngine.prototype = {
|
|||
let shouldApply;
|
||||
try {
|
||||
shouldApply = self._reconcile(item);
|
||||
} catch (ex if (ex.code == Engine.prototype.eEngineAbortApplyIncoming)) {
|
||||
self._log.warn("Reconciliation failed: aborting incoming processing.");
|
||||
failed.push(item.id);
|
||||
aborting = ex.cause;
|
||||
} catch (ex) {
|
||||
self._log.warn("Failed to reconcile incoming record " + item.id);
|
||||
self._log.warn("Encountered exception: " + Utils.exceptionStr(ex));
|
||||
|
@ -766,6 +796,10 @@ SyncEngine.prototype = {
|
|||
resp.failureCode = ENGINE_DOWNLOAD_FAIL;
|
||||
throw resp;
|
||||
}
|
||||
|
||||
if (aborting) {
|
||||
throw aborting;
|
||||
}
|
||||
}
|
||||
|
||||
// Mobile: check if we got the maximum that we requested; get the rest if so.
|
||||
|
@ -804,7 +838,7 @@ SyncEngine.prototype = {
|
|||
batchSize = isMobile ? this.mobileGUIDFetchBatchSize :
|
||||
this.guidFetchBatchSize;
|
||||
|
||||
while (fetchBatch.length) {
|
||||
while (fetchBatch.length && !aborting) {
|
||||
// Reuse the original query, but get rid of the restricting params
|
||||
// and batch remaining records.
|
||||
newitems.limit = 0;
|
||||
|
@ -828,6 +862,11 @@ SyncEngine.prototype = {
|
|||
this._log.debug("Records that failed to apply: " + failed);
|
||||
}
|
||||
failed = [];
|
||||
|
||||
if (aborting) {
|
||||
throw aborting;
|
||||
}
|
||||
|
||||
if (this.lastSync < this.lastModified) {
|
||||
this.lastSync = this.lastModified;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ Cu.import("resource://services-sync/engines.js");
|
|||
Cu.import("resource://services-sync/record.js");
|
||||
Cu.import("resource://services-sync/async.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
|
||||
Cu.import("resource://services-sync/main.js"); // For access to Service.
|
||||
|
||||
|
@ -262,11 +263,128 @@ BookmarksEngine.prototype = {
|
|||
}, null);
|
||||
|
||||
// Expose the exception if something inside the batch failed
|
||||
if (batchEx!= null) {
|
||||
if (batchEx != null) {
|
||||
throw batchEx;
|
||||
}
|
||||
},
|
||||
|
||||
_guidMapFailed: false,
|
||||
_buildGUIDMap: function _buildGUIDMap() {
|
||||
let guidMap = {};
|
||||
for (let guid in this._store.getAllIDs()) {
|
||||
// Figure out with which key to store the mapping.
|
||||
let key;
|
||||
let id = this._store.idForGUID(guid);
|
||||
switch (PlacesUtils.bookmarks.getItemType(id)) {
|
||||
case PlacesUtils.bookmarks.TYPE_BOOKMARK:
|
||||
|
||||
// Smart bookmarks map to their annotation value.
|
||||
let queryId;
|
||||
try {
|
||||
queryId = PlacesUtils.annotations.getItemAnnotation(
|
||||
id, SMART_BOOKMARKS_ANNO);
|
||||
} catch(ex) {}
|
||||
|
||||
if (queryId)
|
||||
key = "q" + queryId;
|
||||
else
|
||||
key = "b" + PlacesUtils.bookmarks.getBookmarkURI(id).spec + ":" +
|
||||
PlacesUtils.bookmarks.getItemTitle(id);
|
||||
break;
|
||||
case PlacesUtils.bookmarks.TYPE_FOLDER:
|
||||
key = "f" + PlacesUtils.bookmarks.getItemTitle(id);
|
||||
break;
|
||||
case PlacesUtils.bookmarks.TYPE_SEPARATOR:
|
||||
key = "s" + PlacesUtils.bookmarks.getItemIndex(id);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
// The mapping is on a per parent-folder-name basis.
|
||||
let parent = PlacesUtils.bookmarks.getFolderIdForItem(id);
|
||||
if (parent <= 0)
|
||||
continue;
|
||||
|
||||
let parentName = PlacesUtils.bookmarks.getItemTitle(parent);
|
||||
if (guidMap[parentName] == null)
|
||||
guidMap[parentName] = {};
|
||||
|
||||
// If the entry already exists, remember that there are explicit dupes.
|
||||
let entry = new String(guid);
|
||||
entry.hasDupe = guidMap[parentName][key] != null;
|
||||
|
||||
// Remember this item's GUID for its parent-name/key pair.
|
||||
guidMap[parentName][key] = entry;
|
||||
this._log.trace("Mapped: " + [parentName, key, entry, entry.hasDupe]);
|
||||
}
|
||||
|
||||
return guidMap;
|
||||
},
|
||||
|
||||
// Helper function to get a dupe GUID for an item.
|
||||
_mapDupe: function _mapDupe(item) {
|
||||
// Figure out if we have something to key with.
|
||||
let key;
|
||||
let altKey;
|
||||
switch (item.type) {
|
||||
case "query":
|
||||
// Prior to Bug 610501, records didn't carry their Smart Bookmark
|
||||
// anno, so we won't be able to dupe them correctly. This altKey
|
||||
// hack should get them to dupe correctly.
|
||||
if (item.queryId) {
|
||||
key = "q" + item.queryId;
|
||||
altKey = "b" + item.bmkUri + ":" + item.title;
|
||||
break;
|
||||
}
|
||||
// No queryID? Fall through to the regular bookmark case.
|
||||
case "bookmark":
|
||||
case "microsummary":
|
||||
key = "b" + item.bmkUri + ":" + item.title;
|
||||
break;
|
||||
case "folder":
|
||||
case "livemark":
|
||||
key = "f" + item.title;
|
||||
break;
|
||||
case "separator":
|
||||
key = "s" + item.pos;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Figure out if we have a map to use!
|
||||
// This will throw in some circumstances. That's fine.
|
||||
let guidMap = this._guidMap;
|
||||
|
||||
// Give the GUID if we have the matching pair.
|
||||
this._log.trace("Finding mapping: " + item.parentName + ", " + key);
|
||||
let parent = guidMap[item.parentName];
|
||||
|
||||
if (!parent) {
|
||||
this._log.trace("No parent => no dupe.");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let dupe = parent[key];
|
||||
|
||||
if (dupe) {
|
||||
this._log.trace("Mapped dupe: " + dupe);
|
||||
return dupe;
|
||||
}
|
||||
|
||||
if (altKey) {
|
||||
dupe = parent[altKey];
|
||||
if (dupe) {
|
||||
this._log.trace("Mapped dupe using altKey " + altKey + ": " + dupe);
|
||||
return dupe;
|
||||
}
|
||||
}
|
||||
|
||||
this._log.trace("No dupe found for key " + key + "/" + altKey + ".");
|
||||
return undefined;
|
||||
},
|
||||
|
||||
_syncStartup: function _syncStart() {
|
||||
SyncEngine.prototype._syncStartup.call(this);
|
||||
|
||||
|
@ -274,117 +392,19 @@ BookmarksEngine.prototype = {
|
|||
if (this.lastSync == 0)
|
||||
archiveBookmarks();
|
||||
|
||||
// Lazily create a mapping of folder titles and separator positions to GUID
|
||||
this.__defineGetter__("_lazyMap", function() {
|
||||
delete this._lazyMap;
|
||||
|
||||
let lazyMap = {};
|
||||
for (let guid in this._store.getAllIDs()) {
|
||||
// Figure out what key to store the mapping
|
||||
let key;
|
||||
let id = this._store.idForGUID(guid);
|
||||
switch (PlacesUtils.bookmarks.getItemType(id)) {
|
||||
case PlacesUtils.bookmarks.TYPE_BOOKMARK:
|
||||
|
||||
// Smart bookmarks map to their annotation value.
|
||||
let queryId;
|
||||
try {
|
||||
queryId = PlacesUtils.annotations.getItemAnnotation(
|
||||
id, SMART_BOOKMARKS_ANNO);
|
||||
} catch(ex) {}
|
||||
|
||||
if (queryId)
|
||||
key = "q" + queryId;
|
||||
else
|
||||
key = "b" + PlacesUtils.bookmarks.getBookmarkURI(id).spec + ":" +
|
||||
PlacesUtils.bookmarks.getItemTitle(id);
|
||||
break;
|
||||
case PlacesUtils.bookmarks.TYPE_FOLDER:
|
||||
key = "f" + PlacesUtils.bookmarks.getItemTitle(id);
|
||||
break;
|
||||
case PlacesUtils.bookmarks.TYPE_SEPARATOR:
|
||||
key = "s" + PlacesUtils.bookmarks.getItemIndex(id);
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
// The mapping is on a per parent-folder-name basis
|
||||
let parent = PlacesUtils.bookmarks.getFolderIdForItem(id);
|
||||
if (parent <= 0)
|
||||
continue;
|
||||
|
||||
let parentName = PlacesUtils.bookmarks.getItemTitle(parent);
|
||||
if (lazyMap[parentName] == null)
|
||||
lazyMap[parentName] = {};
|
||||
|
||||
// If the entry already exists, remember that there are explicit dupes
|
||||
let entry = new String(guid);
|
||||
entry.hasDupe = lazyMap[parentName][key] != null;
|
||||
|
||||
// Remember this item's guid for its parent-name/key pair
|
||||
lazyMap[parentName][key] = entry;
|
||||
this._log.trace("Mapped: " + [parentName, key, entry, entry.hasDupe]);
|
||||
this.__defineGetter__("_guidMap", function() {
|
||||
// Create a mapping of folder titles and separator positions to GUID.
|
||||
// We do this lazily so that we don't do any work unless we reconcile
|
||||
// incoming items.
|
||||
try {
|
||||
return this._guidMap = this._buildGUIDMap();
|
||||
} catch (ex) {
|
||||
this._log.warn("Got exception \"" + Utils.exceptionStr(ex) +
|
||||
"\" building GUID map." +
|
||||
" Skipping all other incoming items.");
|
||||
throw {code: Engine.prototype.eEngineAbortApplyIncoming,
|
||||
cause: ex};
|
||||
}
|
||||
|
||||
// Expose a helper function to get a dupe guid for an item
|
||||
return this._lazyMap = function(item) {
|
||||
// Figure out if we have something to key with
|
||||
let key;
|
||||
let altKey;
|
||||
switch (item.type) {
|
||||
case "query":
|
||||
// Prior to Bug 610501, records didn't carry their Smart Bookmark
|
||||
// anno, so we won't be able to dupe them correctly. This altKey
|
||||
// hack should get them to dupe correctly.
|
||||
if (item.queryId) {
|
||||
key = "q" + item.queryId;
|
||||
altKey = "b" + item.bmkUri + ":" + item.title;
|
||||
break;
|
||||
}
|
||||
// No queryID? Fall through to the regular bookmark case.
|
||||
case "bookmark":
|
||||
case "microsummary":
|
||||
key = "b" + item.bmkUri + ":" + item.title;
|
||||
break;
|
||||
case "folder":
|
||||
case "livemark":
|
||||
key = "f" + item.title;
|
||||
break;
|
||||
case "separator":
|
||||
key = "s" + item.pos;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
// Give the guid if we have the matching pair
|
||||
this._log.trace("Finding mapping: " + item.parentName + ", " + key);
|
||||
let parent = lazyMap[item.parentName];
|
||||
|
||||
if (!parent) {
|
||||
this._log.trace("No parent => no dupe.");
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let dupe = parent[key];
|
||||
|
||||
if (dupe) {
|
||||
this._log.trace("Mapped dupe: " + dupe);
|
||||
return dupe;
|
||||
}
|
||||
|
||||
if (altKey) {
|
||||
dupe = parent[altKey];
|
||||
if (dupe) {
|
||||
this._log.trace("Mapped dupe using altKey " + altKey + ": " + dupe);
|
||||
return dupe;
|
||||
}
|
||||
}
|
||||
|
||||
this._log.trace("No dupe found for key " + key + "/" + altKey + ".");
|
||||
return undefined;
|
||||
};
|
||||
});
|
||||
|
||||
this._store._childrenToOrder = {};
|
||||
|
@ -404,14 +424,18 @@ BookmarksEngine.prototype = {
|
|||
|
||||
_syncFinish: function _syncFinish() {
|
||||
SyncEngine.prototype._syncFinish.call(this);
|
||||
delete this._lazyMap;
|
||||
this._tracker._ensureMobileQuery();
|
||||
},
|
||||
|
||||
_syncCleanup: function _syncCleanup() {
|
||||
SyncEngine.prototype._syncCleanup.call(this);
|
||||
delete this._guidMap;
|
||||
},
|
||||
|
||||
_createRecord: function _createRecord(id) {
|
||||
// Create the record like normal but mark it as having dupes if necessary
|
||||
let record = SyncEngine.prototype._createRecord.call(this, id);
|
||||
let entry = this._lazyMap(record);
|
||||
let entry = this._mapDupe(record);
|
||||
if (entry != null && entry.hasDupe)
|
||||
record.hasDupe = true;
|
||||
return record;
|
||||
|
@ -421,7 +445,7 @@ BookmarksEngine.prototype = {
|
|||
// Don't bother finding a dupe if the incoming item has duplicates
|
||||
if (item.hasDupe)
|
||||
return;
|
||||
return this._lazyMap(item);
|
||||
return this._mapDupe(item);
|
||||
},
|
||||
|
||||
_handleDupe: function _handleDupe(item, dupeId) {
|
||||
|
@ -1020,7 +1044,7 @@ BookmarksStore.prototype = {
|
|||
record = new BookmarkSeparator(collection, id);
|
||||
if (parent > 0)
|
||||
record.parentName = PlacesUtils.bookmarks.getItemTitle(parent);
|
||||
// Create a positioning identifier for the separator, used by _lazyMap
|
||||
// Create a positioning identifier for the separator, used by _mapDupe
|
||||
record.pos = PlacesUtils.bookmarks.getItemIndex(placeId);
|
||||
break;
|
||||
|
||||
|
@ -1294,9 +1318,9 @@ BookmarksTracker.prototype = {
|
|||
this._upScore();
|
||||
},
|
||||
|
||||
/* Every add/remove/change is worth 10 points */
|
||||
/* Every add/remove/change will trigger a sync for MULTI_DEVICE */
|
||||
_upScore: function BMT__upScore() {
|
||||
this.score += 10;
|
||||
this.score += SCORE_INCREMENT_XLARGE;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -238,7 +238,7 @@ FormTracker.prototype = {
|
|||
|
||||
trackEntry: function trackEntry(name, value) {
|
||||
this.addChangedID(FormWrapper.getGUID(name, value));
|
||||
this.score += 10;
|
||||
this.score += SCORE_INCREMENT_MEDIUM;
|
||||
},
|
||||
|
||||
_enabled: false,
|
||||
|
|
|
@ -430,10 +430,10 @@ HistoryTracker.prototype = {
|
|||
onTitleChanged: function HT_onTitleChanged() {},
|
||||
|
||||
/* Every add or remove is worth 1 point.
|
||||
* Clearing the whole history is worth 50 points (see below)
|
||||
* Clearing all history will trigger a sync for MULTI-DEVICE (see below)
|
||||
*/
|
||||
_upScore: function BMT__upScore() {
|
||||
this.score += 1;
|
||||
this.score += SCORE_INCREMENT_SMALL;
|
||||
},
|
||||
|
||||
onVisit: function HT_onVisit(uri, vid, time, session, referrer, trans, guid) {
|
||||
|
@ -458,6 +458,6 @@ HistoryTracker.prototype = {
|
|||
},
|
||||
onClearHistory: function HT_onClearHistory() {
|
||||
this._log.trace("onClearHistory");
|
||||
this.score += 500;
|
||||
this.score += SCORE_INCREMENT_XLARGE;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -318,11 +318,13 @@ PasswordTracker.prototype = {
|
|||
if (this.ignoreAll)
|
||||
return;
|
||||
|
||||
// A single add, remove or change is 15 points, all items removed is 50
|
||||
// A single add, remove or change or removing all items
|
||||
// will trigger a sync for MULTI_DEVICE.
|
||||
switch (aData) {
|
||||
case 'modifyLogin':
|
||||
aSubject = aSubject.QueryInterface(Ci.nsIArray).
|
||||
queryElementAt(1, Ci.nsILoginMetaInfo);
|
||||
// fallthrough
|
||||
case 'addLogin':
|
||||
case 'removeLogin':
|
||||
// Skip over Weave password/passphrase changes
|
||||
|
@ -331,13 +333,13 @@ PasswordTracker.prototype = {
|
|||
if (aSubject.hostname == PWDMGR_HOST)
|
||||
break;
|
||||
|
||||
this.score += 15;
|
||||
this.score += SCORE_INCREMENT_XLARGE;
|
||||
this._log.trace(aData + ": " + aSubject.guid);
|
||||
this.addChangedID(aSubject.guid);
|
||||
break;
|
||||
case 'removeAllLogins':
|
||||
this._log.trace(aData);
|
||||
this.score += 500;
|
||||
this.score += SCORE_INCREMENT_XLARGE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ const WEAVE_SYNC_PREFS = "services.sync.prefs.sync.";
|
|||
Cu.import("resource://services-sync/engines.js");
|
||||
Cu.import("resource://services-sync/record.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
Cu.import("resource://services-sync/ext/Preferences.js");
|
||||
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
|
||||
|
||||
|
@ -270,16 +271,11 @@ PrefTracker.prototype = {
|
|||
.getService(Ci.nsIPrefBranch2).removeObserver("", this);
|
||||
break;
|
||||
case "nsPref:changed":
|
||||
// 100 points for a change that determines which prefs are synced,
|
||||
// 25 points per regular pref change.
|
||||
let up;
|
||||
if (aData.indexOf(WEAVE_SYNC_PREFS) == 0)
|
||||
up = 100;
|
||||
else if (this._prefs.get(WEAVE_SYNC_PREFS + aData, false))
|
||||
up = 25;
|
||||
|
||||
if (up) {
|
||||
this.score += up;
|
||||
// Trigger a sync for MULTI-DEVICE for a change that determines
|
||||
// which prefs are synced or a regular pref change.
|
||||
if (aData.indexOf(WEAVE_SYNC_PREFS) == 0 ||
|
||||
this._prefs.get(WEAVE_SYNC_PREFS + aData, false)) {
|
||||
this.score += SCORE_INCREMENT_XLARGE;
|
||||
this.modified = true;
|
||||
this._log.trace("Preference " + aData + " changed");
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ Cu.import("resource://services-sync/engines/clients.js");
|
|||
Cu.import("resource://services-sync/record.js");
|
||||
Cu.import("resource://services-sync/resource.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
Cu.import("resource://services-sync/ext/Preferences.js");
|
||||
|
||||
// It is safer to inspect the private browsing preferences rather than
|
||||
|
@ -355,6 +356,6 @@ TabTracker.prototype = {
|
|||
|
||||
// Only increase the score by whole numbers, so use random for partial score
|
||||
if (Math.random() < chance)
|
||||
this.score++;
|
||||
this.score += SCORE_INCREMENT_SMALL;
|
||||
},
|
||||
}
|
||||
|
|
|
@ -45,9 +45,6 @@ const Ci = Components.interfaces;
|
|||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
|
||||
// how long we should wait before actually syncing on idle
|
||||
const IDLE_TIME = 5; // xxxmpc: in seconds, should be preffable
|
||||
|
||||
// How long before refreshing the cluster
|
||||
const CLUSTER_BACKOFF = 5 * 60 * 1000; // 5 minutes
|
||||
|
||||
|
@ -592,7 +589,8 @@ WeaveSvc.prototype = {
|
|||
Status.minimumNextSync = Date.now() + data;
|
||||
break;
|
||||
case "weave:engine:score:updated":
|
||||
this._handleScoreUpdate();
|
||||
Utils.namedTimer(this._calculateScore, SCORE_UPDATE_DELAY, this,
|
||||
"_scoreTimer");
|
||||
break;
|
||||
case "weave:engine:sync:apply-failed":
|
||||
// An engine isn't able to apply one or more incoming records.
|
||||
|
@ -605,12 +603,6 @@ WeaveSvc.prototype = {
|
|||
case "weave:resource:status:401":
|
||||
this._handleResource401(subject);
|
||||
break;
|
||||
case "idle":
|
||||
this._log.trace("Idle time hit, trying to sync");
|
||||
Svc.Idle.removeIdleObserver(this, this._idleTime);
|
||||
this._idleTime = 0;
|
||||
Utils.nextTick(this.sync, this);
|
||||
break;
|
||||
case "nsPref:changed":
|
||||
if (this._ignorePrefObserver)
|
||||
return;
|
||||
|
@ -620,12 +612,6 @@ WeaveSvc.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
_handleScoreUpdate: function WeaveSvc__handleScoreUpdate() {
|
||||
const SCORE_UPDATE_DELAY = 3000;
|
||||
Utils.namedTimer(this._calculateScore, SCORE_UPDATE_DELAY, this,
|
||||
"_scoreTimer");
|
||||
},
|
||||
|
||||
_calculateScore: function WeaveSvc_calculateScoreAndDoStuff() {
|
||||
var engines = Engines.getEnabled();
|
||||
for (let i = 0;i < engines.length;i++) {
|
||||
|
@ -1506,13 +1492,6 @@ WeaveSvc.prototype = {
|
|||
this._syncTimer.clear();
|
||||
if (this._heartbeatTimer)
|
||||
this._heartbeatTimer.clear();
|
||||
|
||||
// Clear out a sync that's just waiting for idle if we happen to have one
|
||||
try {
|
||||
Svc.Idle.removeIdleObserver(this, this._idleTime);
|
||||
this._idleTime = 0;
|
||||
}
|
||||
catch(ex) {}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1547,29 +1526,22 @@ WeaveSvc.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Call sync() on an idle timer
|
||||
*
|
||||
* delay is optional
|
||||
* Call sync() if Master Password is not locked.
|
||||
*
|
||||
* Otherwise, reschedule a sync for later.
|
||||
*/
|
||||
syncOnIdle: function WeaveSvc_syncOnIdle(delay) {
|
||||
// No need to add a duplicate idle observer, and no point if we got kicked
|
||||
// out by the master password dialog.
|
||||
syncIfMPUnlocked: function syncIfMPUnlocked() {
|
||||
// No point if we got kicked out by the master password dialog.
|
||||
if (Status.login == MASTER_PASSWORD_LOCKED &&
|
||||
Utils.mpLocked()) {
|
||||
this._log.debug("Not syncing on idle: Login status is " + Status.login);
|
||||
this._log.debug("Not initiating sync: Login status is " + Status.login);
|
||||
|
||||
// If we're not syncing now, we need to schedule the next one.
|
||||
this._scheduleAtInterval(MASTER_PASSWORD_LOCKED_RETRY_INTERVAL);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._idleTime)
|
||||
return false;
|
||||
|
||||
this._idleTime = delay || IDLE_TIME;
|
||||
this._log.debug("Idle timer created for sync, will sync after " +
|
||||
this._idleTime + " seconds of inactivity.");
|
||||
Svc.Idle.addIdleObserver(this, this._idleTime);
|
||||
Utils.nextTick(this.sync, this);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1588,13 +1560,12 @@ WeaveSvc.prototype = {
|
|||
|
||||
// Start the sync right away if we're already late
|
||||
if (interval <= 0) {
|
||||
if (this.syncOnIdle())
|
||||
this._log.debug("Syncing as soon as we're idle.");
|
||||
this.syncIfMPUnlocked();
|
||||
return;
|
||||
}
|
||||
|
||||
this._log.trace("Next sync in " + Math.ceil(interval / 1000) + " sec.");
|
||||
Utils.namedTimer(this.syncOnIdle, interval, this, "_syncTimer");
|
||||
Utils.namedTimer(this.syncIfMPUnlocked, interval, this, "_syncTimer");
|
||||
|
||||
// Save the next sync time in-case sync is disabled (logout/offline/etc.)
|
||||
this.nextSync = Date.now() + interval;
|
||||
|
@ -1625,7 +1596,7 @@ WeaveSvc.prototype = {
|
|||
" Local timestamp: " + Clients.lastSync);
|
||||
if (info.obj["clients"] > Clients.lastSync) {
|
||||
this._log.debug("New clients detected, triggering a full sync");
|
||||
this.syncOnIdle();
|
||||
this.syncIfMPUnlocked();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1897,7 +1868,7 @@ WeaveSvc.prototype = {
|
|||
}
|
||||
else {
|
||||
this.syncInterval = hasMobile ? MULTI_MOBILE_SYNC : MULTI_DESKTOP_SYNC;
|
||||
this.syncThreshold = hasMobile ? MULTI_MOBILE_THRESHOLD : MULTI_DESKTOP_THRESHOLD;
|
||||
this.syncThreshold = MULTI_DEVICE_THRESHOLD;
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -48,12 +48,5 @@ XPCSHELL_TESTS = unit
|
|||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# Preprocessor.py won't recognize DEBUG as defined if you just pass -DDEBUG.
|
||||
# See bug 664313. (Also, yay for consistency with DEBUG v. MOZ_DEBUG.)
|
||||
SYNCDEFINES=
|
||||
ifdef MOZ_DEBUG
|
||||
SYNCDEFINES += -DDEBUG=1
|
||||
endif
|
||||
|
||||
libs:: unit/head_appinfo.js.in
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(SYNCDEFINES) $^ > $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/head_appinfo.js
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $^ > $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/head_appinfo.js
|
||||
|
|
|
@ -32,17 +32,16 @@ add_test(function bad_record_allIDs() {
|
|||
|
||||
_("Fetching all IDs.");
|
||||
let all = store.getAllIDs();
|
||||
|
||||
|
||||
_("All IDs: " + JSON.stringify(all));
|
||||
do_check_true("menu" in all);
|
||||
do_check_true("toolbar" in all);
|
||||
|
||||
|
||||
_("Clean up.");
|
||||
PlacesUtils.bookmarks.removeItem(badRecordID);
|
||||
run_next_test();
|
||||
});
|
||||
|
||||
|
||||
|
||||
add_test(function test_ID_caching() {
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
|
||||
|
@ -170,7 +169,7 @@ add_test(function test_restorePromptsReupload() {
|
|||
Service.clusterURL = "http://localhost:8080/";
|
||||
|
||||
let collection = new ServerCollection({}, true);
|
||||
|
||||
|
||||
let engine = new BookmarksEngine();
|
||||
let store = engine._store;
|
||||
let global = new ServerWBO('global',
|
||||
|
@ -262,7 +261,7 @@ add_test(function test_restorePromptsReupload() {
|
|||
|
||||
_("Have the correct number of IDs locally, too.");
|
||||
do_check_eq(count, ["menu", "toolbar", folder1_id, bmk1_id].length);
|
||||
|
||||
|
||||
_("Sync again. This'll wipe bookmarks from the server.");
|
||||
try {
|
||||
engine.sync();
|
||||
|
@ -385,6 +384,64 @@ add_test(function test_mismatched_types() {
|
|||
}
|
||||
});
|
||||
|
||||
add_test(function test_bookmark_guidMap_fail() {
|
||||
_("Ensure that failures building the GUID map cause early death.");
|
||||
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
|
||||
Svc.Prefs.set("username", "foo");
|
||||
let collection = new ServerCollection();
|
||||
let engine = new BookmarksEngine();
|
||||
let store = engine._store;
|
||||
let global = new ServerWBO('global',
|
||||
{engines: {bookmarks: {version: engine.version,
|
||||
syncID: engine.syncID}}});
|
||||
let server = httpd_setup({
|
||||
"/1.1/foo/storage/meta/global": global.handler(),
|
||||
"/1.1/foo/storage/bookmarks": collection.handler()
|
||||
});
|
||||
|
||||
// Add one item to the server.
|
||||
let itemID = PlacesUtils.bookmarks.createFolder(
|
||||
PlacesUtils.bookmarks.toolbarFolder, "Folder 1", 0);
|
||||
let itemGUID = store.GUIDForId(itemID);
|
||||
let itemPayload = store.createRecord(itemGUID).cleartext;
|
||||
let encPayload = encryptPayload(itemPayload);
|
||||
collection.wbos[itemGUID] = new ServerWBO(itemGUID, encPayload);
|
||||
|
||||
engine.lastSync = 1; // So we don't back up.
|
||||
|
||||
// Make building the GUID map fail.
|
||||
store.getAllIDs = function () { throw "Nooo"; };
|
||||
|
||||
// Ensure that we throw when accessing _guidMap.
|
||||
engine._syncStartup();
|
||||
_("No error.");
|
||||
do_check_false(engine._guidMapFailed);
|
||||
|
||||
_("We get an error if building _guidMap fails in use.");
|
||||
let err;
|
||||
try {
|
||||
_(engine._guidMap);
|
||||
} catch (ex) {
|
||||
err = ex;
|
||||
}
|
||||
do_check_eq(err.code, Engine.prototype.eEngineAbortApplyIncoming);
|
||||
do_check_eq(err.cause, "Nooo");
|
||||
|
||||
_("We get an error and abort during processIncoming.");
|
||||
err = undefined;
|
||||
try {
|
||||
engine._processIncoming();
|
||||
} catch (ex) {
|
||||
err = ex;
|
||||
}
|
||||
do_check_eq(err, "Nooo");
|
||||
|
||||
server.stop(run_next_test);
|
||||
});
|
||||
|
||||
|
||||
function run_test() {
|
||||
initTestLogging("Trace");
|
||||
Log4Moz.repository.getLogger("Sync.Engine.Bookmarks").level = Log4Moz.Level.Trace;
|
||||
|
|
|
@ -205,11 +205,11 @@ add_test(function test_smart_bookmarks_duped() {
|
|||
try {
|
||||
engine._syncStartup();
|
||||
|
||||
_("Verify that lazyMap uses the anno, discovering a dupe regardless of URI.");
|
||||
do_check_eq(mostVisitedGUID, engine._lazyMap(record));
|
||||
_("Verify that mapDupe uses the anno, discovering a dupe regardless of URI.");
|
||||
do_check_eq(mostVisitedGUID, engine._mapDupe(record));
|
||||
|
||||
record.bmkUri = "http://foo/";
|
||||
do_check_eq(mostVisitedGUID, engine._lazyMap(record));
|
||||
do_check_eq(mostVisitedGUID, engine._mapDupe(record));
|
||||
do_check_neq(PlacesUtils.bookmarks.getBookmarkURI(mostVisitedID).spec,
|
||||
record.bmkUri);
|
||||
|
||||
|
@ -224,7 +224,7 @@ add_test(function test_smart_bookmarks_duped() {
|
|||
_("Handle records without a queryId entry.");
|
||||
record.bmkUri = uri;
|
||||
delete record.queryId;
|
||||
do_check_eq(mostVisitedGUID, engine._lazyMap(record));
|
||||
do_check_eq(mostVisitedGUID, engine._mapDupe(record));
|
||||
|
||||
engine._syncFinish();
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
Cu.import("resource://services-sync/engines/bookmarks.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
Cu.import("resource://services-sync/engines.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://gre/modules/PlacesUtils.jsm");
|
||||
|
@ -26,6 +27,7 @@ function test_tracking() {
|
|||
_("Create bookmark. Won't show because we haven't started tracking yet");
|
||||
createBmk();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
_("Tell the tracker to start tracking changes.");
|
||||
Svc.Obs.notify("weave:engine:start-tracking");
|
||||
|
@ -33,27 +35,33 @@ function test_tracking() {
|
|||
// We expect two changed items because the containing folder
|
||||
// changed as well (new child).
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 2);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 2);
|
||||
|
||||
_("Notifying twice won't do any harm.");
|
||||
Svc.Obs.notify("weave:engine:start-tracking");
|
||||
createBmk();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 3);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 4);
|
||||
|
||||
_("Let's stop tracking again.");
|
||||
tracker.clearChangedIDs();
|
||||
tracker.resetScore();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
createBmk();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
_("Notifying twice won't do any harm.");
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
createBmk();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
} finally {
|
||||
_("Clean up.");
|
||||
store.wipe();
|
||||
tracker.clearChangedIDs();
|
||||
tracker.resetScore();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
}
|
||||
}
|
||||
|
@ -65,6 +73,7 @@ function test_onItemChanged() {
|
|||
_("Verify we've got an empty tracker to work with.");
|
||||
let tracker = engine._tracker;
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
try {
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
|
@ -84,11 +93,13 @@ function test_onItemChanged() {
|
|||
b, DESCRIPTION_ANNO, "A test description", 0,
|
||||
PlacesUtils.annotations.EXPIRE_NEVER);
|
||||
do_check_true(tracker.changedIDs[bGUID] > 0);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE);
|
||||
|
||||
} finally {
|
||||
_("Clean up.");
|
||||
store.wipe();
|
||||
tracker.clearChangedIDs();
|
||||
tracker.resetScore();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
}
|
||||
}
|
||||
|
@ -97,6 +108,7 @@ function test_onItemMoved() {
|
|||
_("Verify we've got an empty tracker to work with.");
|
||||
let tracker = engine._tracker;
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
try {
|
||||
let fx_id = PlacesUtils.bookmarks.insertBookmark(
|
||||
|
@ -121,7 +133,9 @@ function test_onItemMoved() {
|
|||
do_check_eq(tracker.changedIDs['toolbar'], undefined);
|
||||
do_check_eq(tracker.changedIDs[fx_guid], undefined);
|
||||
do_check_eq(tracker.changedIDs[tb_guid], undefined);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE);
|
||||
tracker.clearChangedIDs();
|
||||
tracker.resetScore();
|
||||
|
||||
// Moving a bookmark to a different folder will track the old
|
||||
// folder, the new folder and the bookmark.
|
||||
|
@ -131,11 +145,13 @@ function test_onItemMoved() {
|
|||
do_check_true(tracker.changedIDs['toolbar'] > 0);
|
||||
do_check_eq(tracker.changedIDs[fx_guid], undefined);
|
||||
do_check_true(tracker.changedIDs[tb_guid] > 0);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 3);
|
||||
|
||||
} finally {
|
||||
_("Clean up.");
|
||||
store.wipe();
|
||||
tracker.clearChangedIDs();
|
||||
tracker.resetScore();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
}
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ add_test(function test_bad_hmac() {
|
|||
"/1.1/foo/info/collections": collectionsHelper.handler,
|
||||
"/1.1/foo/storage/meta/global": upd("meta", global.handler()),
|
||||
"/1.1/foo/storage/crypto/keys": upd("crypto", keysWBO.handler()),
|
||||
"/1.1/foo/storage/clients": trackDeletedHandler("crypto", clientsColl.handler())
|
||||
"/1.1/foo/storage/clients": trackDeletedHandler("clients", clientsColl.handler())
|
||||
};
|
||||
|
||||
let server = httpd_setup(handlers);
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
Cu.import("resource://services-sync/engines.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
|
||||
add_test(function test_processIncoming_abort() {
|
||||
_("An abort exception, raised in applyIncoming, will abort _processIncoming.");
|
||||
let syncTesting = new SyncTestingInfrastructure();
|
||||
Svc.Prefs.set("clusterURL", "http://localhost:8080/");
|
||||
Svc.Prefs.set("username", "foo");
|
||||
generateNewKeys();
|
||||
|
||||
let engine = new RotaryEngine();
|
||||
|
||||
_("Create some server data.");
|
||||
let meta_global = Records.set(engine.metaURL, new WBORecord(engine.metaURL));
|
||||
meta_global.payload.engines = {rotary: {version: engine.version,
|
||||
syncID: engine.syncID}};
|
||||
|
||||
let collection = new ServerCollection();
|
||||
let id = Utils.makeGUID();
|
||||
let payload = encryptPayload({id: id, denomination: "Record No. " + id});
|
||||
collection.wbos[id] = new ServerWBO(id, payload);
|
||||
|
||||
let server = sync_httpd_setup({
|
||||
"/1.1/foo/storage/rotary": collection.handler()
|
||||
});
|
||||
|
||||
_("Fake applyIncoming to abort.");
|
||||
engine._store.applyIncoming = function (record) {
|
||||
let ex = {code: Engine.prototype.eEngineAbortApplyIncoming,
|
||||
cause: "Nooo"};
|
||||
_("Throwing: " + JSON.stringify(ex));
|
||||
throw ex;
|
||||
};
|
||||
|
||||
_("Trying _processIncoming. It will throw after aborting.");
|
||||
let err;
|
||||
try {
|
||||
engine._syncStartup();
|
||||
engine._processIncoming();
|
||||
} catch (ex) {
|
||||
err = ex;
|
||||
}
|
||||
|
||||
do_check_eq(err, "Nooo");
|
||||
err = undefined;
|
||||
|
||||
_("Trying engine.sync(). It will abort without error.");
|
||||
try {
|
||||
// This will quietly fail.
|
||||
engine.sync();
|
||||
} catch (ex) {
|
||||
err = ex;
|
||||
}
|
||||
|
||||
do_check_eq(err, undefined);
|
||||
|
||||
server.stop(run_next_test);
|
||||
Svc.Prefs.resetBranch("");
|
||||
Records.clearCache();
|
||||
});
|
||||
|
||||
function run_test() {
|
||||
run_next_test();
|
||||
}
|
|
@ -0,0 +1,98 @@
|
|||
Cu.import("resource://services-sync/engines/passwords.js");
|
||||
Cu.import("resource://services-sync/engines.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
|
||||
Engines.register(PasswordEngine);
|
||||
let engine = Engines.get("passwords");
|
||||
let store = engine._store;
|
||||
|
||||
function test_tracking() {
|
||||
let recordNum = 0;
|
||||
|
||||
_("Verify we've got an empty tracker to work with.");
|
||||
let tracker = engine._tracker;
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
|
||||
function createPassword() {
|
||||
_("RECORD NUM: " + recordNum);
|
||||
let record = {id: "GUID" + recordNum,
|
||||
hostname: "http://foo.bar.com",
|
||||
formSubmitURL: "http://foo.bar.com/baz",
|
||||
username: "john" + recordNum,
|
||||
password: "smith",
|
||||
usernameField: "username",
|
||||
passwordField: "password"};
|
||||
recordNum++;
|
||||
let login = store._nsLoginInfoFromRecord(record);
|
||||
Services.logins.addLogin(login);
|
||||
}
|
||||
|
||||
try {
|
||||
_("Create a password record. Won't show because we haven't started tracking yet");
|
||||
createPassword();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
_("Tell the tracker to start tracking changes.");
|
||||
Svc.Obs.notify("weave:engine:start-tracking");
|
||||
createPassword();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 1);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE);
|
||||
|
||||
_("Notifying twice won't do any harm.");
|
||||
Svc.Obs.notify("weave:engine:start-tracking");
|
||||
createPassword();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 2);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 2);
|
||||
|
||||
_("Let's stop tracking again.");
|
||||
tracker.clearChangedIDs();
|
||||
tracker.resetScore();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
createPassword();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
_("Notifying twice won't do any harm.");
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
createPassword();
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
} finally {
|
||||
_("Clean up.");
|
||||
store.wipe();
|
||||
tracker.clearChangedIDs();
|
||||
tracker.resetScore();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
}
|
||||
}
|
||||
|
||||
function test_onWipe() {
|
||||
_("Verify we've got an empty tracker to work with.");
|
||||
let tracker = engine._tracker;
|
||||
do_check_eq([id for (id in tracker.changedIDs)].length, 0);
|
||||
do_check_eq(tracker.score, 0);
|
||||
|
||||
try {
|
||||
_("A store wipe should increment the score");
|
||||
Svc.Obs.notify("weave:engine:start-tracking");
|
||||
store.wipe();
|
||||
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE);
|
||||
} finally {
|
||||
tracker.resetScore();
|
||||
Svc.Obs.notify("weave:engine:stop-tracking");
|
||||
}
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
initTestLogging("Trace");
|
||||
|
||||
Log4Moz.repository.getLogger("Sync.Engine.Passwords").level = Log4Moz.Level.Trace;
|
||||
Log4Moz.repository.getLogger("Sync.Store.Passwords").level = Log4Moz.Level.Trace;
|
||||
Log4Moz.repository.getLogger("Sync.Tracker.Passwords").level = Log4Moz.Level.Trace;
|
||||
|
||||
test_tracking();
|
||||
test_onWipe();
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
Cu.import("resource://services-sync/engines/prefs.js");
|
||||
Cu.import("resource://services-sync/util.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
Cu.import("resource://services-sync/ext/Preferences.js");
|
||||
|
||||
function run_test() {
|
||||
|
@ -41,7 +42,7 @@ function run_test() {
|
|||
_("Tell the tracker to start tracking changes.");
|
||||
Svc.Obs.notify("weave:engine:start-tracking");
|
||||
prefs.set("testing.int", 23);
|
||||
do_check_eq(tracker.score, 25);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE);
|
||||
do_check_eq(tracker.modified, true);
|
||||
|
||||
_("Clearing changed IDs reset modified status.");
|
||||
|
@ -50,25 +51,25 @@ function run_test() {
|
|||
|
||||
_("Resetting a pref ups the score, too.");
|
||||
prefs.reset("testing.int");
|
||||
do_check_eq(tracker.score, 50);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 2);
|
||||
do_check_eq(tracker.modified, true);
|
||||
tracker.clearChangedIDs();
|
||||
|
||||
_("So does changing a pref sync pref.");
|
||||
Svc.Prefs.set("prefs.sync.testing.int", false);
|
||||
do_check_eq(tracker.score, 150);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 3);
|
||||
do_check_eq(tracker.modified, true);
|
||||
tracker.clearChangedIDs();
|
||||
|
||||
_("Now that the pref sync pref has been flipped, changes to it won't be picked up.");
|
||||
prefs.set("testing.int", 42);
|
||||
do_check_eq(tracker.score, 150);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 3);
|
||||
do_check_eq(tracker.modified, false);
|
||||
tracker.clearChangedIDs();
|
||||
|
||||
_("Changing some other random pref won't do anything.");
|
||||
prefs.set("testing.other", "blergh");
|
||||
do_check_eq(tracker.score, 150);
|
||||
do_check_eq(tracker.score, SCORE_INCREMENT_XLARGE * 3);
|
||||
do_check_eq(tracker.modified, false);
|
||||
|
||||
} finally {
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Cu.import("resource://services-sync/engines.js");
|
||||
Cu.import("resource://services-sync/constants.js");
|
||||
|
||||
Svc.DefaultPrefs.set("registerEngines", "");
|
||||
Cu.import("resource://services-sync/service.js");
|
||||
|
||||
Engines.register(RotaryEngine);
|
||||
let engine = Engines.get("rotary");
|
||||
let tracker = engine._tracker;
|
||||
engine.enabled = true;
|
||||
|
||||
// Tracking info/collections.
|
||||
let collectionsHelper = track_collections_helper();
|
||||
let upd = collectionsHelper.with_updated_collection;
|
||||
|
||||
function sync_httpd_setup() {
|
||||
let handlers = {};
|
||||
|
||||
handlers["/1.1/johndoe/storage/meta/global"] =
|
||||
new ServerWBO("global", {}).handler();
|
||||
handlers["/1.1/johndoe/storage/steam"] =
|
||||
new ServerWBO("steam", {}).handler();
|
||||
|
||||
handlers["/1.1/johndoe/info/collections"] = collectionsHelper.handler;
|
||||
delete collectionsHelper.collections.crypto;
|
||||
delete collectionsHelper.collections.meta;
|
||||
|
||||
let cr = new ServerWBO("keys");
|
||||
handlers["/1.1/johndoe/storage/crypto/keys"] =
|
||||
upd("crypto", cr.handler());
|
||||
|
||||
let cl = new ServerCollection();
|
||||
handlers["/1.1/johndoe/storage/clients"] =
|
||||
upd("clients", cl.handler());
|
||||
|
||||
return httpd_setup(handlers);
|
||||
}
|
||||
|
||||
function setUp() {
|
||||
Service.username = "johndoe";
|
||||
Service.password = "ilovejane";
|
||||
Service.passphrase = "sekrit";
|
||||
Service.clusterURL = "http://localhost:8080/";
|
||||
new FakeCryptoService();
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
initTestLogging("Trace");
|
||||
|
||||
Log4Moz.repository.getLogger("Sync.Service").level = Log4Moz.Level.Trace;
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
||||
add_test(function test_tracker_score_updated() {
|
||||
let scoreUpdated = 0;
|
||||
|
||||
Svc.Obs.add("weave:engine:score:updated", function() {
|
||||
scoreUpdated++;
|
||||
});
|
||||
|
||||
try {
|
||||
do_check_eq(engine.score, 0);
|
||||
|
||||
tracker.score += SCORE_INCREMENT_SMALL;
|
||||
do_check_eq(engine.score, SCORE_INCREMENT_SMALL);
|
||||
|
||||
do_check_eq(scoreUpdated, 1);
|
||||
} finally {
|
||||
tracker.resetScore();
|
||||
run_next_test();
|
||||
}
|
||||
});
|
||||
|
||||
add_test(function test_sync_triggered() {
|
||||
let server = sync_httpd_setup();
|
||||
setUp();
|
||||
|
||||
Service.login();
|
||||
|
||||
Service.syncThreshold = MULTI_DEVICE_THRESHOLD;
|
||||
Svc.Obs.add("weave:service:sync:finish", function onSyncFinish() {
|
||||
_("Sync completed!");
|
||||
server.stop(run_next_test);
|
||||
});
|
||||
|
||||
tracker.score += SCORE_INCREMENT_XLARGE;
|
||||
});
|
||||
|
|
@ -23,6 +23,7 @@ tail =
|
|||
[test_collections_recovery.js]
|
||||
[test_corrupt_keys.js]
|
||||
[test_engine.js]
|
||||
[test_engine_abort.js]
|
||||
[test_enginemanager.js]
|
||||
[test_forms_store.js]
|
||||
[test_forms_tracker.js]
|
||||
|
@ -35,6 +36,7 @@ tail =
|
|||
[test_log4moz.js]
|
||||
[test_notifications.js]
|
||||
[test_password_store.js]
|
||||
[test_password_tracker.js]
|
||||
[test_places_guid_downgrade.js]
|
||||
[test_prefs_store.js]
|
||||
[test_prefs_tracker.js]
|
||||
|
@ -44,6 +46,7 @@ tail =
|
|||
[test_resource.js]
|
||||
[test_resource_async.js]
|
||||
[test_resource_ua.js]
|
||||
[test_score_triggers.js]
|
||||
[test_service_attributes.js]
|
||||
[test_service_changePassword.js]
|
||||
[test_service_checkAccount.js]
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsStringStream.h"
|
||||
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/Util.h" // for DebugOnly
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -108,7 +109,7 @@ ExternalHelperAppParent::RecvOnDataAvailable(const nsCString& data,
|
|||
|
||||
NS_ASSERTION(mPending, "must be pending!");
|
||||
nsCOMPtr<nsIInputStream> stringStream;
|
||||
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), count, NS_ASSIGNMENT_DEPEND);
|
||||
DebugOnly<nsresult> rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), count, NS_ASSIGNMENT_DEPEND);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create dependent string!");
|
||||
mStatus = mListener->OnDataAvailable(this, nsnull, stringStream, offset, count);
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@ nsCUPSShim gCupsShim;
|
|||
nsresult
|
||||
nsPSPrinterList::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// Should we try cups?
|
||||
PRBool useCups =
|
||||
Preferences::GetBool("print.postscript.cups.enabled", PR_TRUE);
|
||||
|
|
|
@ -4308,6 +4308,7 @@ DisplaySystemMenu(HWND hWnd, nsSizeMode sizeMode, PRBool isRtl, PRInt32 x, PRInt
|
|||
mii.fState = MF_GRAYED;
|
||||
switch(sizeMode) {
|
||||
case nsSizeMode_Fullscreen:
|
||||
SetMenuItemInfo(hMenu, SC_RESTORE, FALSE, &mii);
|
||||
// intentional fall through
|
||||
case nsSizeMode_Maximized:
|
||||
SetMenuItemInfo(hMenu, SC_SIZE, FALSE, &mii);
|
||||
|
@ -5266,13 +5267,6 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM &wParam, LPARAM &lParam,
|
|||
MOZ_SYSCONTEXT_Y_POS);
|
||||
result = PR_TRUE;
|
||||
}
|
||||
if (filteredWParam == SC_RESTORE &&
|
||||
mSizeMode == nsSizeMode_Fullscreen) {
|
||||
// Windows can handle restoring a normal window, but it doesn't
|
||||
// understand our full screen mode.
|
||||
MakeFullScreen(PR_FALSE);
|
||||
result = PR_TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -125,7 +125,6 @@ static NS_DEFINE_CID(kWindowCID, NS_WINDOW_CID);
|
|||
nsWebShellWindow::nsWebShellWindow(PRUint32 aChromeFlags)
|
||||
: nsXULWindow(aChromeFlags)
|
||||
, mSPTimerLock("nsWebShellWindow.mSPTimerLock")
|
||||
, mSizeMode(-1)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -386,15 +385,12 @@ nsWebShellWindow::HandleEvent(nsGUIEvent *aEvent)
|
|||
// min, max, and normal are all the same to apps, but for
|
||||
// fullscreen we need to let them know so they can update
|
||||
// their ui.
|
||||
if (modeEvent->mSizeMode == nsSizeMode_Fullscreen ||
|
||||
eventWindow->mSizeMode == nsSizeMode_Fullscreen) {
|
||||
if (modeEvent->mSizeMode == nsSizeMode_Fullscreen) {
|
||||
nsCOMPtr<nsIDOMWindowInternal> ourWindow = do_GetInterface(docShell);
|
||||
if (ourWindow)
|
||||
ourWindow->SetFullScreen(modeEvent->mSizeMode == nsSizeMode_Fullscreen);
|
||||
ourWindow->SetFullScreen(PR_TRUE);
|
||||
}
|
||||
|
||||
eventWindow->mSizeMode = modeEvent->mSizeMode;
|
||||
|
||||
// Note the current implementation of SetSizeMode just stores
|
||||
// the new state; it doesn't actually resize. So here we store
|
||||
// the state and pass the event on to the OS. The day is coming
|
||||
|
|
|
@ -91,7 +91,6 @@ protected:
|
|||
|
||||
nsCOMPtr<nsITimer> mSPTimer;
|
||||
mozilla::Mutex mSPTimerLock;
|
||||
PRInt32 mSizeMode;
|
||||
|
||||
void SetPersistenceTimer(PRUint32 aDirtyFlags);
|
||||
static void FirePersistenceTimer(nsITimer *aTimer, void *aClosure);
|
||||
|
|
|
@ -256,8 +256,9 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
}
|
||||
// get the principal. if it doesn't exist, die.
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
secman->GetSubjectPrincipal(getter_AddRefs(principal));
|
||||
if (!principal)
|
||||
nsresult rv = secman->GetSubjectPrincipal(getter_AddRefs(principal));
|
||||
|
||||
if (NS_FAILED(rv) || !principal)
|
||||
{
|
||||
JS_ReportError(cx, "Could not get the Subject Principal during InstallTrigger.Install()");
|
||||
return JS_FALSE;
|
||||
|
@ -369,7 +370,7 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
}
|
||||
|
||||
// Make sure we're allowed to load this URL and the icon URL
|
||||
nsresult rv = InstallTriggerCheckLoadURIFromScript(cx, xpiURL);
|
||||
rv = InstallTriggerCheckLoadURIFromScript(cx, xpiURL);
|
||||
if (NS_FAILED(rv))
|
||||
abortLoad = PR_TRUE;
|
||||
|
||||
|
@ -404,8 +405,8 @@ InstallTriggerGlobalInstall(JSContext *cx, JSObject *obj, uintN argc, jsval *arg
|
|||
if (!abortLoad && trigger->Size() > 0)
|
||||
{
|
||||
nsCOMPtr<nsIURI> checkuri;
|
||||
nsresult rv = nativeThis->GetOriginatingURI(globalObject,
|
||||
getter_AddRefs(checkuri));
|
||||
rv = nativeThis->GetOriginatingURI(globalObject,
|
||||
getter_AddRefs(checkuri));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr<nsIDOMWindowInternal> win(do_QueryInterface(globalObject));
|
||||
|
|
|
@ -284,8 +284,9 @@ XPITriggerEvent::Run()
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
secman->GetSubjectPrincipal(getter_AddRefs(principal));
|
||||
if (!principal)
|
||||
nsresult rv = secman->GetSubjectPrincipal(getter_AddRefs(principal));
|
||||
|
||||
if (NS_FAILED(rv) || !principal)
|
||||
{
|
||||
JS_ReportError(cx, "Could not get principal from script security manager");
|
||||
return 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче