mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 11:38:16 +00:00
Merge mozilla-central to tracemonkey.
This commit is contained in:
commit
dd51c79fca
@ -39,11 +39,10 @@
|
|||||||
#ifndef _nsAccCache_H_
|
#ifndef _nsAccCache_H_
|
||||||
#define _nsAccCache_H_
|
#define _nsAccCache_H_
|
||||||
|
|
||||||
|
#include "nsIAccessible.h"
|
||||||
#include "nsRefPtrHashtable.h"
|
#include "nsRefPtrHashtable.h"
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
|
|
||||||
class nsIAccessible;
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Accessible cache utils
|
// Accessible cache utils
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -122,6 +122,12 @@ Sanitizer.prototype = {
|
|||||||
// facility for timespan-based eviction. Wipe it.
|
// facility for timespan-based eviction. Wipe it.
|
||||||
cacheService.evictEntries(Ci.nsICache.STORE_ANYWHERE);
|
cacheService.evictEntries(Ci.nsICache.STORE_ANYWHERE);
|
||||||
} catch(er) {}
|
} catch(er) {}
|
||||||
|
|
||||||
|
var imageCache = Cc["@mozilla.org/image/cache;1"].
|
||||||
|
getService(Ci.imgICache);
|
||||||
|
try {
|
||||||
|
imageCache.clearCache(false); // true=chrome, false=content
|
||||||
|
} catch(er) {}
|
||||||
},
|
},
|
||||||
|
|
||||||
get canClear()
|
get canClear()
|
||||||
|
@ -571,6 +571,17 @@ PrivateBrowsingService.prototype = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Image Cache
|
||||||
|
let (imageCache = Cc["@mozilla.org/image/cache;1"].
|
||||||
|
getService(Ci.imgICache)) {
|
||||||
|
try {
|
||||||
|
imageCache.clearCache(false); // true=chrome, false=content
|
||||||
|
} catch (ex) {
|
||||||
|
Cu.reportError("Exception thrown while clearing the image cache: " +
|
||||||
|
ex.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Cookies
|
// Cookies
|
||||||
let (cm = Cc["@mozilla.org/cookiemanager;1"].
|
let (cm = Cc["@mozilla.org/cookiemanager;1"].
|
||||||
getService(Ci.nsICookieManager2)) {
|
getService(Ci.nsICookieManager2)) {
|
||||||
|
@ -1538,7 +1538,7 @@ x86_64 | ia64)
|
|||||||
CPU_ARCH="$OS_TEST"
|
CPU_ARCH="$OS_TEST"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
arm)
|
arm*)
|
||||||
CPU_ARCH=arm
|
CPU_ARCH=arm
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
#define nsCopySupport_h__
|
#define nsCopySupport_h__
|
||||||
|
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
|
#include "nsINode.h"
|
||||||
|
|
||||||
class nsISelection;
|
class nsISelection;
|
||||||
class nsIDocument;
|
class nsIDocument;
|
||||||
@ -47,7 +48,6 @@ class nsIContent;
|
|||||||
class nsITransferable;
|
class nsITransferable;
|
||||||
class nsACString;
|
class nsACString;
|
||||||
class nsAString;
|
class nsAString;
|
||||||
class nsIDOMNode;
|
|
||||||
class nsIPresShell;
|
class nsIPresShell;
|
||||||
|
|
||||||
class nsCopySupport
|
class nsCopySupport
|
||||||
@ -69,10 +69,14 @@ class nsCopySupport
|
|||||||
|
|
||||||
// Get the selection as a transferable. Similar to HTMLCopy except does
|
// Get the selection as a transferable. Similar to HTMLCopy except does
|
||||||
// not deal with the clipboard.
|
// not deal with the clipboard.
|
||||||
static nsresult GetTransferableForSelection(nsISelection * aSelection,
|
static nsresult GetTransferableForSelection(nsISelection* aSelection,
|
||||||
nsIDocument * aDocument,
|
nsIDocument* aDocument,
|
||||||
nsITransferable ** aTransferable);
|
nsITransferable** aTransferable);
|
||||||
|
|
||||||
|
// Same as GetTransferableForSelection, but doesn't skip invisible content.
|
||||||
|
static nsresult GetTransferableForNode(nsINode* aNode,
|
||||||
|
nsIDocument* aDoc,
|
||||||
|
nsITransferable** aTransferable);
|
||||||
/**
|
/**
|
||||||
* Retrieve the selection for the given document. If the current focus
|
* Retrieve the selection for the given document. If the current focus
|
||||||
* within the document has its own selection, aSelection will be set to it
|
* within the document has its own selection, aSelection will be set to it
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#include "nsChannelProperties.h"
|
#include "nsChannelProperties.h"
|
||||||
|
|
||||||
/* Keeps track of whether or not CSP is enabled */
|
/* Keeps track of whether or not CSP is enabled */
|
||||||
static PRBool gCSPEnabled = PR_TRUE;
|
PRBool CSPService::sCSPEnabled = PR_TRUE;
|
||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
static PRLogModuleInfo* gCspPRLog;
|
static PRLogModuleInfo* gCspPRLog;
|
||||||
@ -63,7 +63,7 @@ static PRLogModuleInfo* gCspPRLog;
|
|||||||
|
|
||||||
CSPService::CSPService()
|
CSPService::CSPService()
|
||||||
{
|
{
|
||||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &gCSPEnabled);
|
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &sCSPEnabled);
|
||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
if (!gCspPRLog)
|
if (!gCspPRLog)
|
||||||
@ -102,7 +102,7 @@ CSPService::ShouldLoad(PRUint32 aContentType,
|
|||||||
*aDecision = nsIContentPolicy::ACCEPT;
|
*aDecision = nsIContentPolicy::ACCEPT;
|
||||||
|
|
||||||
// No need to continue processing if CSP is disabled
|
// No need to continue processing if CSP is disabled
|
||||||
if (!gCSPEnabled)
|
if (!sCSPEnabled)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// find the principal of the document that initiated this request and see
|
// find the principal of the document that initiated this request and see
|
||||||
@ -160,7 +160,7 @@ CSPService::ShouldProcess(PRUint32 aContentType,
|
|||||||
*aDecision = nsIContentPolicy::ACCEPT;
|
*aDecision = nsIContentPolicy::ACCEPT;
|
||||||
|
|
||||||
// No need to continue processing if CSP is disabled
|
// No need to continue processing if CSP is disabled
|
||||||
if (!gCSPEnabled)
|
if (!sCSPEnabled)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// find the nsDocument that initiated this request and see if it has a
|
// find the nsDocument that initiated this request and see if it has a
|
||||||
|
@ -52,7 +52,8 @@ public:
|
|||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
NS_DECL_NSICONTENTPOLICY
|
NS_DECL_NSICONTENTPOLICY
|
||||||
NS_DECL_NSICHANNELEVENTSINK
|
NS_DECL_NSICHANNELEVENTSINK
|
||||||
|
|
||||||
CSPService();
|
CSPService();
|
||||||
virtual ~CSPService();
|
virtual ~CSPService();
|
||||||
|
static PRBool sCSPEnabled;
|
||||||
};
|
};
|
||||||
|
@ -79,7 +79,6 @@
|
|||||||
#include "nsIScriptSecurityManager.h"
|
#include "nsIScriptSecurityManager.h"
|
||||||
#include "nsIPrincipal.h"
|
#include "nsIPrincipal.h"
|
||||||
#include "nsIDocShellTreeItem.h"
|
#include "nsIDocShellTreeItem.h"
|
||||||
#include "nsRange.h"
|
|
||||||
#include "nsIWebBrowserPersist.h"
|
#include "nsIWebBrowserPersist.h"
|
||||||
#include "nsEscape.h"
|
#include "nsEscape.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
@ -92,9 +91,7 @@
|
|||||||
#define kHTMLContext "text/_moz_htmlcontext"
|
#define kHTMLContext "text/_moz_htmlcontext"
|
||||||
#define kHTMLInfo "text/_moz_htmlinfo"
|
#define kHTMLInfo "text/_moz_htmlinfo"
|
||||||
|
|
||||||
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
|
// if aNode is null, use the selection from the window
|
||||||
|
|
||||||
// if inNode is null, use the selection from the window
|
|
||||||
static nsresult
|
static nsresult
|
||||||
GetTransferableForNodeOrSelection(nsIDOMWindow* aWindow,
|
GetTransferableForNodeOrSelection(nsIDOMWindow* aWindow,
|
||||||
nsIContent* aNode,
|
nsIContent* aNode,
|
||||||
@ -108,25 +105,15 @@ GetTransferableForNodeOrSelection(nsIDOMWindow* aWindow,
|
|||||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsISelection> selection;
|
if (aNode) {
|
||||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode);
|
rv = nsCopySupport::GetTransferableForNode(aNode, doc, aTransferable);
|
||||||
if (node) {
|
|
||||||
// Make a temporary selection with this node in a single range.
|
|
||||||
rv = NS_NewDomSelection(getter_AddRefs(selection));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
nsCOMPtr<nsIDOMRange> range;
|
|
||||||
rv = NS_NewRange(getter_AddRefs(range));
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = range->SelectNode(node);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
rv = selection->AddRange(range);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
} else {
|
} else {
|
||||||
|
nsCOMPtr<nsISelection> selection;
|
||||||
aWindow->GetSelection(getter_AddRefs(selection));
|
aWindow->GetSelection(getter_AddRefs(selection));
|
||||||
|
rv = nsCopySupport::GetTransferableForSelection(selection, doc,
|
||||||
|
aTransferable);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = nsCopySupport::GetTransferableForSelection(selection, doc,
|
|
||||||
aTransferable);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -424,7 +411,6 @@ DragDataProducer::GetNodeString(nsIContent* inNode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
|
DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
|
||||||
PRBool* aCanDrag,
|
PRBool* aCanDrag,
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
#include "nsXPCOM.h"
|
#include "nsXPCOM.h"
|
||||||
#include "nsISupportsPrimitives.h"
|
#include "nsISupportsPrimitives.h"
|
||||||
#include "nsIDOMRange.h"
|
#include "nsIDOMRange.h"
|
||||||
|
#include "nsRange.h"
|
||||||
#include "imgIContainer.h"
|
#include "imgIContainer.h"
|
||||||
#include "nsIPresShell.h"
|
#include "nsIPresShell.h"
|
||||||
#include "nsFocusManager.h"
|
#include "nsFocusManager.h"
|
||||||
@ -78,6 +79,8 @@
|
|||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsContentCID.h"
|
#include "nsContentCID.h"
|
||||||
|
|
||||||
|
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||||
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
||||||
static NS_DEFINE_CID(kHTMLConverterCID, NS_HTMLFORMATCONVERTER_CID);
|
static NS_DEFINE_CID(kHTMLConverterCID, NS_HTMLFORMATCONVERTER_CID);
|
||||||
@ -100,7 +103,7 @@ static nsresult AppendDOMNode(nsITransferable *aTransferable,
|
|||||||
static nsresult
|
static nsresult
|
||||||
SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
||||||
PRBool doPutOnClipboard, PRInt16 aClipboardID,
|
PRBool doPutOnClipboard, PRInt16 aClipboardID,
|
||||||
nsITransferable ** aTransferable)
|
PRUint32 aFlags, nsITransferable ** aTransferable)
|
||||||
{
|
{
|
||||||
// Clear the output parameter for the transferable, if provided.
|
// Clear the output parameter for the transferable, if provided.
|
||||||
if (aTransferable) {
|
if (aTransferable) {
|
||||||
@ -135,9 +138,8 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
|||||||
// we want preformatted for the case where the selection is inside input/textarea
|
// we want preformatted for the case where the selection is inside input/textarea
|
||||||
// and we don't want pretty printing for others cases, to not have additionnal
|
// and we don't want pretty printing for others cases, to not have additionnal
|
||||||
// line breaks which are then converted into spaces by the htmlConverter (see bug #524975)
|
// line breaks which are then converted into spaces by the htmlConverter (see bug #524975)
|
||||||
PRUint32 flags = nsIDocumentEncoder::OutputPreformatted
|
PRUint32 flags = aFlags | nsIDocumentEncoder::OutputPreformatted
|
||||||
| nsIDocumentEncoder::OutputRaw
|
| nsIDocumentEncoder::OutputRaw;
|
||||||
| nsIDocumentEncoder::SkipInvisibleContent;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDoc);
|
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDoc);
|
||||||
NS_ASSERTION(domDoc, "Need a document");
|
NS_ASSERTION(domDoc, "Need a document");
|
||||||
@ -178,7 +180,7 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
|||||||
|
|
||||||
mimeType.AssignLiteral(kHTMLMime);
|
mimeType.AssignLiteral(kHTMLMime);
|
||||||
|
|
||||||
flags = nsIDocumentEncoder::SkipInvisibleContent;
|
flags = aFlags;
|
||||||
|
|
||||||
rv = docEncoder->Init(domDoc, mimeType, flags);
|
rv = docEncoder->Init(domDoc, mimeType, flags);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
@ -279,17 +281,47 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 aClipboardID)
|
nsresult
|
||||||
|
nsCopySupport::HTMLCopy(nsISelection* aSel, nsIDocument* aDoc,
|
||||||
|
PRInt16 aClipboardID)
|
||||||
{
|
{
|
||||||
return SelectionCopyHelper(aSel, aDoc, PR_TRUE, aClipboardID, nsnull);
|
return SelectionCopyHelper(aSel, aDoc, PR_TRUE, aClipboardID,
|
||||||
|
nsIDocumentEncoder::SkipInvisibleContent,
|
||||||
|
nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsCopySupport::GetTransferableForSelection(nsISelection * aSel,
|
nsCopySupport::GetTransferableForSelection(nsISelection* aSel,
|
||||||
nsIDocument * aDoc,
|
nsIDocument* aDoc,
|
||||||
nsITransferable ** aTransferable)
|
nsITransferable** aTransferable)
|
||||||
{
|
{
|
||||||
return SelectionCopyHelper(aSel, aDoc, PR_FALSE, 0, aTransferable);
|
return SelectionCopyHelper(aSel, aDoc, PR_FALSE, 0,
|
||||||
|
nsIDocumentEncoder::SkipInvisibleContent,
|
||||||
|
aTransferable);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsCopySupport::GetTransferableForNode(nsINode* aNode,
|
||||||
|
nsIDocument* aDoc,
|
||||||
|
nsITransferable** aTransferable)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsISelection> selection;
|
||||||
|
// Make a temporary selection with aNode in a single range.
|
||||||
|
nsresult rv = NS_NewDomSelection(getter_AddRefs(selection));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
nsCOMPtr<nsIDOMRange> range;
|
||||||
|
rv = NS_NewRange(getter_AddRefs(range));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode);
|
||||||
|
NS_ENSURE_TRUE(node, NS_ERROR_FAILURE);
|
||||||
|
rv = range->SelectNode(node);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
rv = selection->AddRange(range);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
// It's not the primary selection - so don't skip invisible content.
|
||||||
|
PRUint32 flags = 0;
|
||||||
|
return SelectionCopyHelper(selection, aDoc, PR_FALSE, 0, flags,
|
||||||
|
aTransferable);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsCopySupport::DoHooks(nsIDocument *aDoc, nsITransferable *aTrans,
|
nsresult nsCopySupport::DoHooks(nsIDocument *aDoc, nsITransferable *aTrans,
|
||||||
|
@ -195,6 +195,7 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
|||||||
|
|
||||||
// FOR CSP (autogenerated by xpidl)
|
// FOR CSP (autogenerated by xpidl)
|
||||||
#include "nsIContentSecurityPolicy.h"
|
#include "nsIContentSecurityPolicy.h"
|
||||||
|
#include "nsCSPService.h"
|
||||||
#include "nsHTMLStyleSheet.h"
|
#include "nsHTMLStyleSheet.h"
|
||||||
#include "nsHTMLCSSStyleSheet.h"
|
#include "nsHTMLCSSStyleSheet.h"
|
||||||
|
|
||||||
@ -202,9 +203,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
|||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
|
|
||||||
/* Keeps track of whether or not CSP is enabled */
|
|
||||||
static PRBool gCSPEnabled = PR_TRUE;
|
|
||||||
|
|
||||||
#ifdef PR_LOGGING
|
#ifdef PR_LOGGING
|
||||||
static PRLogModuleInfo* gDocumentLeakPRLog;
|
static PRLogModuleInfo* gDocumentLeakPRLog;
|
||||||
static PRLogModuleInfo* gCspPRLog;
|
static PRLogModuleInfo* gCspPRLog;
|
||||||
@ -1409,8 +1407,6 @@ nsDocument::nsDocument(const char* aContentType)
|
|||||||
gCspPRLog = PR_NewLogModule("CSP");
|
gCspPRLog = PR_NewLogModule("CSP");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &gCSPEnabled);
|
|
||||||
|
|
||||||
// Start out mLastStyleSheetSet as null, per spec
|
// Start out mLastStyleSheetSet as null, per spec
|
||||||
SetDOMStringToNull(mLastStyleSheetSet);
|
SetDOMStringToNull(mLastStyleSheetSet);
|
||||||
}
|
}
|
||||||
@ -2175,7 +2171,7 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
|||||||
nsresult
|
nsresult
|
||||||
nsDocument::InitCSP()
|
nsDocument::InitCSP()
|
||||||
{
|
{
|
||||||
if (gCSPEnabled) {
|
if (CSPService::sCSPEnabled) {
|
||||||
nsAutoString cspHeaderValue;
|
nsAutoString cspHeaderValue;
|
||||||
nsAutoString cspROHeaderValue;
|
nsAutoString cspROHeaderValue;
|
||||||
|
|
||||||
|
@ -402,6 +402,7 @@ _TEST_FILES2 = \
|
|||||||
test_websocket.html \
|
test_websocket.html \
|
||||||
file_websocket_wsh.py \
|
file_websocket_wsh.py \
|
||||||
file_websocket_http_resource.txt \
|
file_websocket_http_resource.txt \
|
||||||
|
test_bug574596.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
# This test fails on the Mac for some reason
|
# This test fails on the Mac for some reason
|
||||||
|
86
content/base/test/test_bug574596.html
Normal file
86
content/base/test/test_bug574596.html
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=574596
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 574596</title>
|
||||||
|
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=574596">Mozilla Bug 574596</a>
|
||||||
|
<style type="text/css">
|
||||||
|
#link1 a { -moz-user-select:none; }
|
||||||
|
</style>
|
||||||
|
<div id="link1"><a href="http://www.mozilla.org/">link1</a></div>
|
||||||
|
<div id="link2"><a href="http://www.mozilla.org/">link2</a></div>
|
||||||
|
<p id="display"></p>
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
/** Test for Bug 574596 **/
|
||||||
|
|
||||||
|
function ignoreFunc(actualData, expectedData) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var dragLinkText = [[
|
||||||
|
{ type:"text/x-moz-url", data:"", eqTest:ignoreFunc },
|
||||||
|
{ type:"text/x-moz-url-data", data:"http://www.mozilla.org/" },
|
||||||
|
{ type:"text/x-moz-url-desc", data:"link1" },
|
||||||
|
{ type:"text/uri-list", data:"http://www.mozilla.org/" },
|
||||||
|
{ type:"text/_moz_htmlcontext", data:"", eqTest:ignoreFunc },
|
||||||
|
{ type:"text/_moz_htmlinfo", data:"", eqTest:ignoreFunc },
|
||||||
|
{ type:"text/html", data:'<div id="link1"><a href="http://www.mozilla.org/">link1</a></div>' },
|
||||||
|
{ type:"text/plain", data:"http://www.mozilla.org/" }
|
||||||
|
]];
|
||||||
|
|
||||||
|
|
||||||
|
function dumpTransfer(dataTransfer,expect) {
|
||||||
|
dtData = dataTransfer.mozItemCount + "items:\n";
|
||||||
|
for (var i = 0; i < dataTransfer.mozItemCount; i++) {
|
||||||
|
var dtTypes = dataTransfer.mozTypesAt(i);
|
||||||
|
for (var j = 0; j < dtTypes.length; j++) {
|
||||||
|
var actualData = dataTransfer.mozGetDataAt(dtTypes[j],i)
|
||||||
|
if (expect && expect[i] && expect[i][j]) {
|
||||||
|
if (expect[i][j].eqTest)
|
||||||
|
dtData += expect[i][j].eqTest(actualData,expect[i][j].data) ? "ok" : "fail";
|
||||||
|
else
|
||||||
|
dtData += (actualData == expect[i][j].data) ? "ok" : "fail";
|
||||||
|
}
|
||||||
|
dtData += "["+i+"]" + "["+j+"]: " + '"' + dtTypes[j] + '" "' + actualData + '"\n';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
alert(dtData);
|
||||||
|
}
|
||||||
|
|
||||||
|
function runTest() {
|
||||||
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||||
|
|
||||||
|
var result = synthesizeDragStart($('link1'), dragLinkText, window);
|
||||||
|
is(result, null, "Drag -moz-user-select:none link (#link1)");
|
||||||
|
// if (result) dumpTransfer(result,dragLinkText);
|
||||||
|
|
||||||
|
dragLinkText[0][2].data = "link2";
|
||||||
|
dragLinkText[0][6].data = '<div id="link2"><a href="http://www.mozilla.org/">link2</a></div>'
|
||||||
|
var result = synthesizeDragStart($('link2'), dragLinkText, window);
|
||||||
|
is(result, null, "Drag link (#link2)");
|
||||||
|
// if (result) dumpTransfer(result,dragLinkText);
|
||||||
|
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
SimpleTest.waitForFocus(runTest);
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -3111,7 +3111,7 @@ nsCanvasRenderingContext2D::SetLineCap(const nsAString& capstyle)
|
|||||||
cap = gfxContext::LINE_CAP_SQUARE;
|
cap = gfxContext::LINE_CAP_SQUARE;
|
||||||
else
|
else
|
||||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_OK;
|
||||||
|
|
||||||
mThebes->SetLineCap(cap);
|
mThebes->SetLineCap(cap);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -3147,7 +3147,7 @@ nsCanvasRenderingContext2D::SetLineJoin(const nsAString& joinstyle)
|
|||||||
j = gfxContext::LINE_JOIN_MITER;
|
j = gfxContext::LINE_JOIN_MITER;
|
||||||
else
|
else
|
||||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_OK;
|
||||||
|
|
||||||
mThebes->SetLineJoin(j);
|
mThebes->SetLineJoin(j);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -3532,7 +3532,8 @@ nsCanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op)
|
|||||||
else CANVAS_OP_TO_THEBES_OP("xor", XOR)
|
else CANVAS_OP_TO_THEBES_OP("xor", XOR)
|
||||||
// not part of spec, kept here for compat
|
// not part of spec, kept here for compat
|
||||||
else CANVAS_OP_TO_THEBES_OP("over", OVER)
|
else CANVAS_OP_TO_THEBES_OP("over", OVER)
|
||||||
else return NS_ERROR_NOT_IMPLEMENTED;
|
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||||
|
else return NS_OK;
|
||||||
|
|
||||||
#undef CANVAS_OP_TO_THEBES_OP
|
#undef CANVAS_OP_TO_THEBES_OP
|
||||||
|
|
||||||
|
@ -1463,7 +1463,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1569,7 +1569,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1596,7 +1596,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1642,7 +1642,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -9131,7 +9131,7 @@ ok(ctx.lineCap === 'butt', "ctx.lineCap === 'butt'");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -9505,7 +9505,7 @@ ok(ctx.lineJoin === 'bevel', "ctx.lineJoin === 'bevel'");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19316,7 +19316,7 @@ ok(canvas.getContext('2D') === null, "canvas.getContext('2D') === null");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19342,7 +19342,7 @@ ok(canvas.getContext("") === null, "canvas.getContext(\"\") === null");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19368,7 +19368,7 @@ ok(canvas.getContext('This is not an implemented context in any real browser') =
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19394,7 +19394,7 @@ ok(canvas.getContext("2d#") === null, "canvas.getContext(\"2d#\") === null");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19420,7 +19420,7 @@ ok(canvas.getContext("2d\0") === null, "canvas.getContext(\"2d\\0\") === null");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -19446,7 +19446,7 @@ ok(canvas.getContext("2\uFF44") === null, "canvas.getContext(\"2\\uFF44\") === n
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -20607,7 +20607,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -20715,7 +20715,7 @@ ok(/^data:image\/png[;,]/.test(data), "data =~ /^data:image\\/png[;,]/");
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
_thrown_outer = true;
|
_thrown_outer = true;
|
||||||
}
|
}
|
||||||
todo(!_thrown_outer, 'should not throw exception');
|
ok(!_thrown_outer, 'should not throw exception');
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -202,13 +202,7 @@ nsHTMLCanvasElement::ToDataURL(const nsAString& aType, const nsAString& aParams,
|
|||||||
return NS_ERROR_DOM_SECURITY_ERR;
|
return NS_ERROR_DOM_SECURITY_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsAutoString type(aType);
|
return ToDataURLImpl(aType, aParams, aDataURL);
|
||||||
|
|
||||||
if (type.IsEmpty()) {
|
|
||||||
type.AssignLiteral("image/png");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ToDataURLImpl(type, aParams, aDataURL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -229,13 +223,13 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
|||||||
const nsAString& aEncoderOptions,
|
const nsAString& aEncoderOptions,
|
||||||
nsAString& aDataURL)
|
nsAString& aDataURL)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
bool fallbackToPNG = false;
|
||||||
|
|
||||||
// We get an input stream from the context. If more than one context type
|
// We get an input stream from the context. If more than one context type
|
||||||
// is supported in the future, this will have to be changed to do the right
|
// is supported in the future, this will have to be changed to do the right
|
||||||
// thing. For now, just assume that the 2D context has all the goods.
|
// thing. For now, just assume that the 2D context has all the goods.
|
||||||
nsCOMPtr<nsICanvasRenderingContextInternal> context;
|
nsCOMPtr<nsICanvasRenderingContextInternal> context;
|
||||||
rv = GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(context));
|
nsresult rv = GetContext(NS_LITERAL_STRING("2d"), getter_AddRefs(context));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// get image bytes
|
// get image bytes
|
||||||
@ -244,8 +238,15 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
|||||||
rv = context->GetInputStream(nsPromiseFlatCString(aMimeType8).get(),
|
rv = context->GetInputStream(nsPromiseFlatCString(aMimeType8).get(),
|
||||||
nsPromiseFlatString(aEncoderOptions).get(),
|
nsPromiseFlatString(aEncoderOptions).get(),
|
||||||
getter_AddRefs(imgStream));
|
getter_AddRefs(imgStream));
|
||||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
if (NS_FAILED(rv)) {
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
// Use image/png instead.
|
||||||
|
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||||
|
fallbackToPNG = true;
|
||||||
|
rv = context->GetInputStream("image/png",
|
||||||
|
nsPromiseFlatString(aEncoderOptions).get(),
|
||||||
|
getter_AddRefs(imgStream));
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
|
||||||
// Generally, there will be only one chunk of data, and it will be available
|
// Generally, there will be only one chunk of data, and it will be available
|
||||||
// for us to read right away, so optimize this case.
|
// for us to read right away, so optimize this case.
|
||||||
@ -283,8 +284,12 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
|||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
// build data URL string
|
// build data URL string
|
||||||
aDataURL = NS_LITERAL_STRING("data:") + aMimeType +
|
if (fallbackToPNG)
|
||||||
NS_LITERAL_STRING(";base64,") + NS_ConvertUTF8toUTF16(encodedImg);
|
aDataURL = NS_LITERAL_STRING("data:image/png;base64,") +
|
||||||
|
NS_ConvertUTF8toUTF16(encodedImg);
|
||||||
|
else
|
||||||
|
aDataURL = NS_LITERAL_STRING("data:") + aMimeType +
|
||||||
|
NS_LITERAL_STRING(";base64,") + NS_ConvertUTF8toUTF16(encodedImg);
|
||||||
|
|
||||||
PR_Free(encodedImg);
|
PR_Free(encodedImg);
|
||||||
|
|
||||||
@ -309,7 +314,7 @@ nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
|
|||||||
(ctxId[i] != '_'))
|
(ctxId[i] != '_'))
|
||||||
{
|
{
|
||||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -326,7 +331,7 @@ nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
|
|||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
*aContext = nsnull;
|
*aContext = nsnull;
|
||||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = ctx->SetCanvasElement(this);
|
rv = ctx->SetCanvasElement(this);
|
||||||
@ -376,7 +381,7 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
|||||||
mCurrentContextId.Assign(aContextId);
|
mCurrentContextId.Assign(aContextId);
|
||||||
} else if (!mCurrentContextId.Equals(aContextId)) {
|
} else if (!mCurrentContextId.Equals(aContextId)) {
|
||||||
//XXX eventually allow for more than one active context on a given canvas
|
//XXX eventually allow for more than one active context on a given canvas
|
||||||
return NS_ERROR_INVALID_ARG;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ADDREF (*aContext = mCurrentContext);
|
NS_ADDREF (*aContext = mCurrentContext);
|
||||||
|
@ -1953,6 +1953,8 @@ nsSVGElement::GetAnimatedAttr(nsIAtom* aName)
|
|||||||
if (aName == nsGkAtoms::gradientTransform) {
|
if (aName == nsGkAtoms::gradientTransform) {
|
||||||
nsCOMPtr<nsIDOMSVGGradientElement> gradientElement(
|
nsCOMPtr<nsIDOMSVGGradientElement> gradientElement(
|
||||||
do_QueryInterface(static_cast<nsIContent*>(this)));
|
do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||||
|
if (!gradientElement)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
nsresult rv = gradientElement->GetGradientTransform(getter_AddRefs(transformList));
|
nsresult rv = gradientElement->GetGradientTransform(getter_AddRefs(transformList));
|
||||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||||
@ -1960,6 +1962,8 @@ nsSVGElement::GetAnimatedAttr(nsIAtom* aName)
|
|||||||
if (aName == nsGkAtoms::patternTransform) {
|
if (aName == nsGkAtoms::patternTransform) {
|
||||||
nsCOMPtr<nsIDOMSVGPatternElement> patternElement(
|
nsCOMPtr<nsIDOMSVGPatternElement> patternElement(
|
||||||
do_QueryInterface(static_cast<nsIContent*>(this)));
|
do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||||
|
if (!patternElement)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
nsresult rv = patternElement->GetPatternTransform(getter_AddRefs(transformList));
|
nsresult rv = patternElement->GetPatternTransform(getter_AddRefs(transformList));
|
||||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||||
|
@ -2056,6 +2056,10 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
|||||||
void
|
void
|
||||||
nsGlobalWindow::DispatchDOMWindowCreated()
|
nsGlobalWindow::DispatchDOMWindowCreated()
|
||||||
{
|
{
|
||||||
|
if (!mDoc || !mDocument) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Fire DOMWindowCreated at chrome event listeners
|
// Fire DOMWindowCreated at chrome event listeners
|
||||||
nsContentUtils::DispatchChromeEvent(mDoc, mDocument, NS_LITERAL_STRING("DOMWindowCreated"),
|
nsContentUtils::DispatchChromeEvent(mDoc, mDocument, NS_LITERAL_STRING("DOMWindowCreated"),
|
||||||
PR_TRUE /* bubbles */,
|
PR_TRUE /* bubbles */,
|
||||||
|
@ -872,7 +872,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
|
|||||||
if (wndProc != PluginWindowProc) {
|
if (wndProc != PluginWindowProc) {
|
||||||
mPluginWndProc = reinterpret_cast<WNDPROC>(
|
mPluginWndProc = reinterpret_cast<WNDPROC>(
|
||||||
SetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC,
|
SetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC,
|
||||||
reinterpret_cast<LONG>(PluginWindowProc)));
|
reinterpret_cast<LONG_PTR>(PluginWindowProc)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -983,7 +983,7 @@ PluginInstanceChild::CreatePluginWindow()
|
|||||||
|
|
||||||
// Apparently some plugins require an ASCII WndProc.
|
// Apparently some plugins require an ASCII WndProc.
|
||||||
SetWindowLongPtrA(mPluginWindowHWND, GWLP_WNDPROC,
|
SetWindowLongPtrA(mPluginWindowHWND, GWLP_WNDPROC,
|
||||||
reinterpret_cast<LONG>(DefWindowProcA));
|
reinterpret_cast<LONG_PTR>(DefWindowProcA));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -998,7 +998,7 @@ PluginInstanceChild::DestroyPluginWindow()
|
|||||||
if (wndProc == PluginWindowProc) {
|
if (wndProc == PluginWindowProc) {
|
||||||
NS_ASSERTION(mPluginWndProc, "Should have old proc here!");
|
NS_ASSERTION(mPluginWndProc, "Should have old proc here!");
|
||||||
SetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC,
|
SetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC,
|
||||||
reinterpret_cast<LONG>(mPluginWndProc));
|
reinterpret_cast<LONG_PTR>(mPluginWndProc));
|
||||||
mPluginWndProc = 0;
|
mPluginWndProc = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1013,7 +1013,7 @@ PluginInstanceChild::ReparentPluginWindow(HWND hWndParent)
|
|||||||
{
|
{
|
||||||
if (hWndParent != mPluginParentHWND && IsWindow(hWndParent)) {
|
if (hWndParent != mPluginParentHWND && IsWindow(hWndParent)) {
|
||||||
// Fix the child window's style to be a child window.
|
// Fix the child window's style to be a child window.
|
||||||
LONG style = GetWindowLongPtr(mPluginWindowHWND, GWL_STYLE);
|
LONG_PTR style = GetWindowLongPtr(mPluginWindowHWND, GWL_STYLE);
|
||||||
style |= WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
style |= WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||||
style &= ~WS_POPUP;
|
style &= ~WS_POPUP;
|
||||||
SetWindowLongPtr(mPluginWindowHWND, GWL_STYLE, style);
|
SetWindowLongPtr(mPluginWindowHWND, GWL_STYLE, style);
|
||||||
@ -1531,7 +1531,7 @@ PluginInstanceChild::UnhookWinlessFlashThrottle()
|
|||||||
|
|
||||||
// reset the subclass
|
// reset the subclass
|
||||||
SetWindowLongPtr(mWinlessHiddenMsgHWND, GWLP_WNDPROC,
|
SetWindowLongPtr(mWinlessHiddenMsgHWND, GWLP_WNDPROC,
|
||||||
reinterpret_cast<LONG>(tmpProc));
|
reinterpret_cast<LONG_PTR>(tmpProc));
|
||||||
|
|
||||||
// Remove our instance prop
|
// Remove our instance prop
|
||||||
RemoveProp(mWinlessHiddenMsgHWND, kPluginInstanceChildProperty);
|
RemoveProp(mWinlessHiddenMsgHWND, kPluginInstanceChildProperty);
|
||||||
@ -1603,7 +1603,7 @@ PluginInstanceChild::EnumThreadWindowsCallback(HWND hWnd,
|
|||||||
self->mWinlessHiddenMsgHWND = hWnd;
|
self->mWinlessHiddenMsgHWND = hWnd;
|
||||||
self->mWinlessThrottleOldWndProc =
|
self->mWinlessThrottleOldWndProc =
|
||||||
reinterpret_cast<WNDPROC>(SetWindowLongPtr(hWnd, GWLP_WNDPROC,
|
reinterpret_cast<WNDPROC>(SetWindowLongPtr(hWnd, GWLP_WNDPROC,
|
||||||
reinterpret_cast<LONG>(WinlessHiddenFlashWndProc)));
|
reinterpret_cast<LONG_PTR>(WinlessHiddenFlashWndProc)));
|
||||||
SetProp(hWnd, kPluginInstanceChildProperty, self);
|
SetProp(hWnd, kPluginInstanceChildProperty, self);
|
||||||
NS_ASSERTION(self->mWinlessThrottleOldWndProc,
|
NS_ASSERTION(self->mWinlessThrottleOldWndProc,
|
||||||
"SetWindowLongPtr failed?!");
|
"SetWindowLongPtr failed?!");
|
||||||
|
@ -1150,7 +1150,7 @@ PluginInstanceParent::SubclassPluginWindow(HWND aWnd)
|
|||||||
mPluginHWND = aWnd;
|
mPluginHWND = aWnd;
|
||||||
mPluginWndProc =
|
mPluginWndProc =
|
||||||
(WNDPROC)::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
(WNDPROC)::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
||||||
reinterpret_cast<LONG>(PluginWindowHookProc));
|
reinterpret_cast<LONG_PTR>(PluginWindowHookProc));
|
||||||
bool bRes = ::SetPropW(mPluginHWND, kPluginInstanceParentProperty, this);
|
bool bRes = ::SetPropW(mPluginHWND, kPluginInstanceParentProperty, this);
|
||||||
NS_ASSERTION(mPluginWndProc,
|
NS_ASSERTION(mPluginWndProc,
|
||||||
"PluginInstanceParent::SubclassPluginWindow failed to set subclass!");
|
"PluginInstanceParent::SubclassPluginWindow failed to set subclass!");
|
||||||
@ -1164,7 +1164,7 @@ PluginInstanceParent::UnsubclassPluginWindow()
|
|||||||
{
|
{
|
||||||
if (mPluginHWND && mPluginWndProc) {
|
if (mPluginHWND && mPluginWndProc) {
|
||||||
::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
||||||
reinterpret_cast<LONG>(mPluginWndProc));
|
reinterpret_cast<LONG_PTR>(mPluginWndProc));
|
||||||
|
|
||||||
::RemovePropW(mPluginHWND, kPluginInstanceParentProperty);
|
::RemovePropW(mPluginHWND, kPluginInstanceParentProperty);
|
||||||
|
|
||||||
|
@ -1275,7 +1275,7 @@ x86_64 | ia64)
|
|||||||
CPU_ARCH="$OS_TEST"
|
CPU_ARCH="$OS_TEST"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
arm)
|
arm*)
|
||||||
CPU_ARCH=arm
|
CPU_ARCH=arm
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@ -1796,15 +1796,6 @@ VisitGlobalSlots(Visitor &visitor, JSContext *cx, JSObject *globalObj,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Visitor>
|
|
||||||
static JS_REQUIRES_STACK JS_ALWAYS_INLINE void
|
|
||||||
VisitGlobalSlots(Visitor &visitor, JSContext *cx, TreeFragment *f)
|
|
||||||
{
|
|
||||||
JSObject* globalObj = f->globalObj();
|
|
||||||
SlotList& gslots = *f->globalSlots;
|
|
||||||
VisitGlobalSlots(visitor, cx, globalObj, gslots.length(), gslots.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
class AdjustCallerTypeVisitor;
|
class AdjustCallerTypeVisitor;
|
||||||
|
|
||||||
template <typename Visitor>
|
template <typename Visitor>
|
||||||
|
@ -3593,7 +3593,10 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
|
|||||||
ssm->GetCxSubjectPrincipalAndFrame(cx, &fp);
|
ssm->GetCxSubjectPrincipalAndFrame(cx, &fp);
|
||||||
PRBool system;
|
PRBool system;
|
||||||
ssm->IsSystemPrincipal(subjectPrincipal, &system);
|
ssm->IsSystemPrincipal(subjectPrincipal, &system);
|
||||||
NS_ASSERTION(!fp || system, "Bad caller!");
|
if (fp && !system) {
|
||||||
|
ssm->IsCapabilityEnabled("UniversalXPConnect", &system);
|
||||||
|
NS_ASSERTION(system, "Bad caller!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -2886,7 +2886,12 @@ CallMethodHelper::ConvertIndependentParams(JSBool* foundDependentParam)
|
|||||||
// is really an 'out' param masquerading as an 'in' param.
|
// is really an 'out' param masquerading as an 'in' param.
|
||||||
NS_ASSERTION(i < mArgc || paramInfo.IsOptional(),
|
NS_ASSERTION(i < mArgc || paramInfo.IsOptional(),
|
||||||
"Expected either enough arguments or an optional argument");
|
"Expected either enough arguments or an optional argument");
|
||||||
src = i < mArgc ? mArgv[i] : JSVAL_NULL;
|
if(i < mArgc)
|
||||||
|
src = mArgv[i];
|
||||||
|
else if(type_tag == nsXPTType::T_JSVAL)
|
||||||
|
src = JSVAL_VOID;
|
||||||
|
else
|
||||||
|
src = JSVAL_NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsID param_iid;
|
nsID param_iid;
|
||||||
|
@ -75,7 +75,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
|||||||
mBuildCaret(aBuildCaret),
|
mBuildCaret(aBuildCaret),
|
||||||
mEventDelivery(aIsForEvents),
|
mEventDelivery(aIsForEvents),
|
||||||
mIsAtRootOfPseudoStackingContext(PR_FALSE),
|
mIsAtRootOfPseudoStackingContext(PR_FALSE),
|
||||||
mPaintAllFrames(PR_FALSE),
|
mSelectedFramesOnly(PR_FALSE),
|
||||||
mAccurateVisibleRegions(PR_FALSE),
|
mAccurateVisibleRegions(PR_FALSE),
|
||||||
mInTransform(PR_FALSE),
|
mInTransform(PR_FALSE),
|
||||||
mSyncDecodeImages(PR_FALSE),
|
mSyncDecodeImages(PR_FALSE),
|
||||||
|
@ -235,11 +235,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
nsIFrame* GetIgnoreScrollFrame() { return mIgnoreScrollFrame; }
|
nsIFrame* GetIgnoreScrollFrame() { return mIgnoreScrollFrame; }
|
||||||
/**
|
/**
|
||||||
* Calling this setter makes us ignore all dirty rects and include all
|
* Calling this setter makes us:
|
||||||
* descendant frames in the display list, wherever they may be positioned.
|
* 1. include all positioned descendant frames in the display list,
|
||||||
|
* wherever they may be positioned (even outside the dirty rects).
|
||||||
|
* 2. exclude all leaf frames that does not have the NS_FRAME_SELECTED_CONTENT
|
||||||
|
* bit.
|
||||||
*/
|
*/
|
||||||
void SetPaintAllFrames() { mPaintAllFrames = PR_TRUE; }
|
void SetSelectedFramesOnly() { mSelectedFramesOnly = PR_TRUE; }
|
||||||
PRBool GetPaintAllFrames() { return mPaintAllFrames; }
|
PRBool GetSelectedFramesOnly() { return mSelectedFramesOnly; }
|
||||||
/**
|
/**
|
||||||
* Calling this setter makes us compute accurate visible regions at the cost
|
* Calling this setter makes us compute accurate visible regions at the cost
|
||||||
* of performance if regions get very complex.
|
* of performance if regions get very complex.
|
||||||
@ -426,7 +429,7 @@ private:
|
|||||||
PRPackedBool mEventDelivery;
|
PRPackedBool mEventDelivery;
|
||||||
PRPackedBool mIsBackgroundOnly;
|
PRPackedBool mIsBackgroundOnly;
|
||||||
PRPackedBool mIsAtRootOfPseudoStackingContext;
|
PRPackedBool mIsAtRootOfPseudoStackingContext;
|
||||||
PRPackedBool mPaintAllFrames;
|
PRPackedBool mSelectedFramesOnly;
|
||||||
PRPackedBool mAccurateVisibleRegions;
|
PRPackedBool mAccurateVisibleRegions;
|
||||||
// True when we're building a display list that's directly or indirectly
|
// True when we're building a display list that's directly or indirectly
|
||||||
// under an nsDisplayTransform
|
// under an nsDisplayTransform
|
||||||
|
@ -1023,7 +1023,8 @@ protected:
|
|||||||
// create a RangePaintInfo for the range aRange containing the
|
// create a RangePaintInfo for the range aRange containing the
|
||||||
// display list needed to paint the range to a surface
|
// display list needed to paint the range to a surface
|
||||||
RangePaintInfo* CreateRangePaintInfo(nsIDOMRange* aRange,
|
RangePaintInfo* CreateRangePaintInfo(nsIDOMRange* aRange,
|
||||||
nsRect& aSurfaceRect);
|
nsRect& aSurfaceRect,
|
||||||
|
PRBool aForPrimarySelection);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Paint the items to a new surface and return it.
|
* Paint the items to a new surface and return it.
|
||||||
@ -5458,7 +5459,8 @@ static PRBool gDumpRangePaintList = PR_FALSE;
|
|||||||
|
|
||||||
RangePaintInfo*
|
RangePaintInfo*
|
||||||
PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
||||||
nsRect& aSurfaceRect)
|
nsRect& aSurfaceRect,
|
||||||
|
PRBool aForPrimarySelection)
|
||||||
{
|
{
|
||||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||||
|
|
||||||
@ -5507,7 +5509,9 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
|||||||
nsRect ancestorRect = ancestorFrame->GetOverflowRect();
|
nsRect ancestorRect = ancestorFrame->GetOverflowRect();
|
||||||
|
|
||||||
// get a display list containing the range
|
// get a display list containing the range
|
||||||
info->mBuilder.SetPaintAllFrames();
|
if (aForPrimarySelection) {
|
||||||
|
info->mBuilder.SetSelectedFramesOnly();
|
||||||
|
}
|
||||||
info->mBuilder.EnterPresShell(ancestorFrame, ancestorRect);
|
info->mBuilder.EnterPresShell(ancestorFrame, ancestorRect);
|
||||||
ancestorFrame->BuildDisplayListForStackingContext(&info->mBuilder,
|
ancestorFrame->BuildDisplayListForStackingContext(&info->mBuilder,
|
||||||
ancestorRect, &info->mList);
|
ancestorRect, &info->mList);
|
||||||
@ -5685,7 +5689,7 @@ PresShell::RenderNode(nsIDOMNode* aNode,
|
|||||||
if (NS_FAILED(range->SelectNode(aNode)))
|
if (NS_FAILED(range->SelectNode(aNode)))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
RangePaintInfo* info = CreateRangePaintInfo(range, area);
|
RangePaintInfo* info = CreateRangePaintInfo(range, area, PR_FALSE);
|
||||||
if (info && !rangeItems.AppendElement(info)) {
|
if (info && !rangeItems.AppendElement(info)) {
|
||||||
delete info;
|
delete info;
|
||||||
return nsnull;
|
return nsnull;
|
||||||
@ -5733,7 +5737,7 @@ PresShell::RenderSelection(nsISelection* aSelection,
|
|||||||
nsCOMPtr<nsIDOMRange> range;
|
nsCOMPtr<nsIDOMRange> range;
|
||||||
aSelection->GetRangeAt(r, getter_AddRefs(range));
|
aSelection->GetRangeAt(r, getter_AddRefs(range));
|
||||||
|
|
||||||
RangePaintInfo* info = CreateRangePaintInfo(range, area);
|
RangePaintInfo* info = CreateRangePaintInfo(range, area, PR_TRUE);
|
||||||
if (info && !rangeItems.AppendElement(info)) {
|
if (info && !rangeItems.AppendElement(info)) {
|
||||||
delete info;
|
delete info;
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
@ -1467,9 +1467,14 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
|||||||
dirty.Empty();
|
dirty.Empty();
|
||||||
}
|
}
|
||||||
pseudoStackingContext = PR_TRUE;
|
pseudoStackingContext = PR_TRUE;
|
||||||
|
} else if (aBuilder->GetSelectedFramesOnly() &&
|
||||||
|
aChild->IsLeaf() &&
|
||||||
|
!(aChild->GetStateBits() & NS_FRAME_SELECTED_CONTENT)) {
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aBuilder->GetPaintAllFrames()) {
|
if (aBuilder->GetSelectedFramesOnly() &&
|
||||||
|
(aChild->GetStateBits() & NS_FRAME_OUT_OF_FLOW)) {
|
||||||
dirty = aChild->GetOverflowRect();
|
dirty = aChild->GetOverflowRect();
|
||||||
} else if (!(aChild->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
|
} else if (!(aChild->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
|
||||||
// No need to descend into aChild to catch placeholders for visible
|
// No need to descend into aChild to catch placeholders for visible
|
||||||
|
@ -3389,7 +3389,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
|||||||
nsAutoString data;
|
nsAutoString data;
|
||||||
if (mContent->Tag() == nsGkAtoms::object &&
|
if (mContent->Tag() == nsGkAtoms::object &&
|
||||||
!mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
|
!mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
|
||||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data)) {
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data) &&
|
||||||
|
!data.IsEmpty()) {
|
||||||
mNumCachedAttrs++;
|
mNumCachedAttrs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,9 +50,10 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsPNGEncoder, imgIEncoder, nsIInputStream, nsIAsyn
|
|||||||
|
|
||||||
nsPNGEncoder::nsPNGEncoder() : mPNG(nsnull), mPNGinfo(nsnull),
|
nsPNGEncoder::nsPNGEncoder() : mPNG(nsnull), mPNGinfo(nsnull),
|
||||||
mIsAnimation(PR_FALSE),
|
mIsAnimation(PR_FALSE),
|
||||||
|
mFinished(PR_FALSE),
|
||||||
mImageBuffer(nsnull), mImageBufferSize(0),
|
mImageBuffer(nsnull), mImageBufferSize(0),
|
||||||
mImageBufferUsed(0), mImageBufferReadPoint(0),
|
mImageBufferUsed(0), mImageBufferReadPoint(0),
|
||||||
mFinished(PR_FALSE), mCallback(nsnull),
|
mCallback(nsnull),
|
||||||
mCallbackTarget(nsnull), mNotifyThreshold(0),
|
mCallbackTarget(nsnull), mNotifyThreshold(0),
|
||||||
mMonitor("PNG Encoder Monitor")
|
mMonitor("PNG Encoder Monitor")
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
***** BEGIN LICENSE BLOCK *****
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
@ -14,9 +14,8 @@
|
|||||||
*
|
*
|
||||||
* The Original Code is mozilla.org code.
|
* The Original Code is mozilla.org code.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is
|
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||||
* Netscape Communications Corporation.
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
@ -36,6 +35,10 @@
|
|||||||
*
|
*
|
||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
#include "nsIServiceManager.h"
|
||||||
|
#include "nsIPrefService.h"
|
||||||
|
#include "nsIPrefBranch2.h"
|
||||||
|
|
||||||
#include "nsComponentManagerUtils.h"
|
#include "nsComponentManagerUtils.h"
|
||||||
#include "nsITimer.h"
|
#include "nsITimer.h"
|
||||||
#include "imgContainer.h"
|
#include "imgContainer.h"
|
||||||
@ -43,8 +46,7 @@
|
|||||||
|
|
||||||
static PRBool sInitialized = PR_FALSE;
|
static PRBool sInitialized = PR_FALSE;
|
||||||
static PRBool sTimerOn = PR_FALSE;
|
static PRBool sTimerOn = PR_FALSE;
|
||||||
/* TODO - don't hardcode. See bug 478398. */
|
static PRUint32 sMinDiscardTimeoutMs = 10000; /* Default if pref unreadable. */
|
||||||
static PRUint32 sMinDiscardTimeoutMs = 10000;
|
|
||||||
static nsITimer *sTimer = nsnull;
|
static nsITimer *sTimer = nsnull;
|
||||||
static struct imgDiscardTrackerNode sHead, sSentinel, sTail;
|
static struct imgDiscardTrackerNode sHead, sSentinel, sTail;
|
||||||
|
|
||||||
@ -129,6 +131,9 @@ imgDiscardTracker::Initialize()
|
|||||||
sSentinel.prev = &sHead;
|
sSentinel.prev = &sHead;
|
||||||
sSentinel.next = &sTail;
|
sSentinel.next = &sTail;
|
||||||
|
|
||||||
|
// Load the timeout
|
||||||
|
ReloadTimeout();
|
||||||
|
|
||||||
// Create and start the timer
|
// Create and start the timer
|
||||||
nsCOMPtr<nsITimer> t = do_CreateInstance("@mozilla.org/timer;1");
|
nsCOMPtr<nsITimer> t = do_CreateInstance("@mozilla.org/timer;1");
|
||||||
NS_ENSURE_TRUE(t, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE(t, NS_ERROR_OUT_OF_MEMORY);
|
||||||
@ -155,6 +160,37 @@ imgDiscardTracker::Shutdown()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the minimum timeout.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
imgDiscardTracker::ReloadTimeout()
|
||||||
|
{
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
// read the timeout pref
|
||||||
|
PRInt32 discardTimeout;
|
||||||
|
nsCOMPtr<nsIPrefBranch2> branch = do_GetService(NS_PREFSERVICE_CONTRACTID);
|
||||||
|
rv = branch->GetIntPref(DISCARD_TIMEOUT_PREF, &discardTimeout);
|
||||||
|
|
||||||
|
// If we got something bogus, return
|
||||||
|
if (!NS_SUCCEEDED(rv) || discardTimeout <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// If the value didn't change, return
|
||||||
|
if ((PRUint32) discardTimeout == sMinDiscardTimeoutMs)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Update the value
|
||||||
|
sMinDiscardTimeoutMs = (PRUint32) discardTimeout;
|
||||||
|
|
||||||
|
// If the timer's on, restart the clock to make changes take effect
|
||||||
|
if (sTimerOn) {
|
||||||
|
TimerOff();
|
||||||
|
TimerOn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables the timer. No-op if the timer is already running.
|
* Enables the timer. No-op if the timer is already running.
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||||
*
|
***** BEGIN LICENSE BLOCK *****
|
||||||
* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
@ -15,9 +14,8 @@
|
|||||||
*
|
*
|
||||||
* The Original Code is mozilla.org code.
|
* The Original Code is mozilla.org code.
|
||||||
*
|
*
|
||||||
* The Initial Developer of the Original Code is
|
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||||
* Netscape Communications Corporation.
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
* the Initial Developer. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
@ -40,6 +38,8 @@
|
|||||||
#ifndef __imgDiscardTracker_h__
|
#ifndef __imgDiscardTracker_h__
|
||||||
#define __imgDiscardTracker_h__
|
#define __imgDiscardTracker_h__
|
||||||
|
|
||||||
|
#define DISCARD_TIMEOUT_PREF "image.mem.min_discard_timeout_ms"
|
||||||
|
|
||||||
class imgContainer;
|
class imgContainer;
|
||||||
class nsITimer;
|
class nsITimer;
|
||||||
|
|
||||||
@ -73,6 +73,7 @@ class imgDiscardTracker
|
|||||||
static nsresult Reset(struct imgDiscardTrackerNode *node);
|
static nsresult Reset(struct imgDiscardTrackerNode *node);
|
||||||
static void Remove(struct imgDiscardTrackerNode *node);
|
static void Remove(struct imgDiscardTrackerNode *node);
|
||||||
static void Shutdown();
|
static void Shutdown();
|
||||||
|
static void ReloadTimeout();
|
||||||
private:
|
private:
|
||||||
static nsresult Initialize();
|
static nsresult Initialize();
|
||||||
static nsresult TimerOn();
|
static nsresult TimerOn();
|
||||||
|
@ -78,6 +78,7 @@
|
|||||||
#include "nsIApplicationCacheContainer.h"
|
#include "nsIApplicationCacheContainer.h"
|
||||||
|
|
||||||
#include "nsIMemoryReporter.h"
|
#include "nsIMemoryReporter.h"
|
||||||
|
#include "nsIPrivateBrowsingService.h"
|
||||||
|
|
||||||
// we want to explore making the document own the load group
|
// we want to explore making the document own the load group
|
||||||
// so we can associate the document URI with the load group.
|
// so we can associate the document URI with the load group.
|
||||||
@ -874,19 +875,36 @@ nsresult imgLoader::Init()
|
|||||||
|
|
||||||
prefs->AddObserver("image.http.accept", this, PR_TRUE);
|
prefs->AddObserver("image.http.accept", this, PR_TRUE);
|
||||||
|
|
||||||
|
// Listen for when we leave private browsing mode
|
||||||
|
nsCOMPtr<nsIObserverService> obService = mozilla::services::GetObserverService();
|
||||||
|
if (obService)
|
||||||
|
obService->AddObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC, PR_TRUE);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData)
|
imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0,
|
// We listen for pref change notifications...
|
||||||
"invalid topic received");
|
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
|
||||||
|
if (!strcmp(NS_ConvertUTF16toUTF8(aData).get(), "image.http.accept")) {
|
||||||
if (strcmp(NS_ConvertUTF16toUTF8(aData).get(), "image.http.accept") == 0) {
|
nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject);
|
||||||
nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject);
|
ReadAcceptHeaderPref(prefs);
|
||||||
ReadAcceptHeaderPref(prefs);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ...and exits from private browsing.
|
||||||
|
else if (!strcmp(aTopic, NS_PRIVATE_BROWSING_SWITCH_TOPIC)) {
|
||||||
|
if (NS_LITERAL_STRING(NS_PRIVATE_BROWSING_LEAVE).Equals(aData))
|
||||||
|
ClearImageCache();
|
||||||
|
}
|
||||||
|
|
||||||
|
// (Nothing else should bring us here)
|
||||||
|
else {
|
||||||
|
NS_ABORT_IF_FALSE(0, "Invalid topic received");
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +74,8 @@
|
|||||||
#include "nsIPrefService.h"
|
#include "nsIPrefService.h"
|
||||||
#include "nsIPrefBranch2.h"
|
#include "nsIPrefBranch2.h"
|
||||||
|
|
||||||
|
#include "imgDiscardTracker.h"
|
||||||
|
|
||||||
#define DISCARD_PREF "image.mem.discardable"
|
#define DISCARD_PREF "image.mem.discardable"
|
||||||
#define DECODEONDRAW_PREF "image.mem.decodeondraw"
|
#define DECODEONDRAW_PREF "image.mem.decodeondraw"
|
||||||
|
|
||||||
@ -103,6 +105,9 @@ ReloadPrefs(nsIPrefBranch *aBranch)
|
|||||||
rv = aBranch->GetBoolPref(DECODEONDRAW_PREF, &decodeondraw);
|
rv = aBranch->GetBoolPref(DECODEONDRAW_PREF, &decodeondraw);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
gDecodeOnDraw = decodeondraw;
|
gDecodeOnDraw = decodeondraw;
|
||||||
|
|
||||||
|
// Discard timeout
|
||||||
|
imgDiscardTracker::ReloadTimeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Observer
|
// Observer
|
||||||
@ -124,7 +129,8 @@ imgRequestPrefObserver::Observe(nsISupports *aSubject,
|
|||||||
|
|
||||||
// Right pref
|
// Right pref
|
||||||
if (strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_PREF) &&
|
if (strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_PREF) &&
|
||||||
strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DECODEONDRAW_PREF))
|
strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DECODEONDRAW_PREF) &&
|
||||||
|
strcmp(NS_LossyConvertUTF16toASCII(aData).get(), DISCARD_TIMEOUT_PREF))
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
// Get the pref branch
|
// Get the pref branch
|
||||||
@ -224,6 +230,7 @@ nsresult imgRequest::Init(nsIURI *aURI,
|
|||||||
if (branch) {
|
if (branch) {
|
||||||
branch->AddObserver(DISCARD_PREF, observer, PR_FALSE);
|
branch->AddObserver(DISCARD_PREF, observer, PR_FALSE);
|
||||||
branch->AddObserver(DECODEONDRAW_PREF, observer, PR_FALSE);
|
branch->AddObserver(DECODEONDRAW_PREF, observer, PR_FALSE);
|
||||||
|
branch->AddObserver(DISCARD_TIMEOUT_PREF, observer, PR_FALSE);
|
||||||
ReloadPrefs(branch);
|
ReloadPrefs(branch);
|
||||||
gRegisteredPrefObserver = PR_TRUE;
|
gRegisteredPrefObserver = PR_TRUE;
|
||||||
}
|
}
|
||||||
@ -1008,7 +1015,7 @@ NS_IMETHODIMP imgRequest::OnStopRequest(nsIRequest *aRequest, nsISupports *ctxt,
|
|||||||
// If the request went through, say we loaded the image, and update the
|
// If the request went through, say we loaded the image, and update the
|
||||||
// cache entry size. Otherwise, cancel the request, which adds an error
|
// cache entry size. Otherwise, cancel the request, which adds an error
|
||||||
// flag to mImageStatus.
|
// flag to mImageStatus.
|
||||||
if (NS_SUCCEEDED(status)) {
|
if (mImage && NS_SUCCEEDED(status)) {
|
||||||
|
|
||||||
// Flag that we loaded the image
|
// Flag that we loaded the image
|
||||||
mImageStatus |= imgIRequest::STATUS_LOAD_COMPLETE;
|
mImageStatus |= imgIRequest::STATUS_LOAD_COMPLETE;
|
||||||
|
@ -69,6 +69,7 @@ _TEST_FILES = imgutils.js \
|
|||||||
test_bug497665.html \
|
test_bug497665.html \
|
||||||
bug497665-iframe.html \
|
bug497665-iframe.html \
|
||||||
bug497665.sjs \
|
bug497665.sjs \
|
||||||
|
test_bug553982.html \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
#test_bug435296.html disabled until we re-enable decode-on-draw
|
#test_bug435296.html disabled until we re-enable decode-on-draw
|
||||||
|
39
modules/libpr0n/test/mochitest/test_bug553982.html
Normal file
39
modules/libpr0n/test/mochitest/test_bug553982.html
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=553982
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 553982</title>
|
||||||
|
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||||
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=553982">Mozilla Bug 553982</a>
|
||||||
|
<pre id="test">
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
var success = false;
|
||||||
|
|
||||||
|
// This should fire
|
||||||
|
function doError() {
|
||||||
|
success = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This should not fire
|
||||||
|
function doLoad() {
|
||||||
|
ok(false, "onload should not fire");
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function() {
|
||||||
|
ok(success, "onerror should fire");
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
<img src="data:text/html," onerror="doError()" onload="doLoad()" />
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -3118,6 +3118,11 @@ pref("image.mem.discardable", false);
|
|||||||
// them to be decoded on demand when they are drawn.
|
// them to be decoded on demand when they are drawn.
|
||||||
pref("image.mem.decodeondraw", false);
|
pref("image.mem.decodeondraw", false);
|
||||||
|
|
||||||
|
// Minimum timeout for image discarding (in milliseconds). The actual time in
|
||||||
|
// which an image must inactive for it to be discarded will vary between this
|
||||||
|
// value and twice this value.
|
||||||
|
pref("image.mem.min_discard_timeout_ms", 10000);
|
||||||
|
|
||||||
// WebGL prefs
|
// WebGL prefs
|
||||||
pref("webgl.enabled_for_all_sites", false);
|
pref("webgl.enabled_for_all_sites", false);
|
||||||
pref("webgl.software_render", false);
|
pref("webgl.software_render", false);
|
||||||
|
@ -876,7 +876,6 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance(NPPluginFuncs* callbacks,
|
|||||||
mWantsAllNetworkStreams(PR_FALSE),
|
mWantsAllNetworkStreams(PR_FALSE),
|
||||||
mInPluginInitCall(PR_FALSE),
|
mInPluginInitCall(PR_FALSE),
|
||||||
mLibrary(aLibrary),
|
mLibrary(aLibrary),
|
||||||
mStreamListeners(nsnull),
|
|
||||||
mMIMEType(nsnull),
|
mMIMEType(nsnull),
|
||||||
mOwner(nsnull),
|
mOwner(nsnull),
|
||||||
mCurrentPluginEvent(nsnull)
|
mCurrentPluginEvent(nsnull)
|
||||||
@ -1093,9 +1092,6 @@ nsNPAPIPluginInstance::InitializePlugin()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX Note that the NPPluginType_* enums were crafted to be
|
|
||||||
// backward compatible...
|
|
||||||
|
|
||||||
PRInt32 mode;
|
PRInt32 mode;
|
||||||
const char* mimetype;
|
const char* mimetype;
|
||||||
NPError error = NPERR_GENERIC_ERROR;
|
NPError error = NPERR_GENERIC_ERROR;
|
||||||
|
@ -544,7 +544,7 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
|
|||||||
if (PluginWndProc == currentWndProc)
|
if (PluginWndProc == currentWndProc)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
LONG style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||||
#ifdef MOZ_IPC
|
#ifdef MOZ_IPC
|
||||||
// Out of process plugins must not have the WS_CLIPCHILDREN style set on their
|
// Out of process plugins must not have the WS_CLIPCHILDREN style set on their
|
||||||
// parent windows or else synchronous paints (via UpdateWindow() and others)
|
// parent windows or else synchronous paints (via UpdateWindow() and others)
|
||||||
@ -588,7 +588,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
|
|||||||
if (currentWndProc == PluginWndProc)
|
if (currentWndProc == PluginWndProc)
|
||||||
SubclassWindow(hWnd, (LONG_PTR)mPluginWinProc);
|
SubclassWindow(hWnd, (LONG_PTR)mPluginWinProc);
|
||||||
|
|
||||||
LONG style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||||
style &= ~WS_CLIPCHILDREN;
|
style &= ~WS_CLIPCHILDREN;
|
||||||
SetWindowLongPtr(hWnd, GWL_STYLE, style);
|
SetWindowLongPtr(hWnd, GWL_STYLE, style);
|
||||||
}
|
}
|
||||||
|
@ -179,11 +179,6 @@ HUD_SERVICE.prototype =
|
|||||||
*/
|
*/
|
||||||
filterPrefs: {},
|
filterPrefs: {},
|
||||||
|
|
||||||
/**
|
|
||||||
* We keep track of all of the DOMMutation event listers in this object
|
|
||||||
*/
|
|
||||||
mutationEventFunctions: {},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler to get window errors
|
* Event handler to get window errors
|
||||||
* TODO: a bit of a hack but is able to associate
|
* TODO: a bit of a hack but is able to associate
|
||||||
@ -383,24 +378,6 @@ HUD_SERVICE.prototype =
|
|||||||
setFilterState: function HS_setFilterState(aHUDId, aToggleType, aState)
|
setFilterState: function HS_setFilterState(aHUDId, aToggleType, aState)
|
||||||
{
|
{
|
||||||
this.filterPrefs[aHUDId][aToggleType] = aState;
|
this.filterPrefs[aHUDId][aToggleType] = aState;
|
||||||
this.toggleBinaryFilter(aToggleType, aHUDId);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* toggle a binary filter on the filter toolbar
|
|
||||||
*
|
|
||||||
* @param string aFilter
|
|
||||||
* @param string aHUDId
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
toggleBinaryFilter:
|
|
||||||
function HS_toggleBinaryFilter(aFilter, aHUDId)
|
|
||||||
{
|
|
||||||
// this is used when document-specific listeners have to be
|
|
||||||
// started or stopped
|
|
||||||
if (aFilter == "mutation") {
|
|
||||||
this.toggleMutationListeners(aHUDId);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1372,69 +1349,6 @@ HUD_SERVICE.prototype =
|
|||||||
throw new Error("HS_getContentWindowFromHUD: Cannot get contentWindow");
|
throw new Error("HS_getContentWindowFromHUD: Cannot get contentWindow");
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* attaches the DOMMutation listeners to a nsIDOMWindow object
|
|
||||||
*
|
|
||||||
* @param nsIDOMWindow aWindow
|
|
||||||
* @param string aHUDId
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
attachMutationListeners:
|
|
||||||
function HS_attachMutationListeners(aWindow, aHUDId)
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
// remove first in case it is on already
|
|
||||||
new ConsoleDOMListeners(aWindow, aHUDId, true);
|
|
||||||
// add mutation listeners
|
|
||||||
var domListeners = new ConsoleDOMListeners(aWindow, aHUDId);
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
Cu.reportError(ex);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* removes DOMMutation listeners
|
|
||||||
*
|
|
||||||
* @param nsIDOMWindow aWindow
|
|
||||||
* @param string aHUDId
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
removeMutationListeners:
|
|
||||||
function HS_removeMutationListeners(aWindow, aHUDId)
|
|
||||||
{
|
|
||||||
// turns off the listeners if active
|
|
||||||
try {
|
|
||||||
new ConsoleDOMListeners(aWindow, aHUDId, true);
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
Cu.reportError(ex);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* toggle on and off teh DOMMutation listeners
|
|
||||||
*
|
|
||||||
* @param string aHUDId
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
toggleMutationListeners: function HS_toggleMutationListeners(aHUDId)
|
|
||||||
{
|
|
||||||
// get the contentWindow from the HUDId
|
|
||||||
var window = this.getContentWindowFromHUDId(aHUDId);
|
|
||||||
var filterState = this.getFilterState(aHUDId, "mutation");
|
|
||||||
|
|
||||||
if (!filterState) {
|
|
||||||
// turn it off
|
|
||||||
this.removeMutationListeners(window);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.attachMutationListeners(window, aHUDId);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
mutationListenerIndex: {},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a generator that always returns a unique number for use in the
|
* Creates a generator that always returns a unique number for use in the
|
||||||
* indexes
|
* indexes
|
||||||
@ -1568,10 +1482,6 @@ HUD_SERVICE.prototype =
|
|||||||
HUDService.registerHUDWeakReference(hudWeakRef, hudId);
|
HUDService.registerHUDWeakReference(hudWeakRef, hudId);
|
||||||
|
|
||||||
aContentWindow.wrappedJSObject.console = _hud.console;
|
aContentWindow.wrappedJSObject.console = _hud.console;
|
||||||
var mutationFlag = this.getFilterState(this.hudId, "mutation");
|
|
||||||
if (mutationFlag) {
|
|
||||||
this.attachMutationListeners(aContentWindow, this.hudId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// capture JS Errors
|
// capture JS Errors
|
||||||
@ -1714,11 +1624,7 @@ function HeadsUpDisplay(aConfig)
|
|||||||
let console = this.createConsole();
|
let console = this.createConsole();
|
||||||
|
|
||||||
this.contentWindow.wrappedJSObject.console = console;
|
this.contentWindow.wrappedJSObject.console = console;
|
||||||
// check prefs to see if we should attact mutation listeners
|
|
||||||
var mutationFlag = HUDService.getFilterState(this.hudId, "mutation");
|
|
||||||
if (mutationFlag) {
|
|
||||||
HUDService.attachMutationListeners(this.contentWindow, this.hudId);
|
|
||||||
}
|
|
||||||
// create the JSTerm input element
|
// create the JSTerm input element
|
||||||
try {
|
try {
|
||||||
this.createConsoleInput(this.contentWindow, this.consoleWrap, this.outputNode);
|
this.createConsoleInput(this.contentWindow, this.consoleWrap, this.outputNode);
|
||||||
@ -1948,8 +1854,7 @@ HeadsUpDisplay.prototype = {
|
|||||||
*/
|
*/
|
||||||
makeFilterToolbar: function HUD_makeFilterToolbar()
|
makeFilterToolbar: function HUD_makeFilterToolbar()
|
||||||
{
|
{
|
||||||
let buttons = ["Mutation", "Network", "CSSParser",
|
let buttons = ["Network", "CSSParser", "Exception", "Error",
|
||||||
"Exception", "Error",
|
|
||||||
"Info", "Warn", "Log",];
|
"Info", "Warn", "Log",];
|
||||||
|
|
||||||
let toolbar = this.makeXULNode("toolbar");
|
let toolbar = this.makeXULNode("toolbar");
|
||||||
@ -2695,137 +2600,6 @@ FirefoxApplicationHooks.prototype = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* ConsoleDOMListeners
|
|
||||||
* Attach DOM Mutation listeners to a document
|
|
||||||
* @param nsIDOMWindow aWindow
|
|
||||||
* @param string aHUDId
|
|
||||||
* @param boolean aRemoveBool
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
function ConsoleDOMListeners(aWindow, aHUDId, aRemoveBool)
|
|
||||||
{
|
|
||||||
this.hudId = aHUDId;
|
|
||||||
this.window = XPCNativeWrapper.unwrap(aWindow);
|
|
||||||
this.console = this.window.console;
|
|
||||||
this.document = this.window.document;
|
|
||||||
this.trackedEvents = ['DOMSubtreeModified',
|
|
||||||
'DOMNodeInserted',
|
|
||||||
'DOMNodeRemoved',
|
|
||||||
'DOMNodeRemovedFromDocument',
|
|
||||||
'DOMNodeInsertedIntoDocument',
|
|
||||||
'DOMAttrModified',
|
|
||||||
'DOMCharacterDataModified',
|
|
||||||
'DOMElementNameChanged',
|
|
||||||
'DOMAttributeNameChanged',
|
|
||||||
];
|
|
||||||
if (aRemoveBool) {
|
|
||||||
var removeFunc = this.removeAllListeners(aHUDId);
|
|
||||||
removeFunc();
|
|
||||||
}
|
|
||||||
this.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleDOMListeners.prototype = {
|
|
||||||
init: function CDL_init()
|
|
||||||
{
|
|
||||||
for (var event in this.trackedEvents) {
|
|
||||||
let evt = this.trackedEvents[event];
|
|
||||||
let callback = this.eventListenerFactory(evt);
|
|
||||||
|
|
||||||
this.document.addEventListener(evt, callback, false);
|
|
||||||
this.storeMutationFunc(this.hudId, callback, evt);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function factory that generates an event handler for DOM Mutations
|
|
||||||
*
|
|
||||||
* @param string aEventName
|
|
||||||
* @returns function
|
|
||||||
*/
|
|
||||||
eventListenerFactory: function CDL_eventListenerFactory(aEventName)
|
|
||||||
{
|
|
||||||
var self = this;
|
|
||||||
function callback(aEvent)
|
|
||||||
{
|
|
||||||
var nodeTag = aEvent.target.tagName;
|
|
||||||
var nodeClass = aEvent.target.getAttribute("class");
|
|
||||||
if (!nodeClass) {
|
|
||||||
nodeClass = "null";
|
|
||||||
}
|
|
||||||
|
|
||||||
var nodeId = aEvent.target.getAttribute("id");
|
|
||||||
|
|
||||||
if (!nodeId) {
|
|
||||||
nodeId = "null";
|
|
||||||
}
|
|
||||||
|
|
||||||
var message = "DOM Mutation Event: '"
|
|
||||||
+ aEventName + "'"
|
|
||||||
+ " on node. "
|
|
||||||
+ " id: " + nodeId
|
|
||||||
+ " class: " + nodeClass
|
|
||||||
+ " tag: " + nodeTag;
|
|
||||||
|
|
||||||
self.console.info(message);
|
|
||||||
}
|
|
||||||
return callback;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* generates a function that removes all DOM Mutation listeners
|
|
||||||
* per HeadsUpDisplay
|
|
||||||
* TODO: needs some tweaks, see bug 568658
|
|
||||||
*
|
|
||||||
* @param string aHUDId
|
|
||||||
* @returns function
|
|
||||||
*/
|
|
||||||
removeAllListeners: function CDL_removeAllListeners(aHUDId)
|
|
||||||
{
|
|
||||||
var self = this;
|
|
||||||
function removeListeners()
|
|
||||||
{
|
|
||||||
for (var idx in HUDService.mutationEventFunctions[aHUDId]) {
|
|
||||||
let evtObj = HUDService.mutationEventFunctions[aHUDId][idx];
|
|
||||||
self.document.removeEventListener(evtObj.name, evtObj.func, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return removeListeners;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* store a DOM Mutation function for later retrieval,
|
|
||||||
* removal and destruction
|
|
||||||
*
|
|
||||||
* @param string aHUDId
|
|
||||||
* @param function aFunc
|
|
||||||
* @param string aEventName
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
storeMutationFunc:
|
|
||||||
function CDL_storeMutationFunc(aHUDId, aFunc, aEventName)
|
|
||||||
{
|
|
||||||
var evtObj = {func: aFunc, name: aEventName};
|
|
||||||
if (!HUDService.mutationEventFunctions[aHUDId]) {
|
|
||||||
HUDService.mutationEventFunctions[aHUDId] = [];
|
|
||||||
}
|
|
||||||
HUDService.mutationEventFunctions[aHUDId].push(evtObj);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the stored DOMMutation functions from the storage object
|
|
||||||
*
|
|
||||||
* @param string aHUDId
|
|
||||||
* @returns void
|
|
||||||
*/
|
|
||||||
removeStoredMutationFuncs:
|
|
||||||
function CDL_removeStoredMutationFuncs(aHUDId)
|
|
||||||
{
|
|
||||||
delete HUDService.mutationEventFunctions[aHUDId];
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Utility functions used by multiple callers
|
// Utility functions used by multiple callers
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
@ -2952,12 +2726,6 @@ HeadsUpDisplayUICommands = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleMutationListeners: function UIC_toggleMutationListeners(aButton)
|
|
||||||
{
|
|
||||||
var hudId = aButton.getAttribute("hudId");
|
|
||||||
// if the button is for mutations, tell HUD to toggle it
|
|
||||||
HUDService.toggleMutationListeners(hudId);
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////
|
||||||
@ -2969,8 +2737,7 @@ var prefs = Services.prefs;
|
|||||||
const GLOBAL_STORAGE_INDEX_ID = "GLOBAL_CONSOLE";
|
const GLOBAL_STORAGE_INDEX_ID = "GLOBAL_CONSOLE";
|
||||||
const PREFS_BRANCH_PREF = "devtools.hud.display.filter";
|
const PREFS_BRANCH_PREF = "devtools.hud.display.filter";
|
||||||
const PREFS_PREFIX = "devtools.hud.display.filter.";
|
const PREFS_PREFIX = "devtools.hud.display.filter.";
|
||||||
const PREFS = { mutation: PREFS_PREFIX + "mutation",
|
const PREFS = { network: PREFS_PREFIX + "network",
|
||||||
network: PREFS_PREFIX + "network",
|
|
||||||
cssparser: PREFS_PREFIX + "cssparser",
|
cssparser: PREFS_PREFIX + "cssparser",
|
||||||
exception: PREFS_PREFIX + "exception",
|
exception: PREFS_PREFIX + "exception",
|
||||||
error: PREFS_PREFIX + "error",
|
error: PREFS_PREFIX + "error",
|
||||||
@ -3012,7 +2779,6 @@ function ConsoleStorage()
|
|||||||
|
|
||||||
if (filterPrefs) {
|
if (filterPrefs) {
|
||||||
defaultDisplayPrefs = {
|
defaultDisplayPrefs = {
|
||||||
mutation: (prefs.getBoolPref(PREFS.mutation) ? true: false),
|
|
||||||
network: (prefs.getBoolPref(PREFS.network) ? true: false),
|
network: (prefs.getBoolPref(PREFS.network) ? true: false),
|
||||||
cssparser: (prefs.getBoolPref(PREFS.cssparser) ? true: false),
|
cssparser: (prefs.getBoolPref(PREFS.cssparser) ? true: false),
|
||||||
exception: (prefs.getBoolPref(PREFS.exception) ? true: false),
|
exception: (prefs.getBoolPref(PREFS.exception) ? true: false),
|
||||||
@ -3026,7 +2792,6 @@ function ConsoleStorage()
|
|||||||
else {
|
else {
|
||||||
prefs.setBoolPref(PREFS_BRANCH_PREF, false);
|
prefs.setBoolPref(PREFS_BRANCH_PREF, false);
|
||||||
// default prefs for each HeadsUpDisplay
|
// default prefs for each HeadsUpDisplay
|
||||||
prefs.setBoolPref(PREFS.mutation, false);
|
|
||||||
prefs.setBoolPref(PREFS.network, true);
|
prefs.setBoolPref(PREFS.network, true);
|
||||||
prefs.setBoolPref(PREFS.cssparser, true);
|
prefs.setBoolPref(PREFS.cssparser, true);
|
||||||
prefs.setBoolPref(PREFS.exception, true);
|
prefs.setBoolPref(PREFS.exception, true);
|
||||||
@ -3037,7 +2802,6 @@ function ConsoleStorage()
|
|||||||
prefs.setBoolPref(PREFS.global, false);
|
prefs.setBoolPref(PREFS.global, false);
|
||||||
|
|
||||||
defaultDisplayPrefs = {
|
defaultDisplayPrefs = {
|
||||||
mutation: prefs.getBoolPref(PREFS.mutation),
|
|
||||||
network: prefs.getBoolPref(PREFS.network),
|
network: prefs.getBoolPref(PREFS.network),
|
||||||
cssparser: prefs.getBoolPref(PREFS.cssparser),
|
cssparser: prefs.getBoolPref(PREFS.cssparser),
|
||||||
exception: prefs.getBoolPref(PREFS.exception),
|
exception: prefs.getBoolPref(PREFS.exception),
|
||||||
@ -3055,7 +2819,6 @@ ConsoleStorage.prototype = {
|
|||||||
|
|
||||||
updateDefaultDisplayPrefs:
|
updateDefaultDisplayPrefs:
|
||||||
function CS_updateDefaultDisplayPrefs(aPrefsObject) {
|
function CS_updateDefaultDisplayPrefs(aPrefsObject) {
|
||||||
prefs.setBoolPref(PREFS.mutation, (aPrefsObject.mutation ? true : false));
|
|
||||||
prefs.setBoolPref(PREFS.network, (aPrefsObject.network ? true : false));
|
prefs.setBoolPref(PREFS.network, (aPrefsObject.network ? true : false));
|
||||||
prefs.setBoolPref(PREFS.cssparser, (aPrefsObject.cssparser ? true : false));
|
prefs.setBoolPref(PREFS.cssparser, (aPrefsObject.cssparser ? true : false));
|
||||||
prefs.setBoolPref(PREFS.exception, (aPrefsObject.exception ? true : false));
|
prefs.setBoolPref(PREFS.exception, (aPrefsObject.exception ? true : false));
|
||||||
@ -3290,9 +3053,8 @@ HUDConsoleObserver = {
|
|||||||
Services.console.unregisterListener(this);
|
Services.console.unregisterListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aSubject instanceof Ci.nsIConsoleMessage) {
|
if (aSubject instanceof Ci.nsIScriptError) {
|
||||||
var err = aSubject.QueryInterface(Ci.nsIScriptError);
|
switch (aSubject.category) {
|
||||||
switch (err.category) {
|
|
||||||
case "XPConnect JavaScript":
|
case "XPConnect JavaScript":
|
||||||
case "component javascript":
|
case "component javascript":
|
||||||
case "chrome javascript":
|
case "chrome javascript":
|
||||||
@ -3302,7 +3064,7 @@ HUDConsoleObserver = {
|
|||||||
case "HUDConsole":
|
case "HUDConsole":
|
||||||
case "CSS Parser":
|
case "CSS Parser":
|
||||||
case "content javascript":
|
case "content javascript":
|
||||||
HUDService.reportConsoleServiceContentScriptError(err);
|
HUDService.reportConsoleServiceContentScriptError(aSubject);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
HUDService.reportConsoleServiceMessage(aSubject);
|
HUDService.reportConsoleServiceMessage(aSubject);
|
||||||
|
@ -63,8 +63,6 @@ const TEST_NETWORK_URI = "http://example.com/browser/toolkit/components/console/
|
|||||||
|
|
||||||
const TEST_FILTER_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-filter.html";
|
const TEST_FILTER_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-filter.html";
|
||||||
|
|
||||||
const TEST_MUTATION_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-mutation.html";
|
|
||||||
|
|
||||||
function noCacheUriSpec(aUriSpec) {
|
function noCacheUriSpec(aUriSpec) {
|
||||||
return aUriSpec + "?_=" + Date.now();
|
return aUriSpec + "?_=" + Date.now();
|
||||||
}
|
}
|
||||||
@ -264,26 +262,6 @@ function testNet()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// test DOM Mutation logging
|
|
||||||
function testDOMMutation()
|
|
||||||
{
|
|
||||||
HUDService.setFilterState(hudId, "mutation", true);
|
|
||||||
filterBox.value = "";
|
|
||||||
content.location = TEST_MUTATION_URI;
|
|
||||||
executeSoon(function() {
|
|
||||||
content.wrappedJSObject.addEventListener("DOMContentLoaded",
|
|
||||||
function () {
|
|
||||||
var successMsg = "Found Mutation Log Message";
|
|
||||||
var errMsg = "Could NOT find Mutation Log Message";
|
|
||||||
var display = HUDService.getHeadsUpDisplay(hudId);
|
|
||||||
var outputNode = display.querySelectorAll(".hud-output-node")[0];
|
|
||||||
testLogEntry(outputNode,
|
|
||||||
"Mutation", { success: successMsg, err: errMsg });
|
|
||||||
}, false);
|
|
||||||
content.location.href = TEST_NETWORK_URI;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function testCreateDisplay() {
|
function testCreateDisplay() {
|
||||||
ok(typeof cs.consoleDisplays == "object",
|
ok(typeof cs.consoleDisplays == "object",
|
||||||
"consoledisplays exist");
|
"consoledisplays exist");
|
||||||
@ -401,7 +379,6 @@ function test() {
|
|||||||
testConsoleLoggingAPI("exception");
|
testConsoleLoggingAPI("exception");
|
||||||
|
|
||||||
testNet();
|
testNet();
|
||||||
// testDOMMutation();
|
|
||||||
|
|
||||||
// ConsoleStorageTests
|
// ConsoleStorageTests
|
||||||
testCreateDisplay();
|
testCreateDisplay();
|
||||||
|
@ -279,7 +279,11 @@ var popupTests = [
|
|||||||
},
|
},
|
||||||
result: function(testname, step) {
|
result: function(testname, step) {
|
||||||
var rect = gMenuPopup.getBoundingClientRect();
|
var rect = gMenuPopup.getBoundingClientRect();
|
||||||
ok(rect.left == 60 && rect.top == 15 && rect.right && rect.bottom, testname);
|
ok(true, gScreenX + "," + gScreenY);
|
||||||
|
is(rect.left, 60, testname + " left");
|
||||||
|
is(rect.top, 15, testname + " top");
|
||||||
|
ok(rect.right, testname + " right is " + rect.right);
|
||||||
|
ok(rect.bottom, testname + " bottom is " + rect.bottom);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -319,7 +323,10 @@ var popupTests = [
|
|||||||
},
|
},
|
||||||
result: function(testname, step) {
|
result: function(testname, step) {
|
||||||
var rect = gMenuPopup.getBoundingClientRect();
|
var rect = gMenuPopup.getBoundingClientRect();
|
||||||
ok(rect.left == 24 && rect.top == 20 && rect.right && rect.bottom, testname);
|
is(rect.left, 24, testname + " left");
|
||||||
|
is(rect.top, 20, testname + " top");
|
||||||
|
ok(rect.right, testname + " right is " + rect.right);
|
||||||
|
ok(rect.bottom, testname + " bottom is " + rect.bottom);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -343,7 +350,10 @@ var popupTests = [
|
|||||||
},
|
},
|
||||||
result: function(testname, step) {
|
result: function(testname, step) {
|
||||||
var rect = gMenuPopup.getBoundingClientRect();
|
var rect = gMenuPopup.getBoundingClientRect();
|
||||||
ok(rect.left == 10 && rect.top == 18 && rect.right && rect.bottom, testname);
|
is(rect.left, 10, testname + " left");
|
||||||
|
is(rect.top, 18, testname + " top");
|
||||||
|
ok(rect.right, testname + " right is " + rect.right);
|
||||||
|
ok(rect.bottom, testname + " bottom is " + rect.bottom);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
<script type="text/javascript"><![CDATA[
|
<script type="text/javascript"><![CDATA[
|
||||||
const SPACER = /^spacer\d+/;
|
const SPACER = /^spacer\d+/;
|
||||||
const SEPARATOR = /^separator\d+/;
|
const SEPARATOR = /^separator\d+/;
|
||||||
const SPLITTER = /^splitter\d+/;
|
|
||||||
const SPRING = /^spring\d+/;
|
const SPRING = /^spring\d+/;
|
||||||
|
|
||||||
function testSet(aTb, aIDs, aResultIDs, aUseFixed) {
|
function testSet(aTb, aIDs, aResultIDs, aUseFixed) {
|
||||||
@ -131,12 +130,11 @@
|
|||||||
[["spacer"], [SPACER]],
|
[["spacer"], [SPACER]],
|
||||||
[["spring"], [SPRING]],
|
[["spring"], [SPRING]],
|
||||||
[["separator"], [SEPARATOR]],
|
[["separator"], [SEPARATOR]],
|
||||||
[["splitter"], [SPLITTER]],
|
|
||||||
[["p11", "p11", "p12", "spacer", "p11"], ["p11", "p12", SPACER]],
|
[["p11", "p11", "p12", "spacer", "p11"], ["p11", "p12", SPACER]],
|
||||||
[["splitter", "separator", "p11", "spring", "spacer"],
|
[["separator", "separator", "p11", "spring", "spacer"],
|
||||||
[SPLITTER, SEPARATOR, "p11", SPRING, SPACER]],
|
[SEPARATOR, SEPARATOR, "p11", SPRING, SPACER]],
|
||||||
[["splitter", "spacer", "splitter", "p11", "spring", "spacer", "p12", "spring"],
|
[["separator", "spacer", "separator", "p11", "spring", "spacer", "p12", "spring"],
|
||||||
[SPLITTER, SPACER, SPLITTER, "p11", SPRING, SPACER, "p12", SPRING]],
|
[SEPARATOR, SPACER, SEPARATOR, "p11", SPRING, SPACER, "p12", SPRING]],
|
||||||
emptySet
|
emptySet
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -146,8 +146,6 @@
|
|||||||
return "spring";
|
return "spring";
|
||||||
case "toolbarspacer":
|
case "toolbarspacer":
|
||||||
return "spacer";
|
return "spacer";
|
||||||
case "splitter":
|
|
||||||
return "splitter";
|
|
||||||
default:
|
default:
|
||||||
return aNode.id;
|
return aNode.id;
|
||||||
}
|
}
|
||||||
@ -260,11 +258,6 @@
|
|||||||
if (aId == "spring")
|
if (aId == "spring")
|
||||||
newItem.flex = 1;
|
newItem.flex = 1;
|
||||||
break;
|
break;
|
||||||
case "splitter":
|
|
||||||
newItem = document.createElementNS(XUL_NS, "splitter");
|
|
||||||
newItem.id = aId + Date.now() + this.childNodes.length;
|
|
||||||
newItem.className = "toolbar-splitter";
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
var toolbox = this.toolbox;
|
var toolbox = this.toolbox;
|
||||||
if (!toolbox)
|
if (!toolbox)
|
||||||
|
@ -71,6 +71,13 @@ HOST_CPPSRCS += \
|
|||||||
stabs_to_module.cc \
|
stabs_to_module.cc \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
ifdef MOZ_PLATFORM_MAEMO
|
||||||
|
# The GCC in scratchbox crashes writing DWARF debug info for language.cc.
|
||||||
|
# Since we don't really need debug symbols for the host tools anyway,
|
||||||
|
# just get rid of debug options.
|
||||||
|
HOST_CXXFLAGS = $(patsubst -g%,,$(CXXFLAGS))
|
||||||
|
endif
|
||||||
|
|
||||||
# This kind of sucks.
|
# This kind of sucks.
|
||||||
ifeq (Linux,$(OS_ARCH))
|
ifeq (Linux,$(OS_ARCH))
|
||||||
HOST_CXXFLAGS += -DHAVE_A_OUT_H
|
HOST_CXXFLAGS += -DHAVE_A_OUT_H
|
||||||
@ -81,13 +88,6 @@ endif
|
|||||||
|
|
||||||
HOST_CSRCS = $(CSRCS)
|
HOST_CSRCS = $(CSRCS)
|
||||||
|
|
||||||
ifdef MOZ_PLATFORM_MAEMO
|
|
||||||
# The GCC in scratchbox crashes writing DWARF debug info for language.cc.
|
|
||||||
# Since we don't really need debug symbols for the host tools anyway,
|
|
||||||
# just get rid of debug options.
|
|
||||||
HOST_CXXFLAGS = $(patsubst -g%,,$(CXXFLAGS))
|
|
||||||
endif
|
|
||||||
|
|
||||||
# need static lib
|
# need static lib
|
||||||
FORCE_STATIC_LIB = 1
|
FORCE_STATIC_LIB = 1
|
||||||
FORCE_USE_PIC = 1
|
FORCE_USE_PIC = 1
|
||||||
|
@ -47,10 +47,11 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
|||||||
|
|
||||||
var EXPORTED_SYMBOLS = [ "AddonManager", "AddonManagerPrivate" ];
|
var EXPORTED_SYMBOLS = [ "AddonManager", "AddonManagerPrivate" ];
|
||||||
|
|
||||||
|
const CATEGORY_PROVIDER_MODULE = "addon-provider-module";
|
||||||
|
|
||||||
// A list of providers to load by default
|
// A list of providers to load by default
|
||||||
const PROVIDERS = [
|
const DEFAULT_PROVIDERS = [
|
||||||
"resource://gre/modules/XPIProvider.jsm",
|
"resource://gre/modules/XPIProvider.jsm",
|
||||||
"resource://gre/modules/PluginProvider.jsm",
|
|
||||||
"resource://gre/modules/LightweightThemeManager.jsm"
|
"resource://gre/modules/LightweightThemeManager.jsm"
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -191,15 +192,32 @@ var AddonManagerInternal = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ensure all default providers have had a chance to register themselves
|
// Ensure all default providers have had a chance to register themselves
|
||||||
PROVIDERS.forEach(function(url) {
|
DEFAULT_PROVIDERS.forEach(function(url) {
|
||||||
try {
|
try {
|
||||||
Components.utils.import(url, {});
|
Components.utils.import(url, {});
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
ERROR("Exception loading provider \"" + url + "\": " + e);
|
ERROR("Exception loading default provider \"" + url + "\": " + e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Load any providers registered in the category manager
|
||||||
|
let catman = Cc["@mozilla.org/categorymanager;1"].
|
||||||
|
getService(Ci.nsICategoryManager);
|
||||||
|
let entries = catman.enumerateCategory(CATEGORY_PROVIDER_MODULE);
|
||||||
|
while (entries.hasMoreElements()) {
|
||||||
|
let entry = entries.getNext().QueryInterface(Ci.nsISupportsCString).data;
|
||||||
|
let url = catman.getCategoryEntry(CATEGORY_PROVIDER_MODULE, entry);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Components.utils.import(url, {});
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
ERROR("Exception loading provider " + entry + " from category \"" +
|
||||||
|
url + "\": " + e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let needsRestart = false;
|
let needsRestart = false;
|
||||||
this.providers.forEach(function(provider) {
|
this.providers.forEach(function(provider) {
|
||||||
callProvider(provider, "startup");
|
callProvider(provider, "startup");
|
||||||
|
@ -43,6 +43,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||||||
|
|
||||||
MODULE = extensions
|
MODULE = extensions
|
||||||
LIBRARY_NAME = extensions
|
LIBRARY_NAME = extensions
|
||||||
|
SHORT_LIBNAME = extnsion
|
||||||
IS_COMPONENT = 1
|
IS_COMPONENT = 1
|
||||||
MODULE_NAME = AddonsModule
|
MODULE_NAME = AddonsModule
|
||||||
GRE_MODULE = 1
|
GRE_MODULE = 1
|
||||||
@ -71,11 +72,15 @@ EXTRA_PP_JS_MODULES = \
|
|||||||
AddonManager.jsm \
|
AddonManager.jsm \
|
||||||
AddonRepository.jsm \
|
AddonRepository.jsm \
|
||||||
XPIProvider.jsm \
|
XPIProvider.jsm \
|
||||||
PluginProvider.jsm \
|
|
||||||
AddonUpdateChecker.jsm \
|
AddonUpdateChecker.jsm \
|
||||||
AddonLogging.jsm \
|
AddonLogging.jsm \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
ifdef MOZ_PLUGINS
|
||||||
|
EXTRA_PP_JS_MODULES += PluginProvider.jsm
|
||||||
|
DEFINES += -DMOZ_PLUGINS
|
||||||
|
endif
|
||||||
|
|
||||||
EXTRA_JS_MODULES = \
|
EXTRA_JS_MODULES = \
|
||||||
LightweightThemeManager.jsm \
|
LightweightThemeManager.jsm \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
@ -8,3 +8,6 @@ component {7beb3ba8-6ec3-41b4-b67c-da89b8518922} amContentHandler.js
|
|||||||
contract @mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall {7beb3ba8-6ec3-41b4-b67c-da89b8518922}
|
contract @mozilla.org/uriloader/content-handler;1?type=application/x-xpinstall {7beb3ba8-6ec3-41b4-b67c-da89b8518922}
|
||||||
component {0f38e086-89a3-40a5-8ffc-9b694de1d04a} amWebInstallListener.js
|
component {0f38e086-89a3-40a5-8ffc-9b694de1d04a} amWebInstallListener.js
|
||||||
contract @mozilla.org/addons/web-install-listener;1 {0f38e086-89a3-40a5-8ffc-9b694de1d04a}
|
contract @mozilla.org/addons/web-install-listener;1 {0f38e086-89a3-40a5-8ffc-9b694de1d04a}
|
||||||
|
#ifdef MOZ_PLUGINS
|
||||||
|
category addon-provider-module PluginProvider resource://gre/modules/PluginProvider.jsm
|
||||||
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user