mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-09 08:48:07 +00:00
Merge mozilla-central to tracemonkey.
This commit is contained in:
commit
dd51c79fca
@ -39,11 +39,10 @@
|
||||
#ifndef _nsAccCache_H_
|
||||
#define _nsAccCache_H_
|
||||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsIAccessible;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Accessible cache utils
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -122,6 +122,12 @@ Sanitizer.prototype = {
|
||||
// facility for timespan-based eviction. Wipe it.
|
||||
cacheService.evictEntries(Ci.nsICache.STORE_ANYWHERE);
|
||||
} 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()
|
||||
|
@ -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
|
||||
let (cm = Cc["@mozilla.org/cookiemanager;1"].
|
||||
getService(Ci.nsICookieManager2)) {
|
||||
|
@ -1538,7 +1538,7 @@ x86_64 | ia64)
|
||||
CPU_ARCH="$OS_TEST"
|
||||
;;
|
||||
|
||||
arm)
|
||||
arm*)
|
||||
CPU_ARCH=arm
|
||||
;;
|
||||
esac
|
||||
|
@ -39,6 +39,7 @@
|
||||
#define nsCopySupport_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsINode.h"
|
||||
|
||||
class nsISelection;
|
||||
class nsIDocument;
|
||||
@ -47,7 +48,6 @@ class nsIContent;
|
||||
class nsITransferable;
|
||||
class nsACString;
|
||||
class nsAString;
|
||||
class nsIDOMNode;
|
||||
class nsIPresShell;
|
||||
|
||||
class nsCopySupport
|
||||
@ -69,10 +69,14 @@ class nsCopySupport
|
||||
|
||||
// Get the selection as a transferable. Similar to HTMLCopy except does
|
||||
// not deal with the clipboard.
|
||||
static nsresult GetTransferableForSelection(nsISelection * aSelection,
|
||||
nsIDocument * aDocument,
|
||||
nsITransferable ** aTransferable);
|
||||
static nsresult GetTransferableForSelection(nsISelection* aSelection,
|
||||
nsIDocument* aDocument,
|
||||
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
|
||||
* within the document has its own selection, aSelection will be set to it
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "nsChannelProperties.h"
|
||||
|
||||
/* Keeps track of whether or not CSP is enabled */
|
||||
static PRBool gCSPEnabled = PR_TRUE;
|
||||
PRBool CSPService::sCSPEnabled = PR_TRUE;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gCspPRLog;
|
||||
@ -63,7 +63,7 @@ static PRLogModuleInfo* gCspPRLog;
|
||||
|
||||
CSPService::CSPService()
|
||||
{
|
||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &gCSPEnabled);
|
||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &sCSPEnabled);
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
if (!gCspPRLog)
|
||||
@ -102,7 +102,7 @@ CSPService::ShouldLoad(PRUint32 aContentType,
|
||||
*aDecision = nsIContentPolicy::ACCEPT;
|
||||
|
||||
// No need to continue processing if CSP is disabled
|
||||
if (!gCSPEnabled)
|
||||
if (!sCSPEnabled)
|
||||
return NS_OK;
|
||||
|
||||
// find the principal of the document that initiated this request and see
|
||||
@ -160,7 +160,7 @@ CSPService::ShouldProcess(PRUint32 aContentType,
|
||||
*aDecision = nsIContentPolicy::ACCEPT;
|
||||
|
||||
// No need to continue processing if CSP is disabled
|
||||
if (!gCSPEnabled)
|
||||
if (!sCSPEnabled)
|
||||
return NS_OK;
|
||||
|
||||
// find the nsDocument that initiated this request and see if it has a
|
||||
|
@ -52,7 +52,8 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICONTENTPOLICY
|
||||
NS_DECL_NSICHANNELEVENTSINK
|
||||
|
||||
|
||||
CSPService();
|
||||
virtual ~CSPService();
|
||||
static PRBool sCSPEnabled;
|
||||
};
|
||||
|
@ -79,7 +79,6 @@
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsRange.h"
|
||||
#include "nsIWebBrowserPersist.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -92,9 +91,7 @@
|
||||
#define kHTMLContext "text/_moz_htmlcontext"
|
||||
#define kHTMLInfo "text/_moz_htmlinfo"
|
||||
|
||||
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
|
||||
|
||||
// if inNode is null, use the selection from the window
|
||||
// if aNode is null, use the selection from the window
|
||||
static nsresult
|
||||
GetTransferableForNodeOrSelection(nsIDOMWindow* aWindow,
|
||||
nsIContent* aNode,
|
||||
@ -108,25 +105,15 @@ GetTransferableForNodeOrSelection(nsIDOMWindow* aWindow,
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(aNode);
|
||||
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);
|
||||
if (aNode) {
|
||||
rv = nsCopySupport::GetTransferableForNode(aNode, doc, aTransferable);
|
||||
} else {
|
||||
nsCOMPtr<nsISelection> selection;
|
||||
aWindow->GetSelection(getter_AddRefs(selection));
|
||||
rv = nsCopySupport::GetTransferableForSelection(selection, doc,
|
||||
aTransferable);
|
||||
}
|
||||
|
||||
rv = nsCopySupport::GetTransferableForSelection(selection, doc,
|
||||
aTransferable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return rv;
|
||||
}
|
||||
@ -424,7 +411,6 @@ DragDataProducer::GetNodeString(nsIContent* inNode,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
|
||||
PRBool* aCanDrag,
|
||||
|
@ -50,6 +50,7 @@
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsRange.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsFocusManager.h"
|
||||
@ -78,6 +79,8 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsContentCID.h"
|
||||
|
||||
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
|
||||
|
||||
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
|
||||
static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID);
|
||||
static NS_DEFINE_CID(kHTMLConverterCID, NS_HTMLFORMATCONVERTER_CID);
|
||||
@ -100,7 +103,7 @@ static nsresult AppendDOMNode(nsITransferable *aTransferable,
|
||||
static nsresult
|
||||
SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
||||
PRBool doPutOnClipboard, PRInt16 aClipboardID,
|
||||
nsITransferable ** aTransferable)
|
||||
PRUint32 aFlags, nsITransferable ** aTransferable)
|
||||
{
|
||||
// Clear the output parameter for the transferable, if provided.
|
||||
if (aTransferable) {
|
||||
@ -135,9 +138,8 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
||||
// 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
|
||||
// line breaks which are then converted into spaces by the htmlConverter (see bug #524975)
|
||||
PRUint32 flags = nsIDocumentEncoder::OutputPreformatted
|
||||
| nsIDocumentEncoder::OutputRaw
|
||||
| nsIDocumentEncoder::SkipInvisibleContent;
|
||||
PRUint32 flags = aFlags | nsIDocumentEncoder::OutputPreformatted
|
||||
| nsIDocumentEncoder::OutputRaw;
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDoc);
|
||||
NS_ASSERTION(domDoc, "Need a document");
|
||||
@ -178,7 +180,7 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
||||
|
||||
mimeType.AssignLiteral(kHTMLMime);
|
||||
|
||||
flags = nsIDocumentEncoder::SkipInvisibleContent;
|
||||
flags = aFlags;
|
||||
|
||||
rv = docEncoder->Init(domDoc, mimeType, flags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -279,17 +281,47 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
|
||||
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
|
||||
nsCopySupport::GetTransferableForSelection(nsISelection * aSel,
|
||||
nsIDocument * aDoc,
|
||||
nsITransferable ** aTransferable)
|
||||
nsCopySupport::GetTransferableForSelection(nsISelection* aSel,
|
||||
nsIDocument* aDoc,
|
||||
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,
|
||||
|
@ -195,6 +195,7 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
||||
|
||||
// FOR CSP (autogenerated by xpidl)
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsCSPService.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsHTMLCSSStyleSheet.h"
|
||||
|
||||
@ -202,9 +203,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID);
|
||||
using namespace mozilla::dom;
|
||||
|
||||
|
||||
/* Keeps track of whether or not CSP is enabled */
|
||||
static PRBool gCSPEnabled = PR_TRUE;
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
static PRLogModuleInfo* gDocumentLeakPRLog;
|
||||
static PRLogModuleInfo* gCspPRLog;
|
||||
@ -1409,8 +1407,6 @@ nsDocument::nsDocument(const char* aContentType)
|
||||
gCspPRLog = PR_NewLogModule("CSP");
|
||||
#endif
|
||||
|
||||
nsContentUtils::AddBoolPrefVarCache("security.csp.enable", &gCSPEnabled);
|
||||
|
||||
// Start out mLastStyleSheetSet as null, per spec
|
||||
SetDOMStringToNull(mLastStyleSheetSet);
|
||||
}
|
||||
@ -2175,7 +2171,7 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
||||
nsresult
|
||||
nsDocument::InitCSP()
|
||||
{
|
||||
if (gCSPEnabled) {
|
||||
if (CSPService::sCSPEnabled) {
|
||||
nsAutoString cspHeaderValue;
|
||||
nsAutoString cspROHeaderValue;
|
||||
|
||||
|
@ -402,6 +402,7 @@ _TEST_FILES2 = \
|
||||
test_websocket.html \
|
||||
file_websocket_wsh.py \
|
||||
file_websocket_http_resource.txt \
|
||||
test_bug574596.html \
|
||||
$(NULL)
|
||||
|
||||
# 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;
|
||||
else
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_OK;
|
||||
|
||||
mThebes->SetLineCap(cap);
|
||||
return NS_OK;
|
||||
@ -3147,7 +3147,7 @@ nsCanvasRenderingContext2D::SetLineJoin(const nsAString& joinstyle)
|
||||
j = gfxContext::LINE_JOIN_MITER;
|
||||
else
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
return NS_OK;
|
||||
|
||||
mThebes->SetLineJoin(j);
|
||||
return NS_OK;
|
||||
@ -3532,7 +3532,8 @@ nsCanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op)
|
||||
else CANVAS_OP_TO_THEBES_OP("xor", XOR)
|
||||
// not part of spec, kept here for compat
|
||||
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
|
||||
|
||||
|
@ -1463,7 +1463,7 @@ ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'
|
||||
} catch (e) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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) {
|
||||
_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;
|
||||
}
|
||||
|
||||
nsAutoString type(aType);
|
||||
|
||||
if (type.IsEmpty()) {
|
||||
type.AssignLiteral("image/png");
|
||||
}
|
||||
|
||||
return ToDataURLImpl(type, aParams, aDataURL);
|
||||
return ToDataURLImpl(aType, aParams, aDataURL);
|
||||
}
|
||||
|
||||
|
||||
@ -229,13 +223,13 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
||||
const nsAString& aEncoderOptions,
|
||||
nsAString& aDataURL)
|
||||
{
|
||||
nsresult rv;
|
||||
bool fallbackToPNG = false;
|
||||
|
||||
// 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
|
||||
// thing. For now, just assume that the 2D context has all the goods.
|
||||
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);
|
||||
|
||||
// get image bytes
|
||||
@ -244,8 +238,15 @@ nsHTMLCanvasElement::ToDataURLImpl(const nsAString& aMimeType,
|
||||
rv = context->GetInputStream(nsPromiseFlatCString(aMimeType8).get(),
|
||||
nsPromiseFlatString(aEncoderOptions).get(),
|
||||
getter_AddRefs(imgStream));
|
||||
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (NS_FAILED(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
|
||||
// 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;
|
||||
|
||||
// build data URL string
|
||||
aDataURL = NS_LITERAL_STRING("data:") + aMimeType +
|
||||
NS_LITERAL_STRING(";base64,") + NS_ConvertUTF8toUTF16(encodedImg);
|
||||
if (fallbackToPNG)
|
||||
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);
|
||||
|
||||
@ -309,7 +314,7 @@ nsHTMLCanvasElement::GetContextHelper(const nsAString& aContextId,
|
||||
(ctxId[i] != '_'))
|
||||
{
|
||||
// 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)) {
|
||||
*aContext = nsnull;
|
||||
// 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);
|
||||
@ -376,7 +381,7 @@ nsHTMLCanvasElement::GetContext(const nsAString& aContextId,
|
||||
mCurrentContextId.Assign(aContextId);
|
||||
} else if (!mCurrentContextId.Equals(aContextId)) {
|
||||
//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);
|
||||
|
@ -1953,6 +1953,8 @@ nsSVGElement::GetAnimatedAttr(nsIAtom* aName)
|
||||
if (aName == nsGkAtoms::gradientTransform) {
|
||||
nsCOMPtr<nsIDOMSVGGradientElement> gradientElement(
|
||||
do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||
if (!gradientElement)
|
||||
return nsnull;
|
||||
|
||||
nsresult rv = gradientElement->GetGradientTransform(getter_AddRefs(transformList));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
@ -1960,6 +1962,8 @@ nsSVGElement::GetAnimatedAttr(nsIAtom* aName)
|
||||
if (aName == nsGkAtoms::patternTransform) {
|
||||
nsCOMPtr<nsIDOMSVGPatternElement> patternElement(
|
||||
do_QueryInterface(static_cast<nsIContent*>(this)));
|
||||
if (!patternElement)
|
||||
return nsnull;
|
||||
|
||||
nsresult rv = patternElement->GetPatternTransform(getter_AddRefs(transformList));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
@ -2056,6 +2056,10 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
void
|
||||
nsGlobalWindow::DispatchDOMWindowCreated()
|
||||
{
|
||||
if (!mDoc || !mDocument) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Fire DOMWindowCreated at chrome event listeners
|
||||
nsContentUtils::DispatchChromeEvent(mDoc, mDocument, NS_LITERAL_STRING("DOMWindowCreated"),
|
||||
PR_TRUE /* bubbles */,
|
||||
|
@ -872,7 +872,7 @@ PluginInstanceChild::AnswerNPP_SetWindow(const NPRemoteWindow& aWindow)
|
||||
if (wndProc != PluginWindowProc) {
|
||||
mPluginWndProc = reinterpret_cast<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.
|
||||
SetWindowLongPtrA(mPluginWindowHWND, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG>(DefWindowProcA));
|
||||
reinterpret_cast<LONG_PTR>(DefWindowProcA));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -998,7 +998,7 @@ PluginInstanceChild::DestroyPluginWindow()
|
||||
if (wndProc == PluginWindowProc) {
|
||||
NS_ASSERTION(mPluginWndProc, "Should have old proc here!");
|
||||
SetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG>(mPluginWndProc));
|
||||
reinterpret_cast<LONG_PTR>(mPluginWndProc));
|
||||
mPluginWndProc = 0;
|
||||
}
|
||||
|
||||
@ -1013,7 +1013,7 @@ PluginInstanceChild::ReparentPluginWindow(HWND hWndParent)
|
||||
{
|
||||
if (hWndParent != mPluginParentHWND && IsWindow(hWndParent)) {
|
||||
// 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_POPUP;
|
||||
SetWindowLongPtr(mPluginWindowHWND, GWL_STYLE, style);
|
||||
@ -1531,7 +1531,7 @@ PluginInstanceChild::UnhookWinlessFlashThrottle()
|
||||
|
||||
// reset the subclass
|
||||
SetWindowLongPtr(mWinlessHiddenMsgHWND, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG>(tmpProc));
|
||||
reinterpret_cast<LONG_PTR>(tmpProc));
|
||||
|
||||
// Remove our instance prop
|
||||
RemoveProp(mWinlessHiddenMsgHWND, kPluginInstanceChildProperty);
|
||||
@ -1603,7 +1603,7 @@ PluginInstanceChild::EnumThreadWindowsCallback(HWND hWnd,
|
||||
self->mWinlessHiddenMsgHWND = hWnd;
|
||||
self->mWinlessThrottleOldWndProc =
|
||||
reinterpret_cast<WNDPROC>(SetWindowLongPtr(hWnd, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG>(WinlessHiddenFlashWndProc)));
|
||||
reinterpret_cast<LONG_PTR>(WinlessHiddenFlashWndProc)));
|
||||
SetProp(hWnd, kPluginInstanceChildProperty, self);
|
||||
NS_ASSERTION(self->mWinlessThrottleOldWndProc,
|
||||
"SetWindowLongPtr failed?!");
|
||||
|
@ -1150,7 +1150,7 @@ PluginInstanceParent::SubclassPluginWindow(HWND aWnd)
|
||||
mPluginHWND = aWnd;
|
||||
mPluginWndProc =
|
||||
(WNDPROC)::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG>(PluginWindowHookProc));
|
||||
reinterpret_cast<LONG_PTR>(PluginWindowHookProc));
|
||||
bool bRes = ::SetPropW(mPluginHWND, kPluginInstanceParentProperty, this);
|
||||
NS_ASSERTION(mPluginWndProc,
|
||||
"PluginInstanceParent::SubclassPluginWindow failed to set subclass!");
|
||||
@ -1164,7 +1164,7 @@ PluginInstanceParent::UnsubclassPluginWindow()
|
||||
{
|
||||
if (mPluginHWND && mPluginWndProc) {
|
||||
::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG>(mPluginWndProc));
|
||||
reinterpret_cast<LONG_PTR>(mPluginWndProc));
|
||||
|
||||
::RemovePropW(mPluginHWND, kPluginInstanceParentProperty);
|
||||
|
||||
|
@ -1275,7 +1275,7 @@ x86_64 | ia64)
|
||||
CPU_ARCH="$OS_TEST"
|
||||
;;
|
||||
|
||||
arm)
|
||||
arm*)
|
||||
CPU_ARCH=arm
|
||||
;;
|
||||
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;
|
||||
|
||||
template <typename Visitor>
|
||||
|
@ -3593,7 +3593,10 @@ xpc_EvalInSandbox(JSContext *cx, JSObject *sandbox, const nsAString& source,
|
||||
ssm->GetCxSubjectPrincipalAndFrame(cx, &fp);
|
||||
PRBool system;
|
||||
ssm->IsSystemPrincipal(subjectPrincipal, &system);
|
||||
NS_ASSERTION(!fp || system, "Bad caller!");
|
||||
if (fp && !system) {
|
||||
ssm->IsCapabilityEnabled("UniversalXPConnect", &system);
|
||||
NS_ASSERTION(system, "Bad caller!");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -2886,7 +2886,12 @@ CallMethodHelper::ConvertIndependentParams(JSBool* foundDependentParam)
|
||||
// is really an 'out' param masquerading as an 'in' param.
|
||||
NS_ASSERTION(i < mArgc || paramInfo.IsOptional(),
|
||||
"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;
|
||||
|
@ -75,7 +75,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
|
||||
mBuildCaret(aBuildCaret),
|
||||
mEventDelivery(aIsForEvents),
|
||||
mIsAtRootOfPseudoStackingContext(PR_FALSE),
|
||||
mPaintAllFrames(PR_FALSE),
|
||||
mSelectedFramesOnly(PR_FALSE),
|
||||
mAccurateVisibleRegions(PR_FALSE),
|
||||
mInTransform(PR_FALSE),
|
||||
mSyncDecodeImages(PR_FALSE),
|
||||
|
@ -235,11 +235,14 @@ public:
|
||||
*/
|
||||
nsIFrame* GetIgnoreScrollFrame() { return mIgnoreScrollFrame; }
|
||||
/**
|
||||
* Calling this setter makes us ignore all dirty rects and include all
|
||||
* descendant frames in the display list, wherever they may be positioned.
|
||||
* Calling this setter makes us:
|
||||
* 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; }
|
||||
PRBool GetPaintAllFrames() { return mPaintAllFrames; }
|
||||
void SetSelectedFramesOnly() { mSelectedFramesOnly = PR_TRUE; }
|
||||
PRBool GetSelectedFramesOnly() { return mSelectedFramesOnly; }
|
||||
/**
|
||||
* Calling this setter makes us compute accurate visible regions at the cost
|
||||
* of performance if regions get very complex.
|
||||
@ -426,7 +429,7 @@ private:
|
||||
PRPackedBool mEventDelivery;
|
||||
PRPackedBool mIsBackgroundOnly;
|
||||
PRPackedBool mIsAtRootOfPseudoStackingContext;
|
||||
PRPackedBool mPaintAllFrames;
|
||||
PRPackedBool mSelectedFramesOnly;
|
||||
PRPackedBool mAccurateVisibleRegions;
|
||||
// True when we're building a display list that's directly or indirectly
|
||||
// under an nsDisplayTransform
|
||||
|
@ -1023,7 +1023,8 @@ protected:
|
||||
// create a RangePaintInfo for the range aRange containing the
|
||||
// display list needed to paint the range to a surface
|
||||
RangePaintInfo* CreateRangePaintInfo(nsIDOMRange* aRange,
|
||||
nsRect& aSurfaceRect);
|
||||
nsRect& aSurfaceRect,
|
||||
PRBool aForPrimarySelection);
|
||||
|
||||
/*
|
||||
* Paint the items to a new surface and return it.
|
||||
@ -5458,7 +5459,8 @@ static PRBool gDumpRangePaintList = PR_FALSE;
|
||||
|
||||
RangePaintInfo*
|
||||
PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
||||
nsRect& aSurfaceRect)
|
||||
nsRect& aSurfaceRect,
|
||||
PRBool aForPrimarySelection)
|
||||
{
|
||||
NS_TIME_FUNCTION_WITH_DOCURL;
|
||||
|
||||
@ -5507,7 +5509,9 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
|
||||
nsRect ancestorRect = ancestorFrame->GetOverflowRect();
|
||||
|
||||
// get a display list containing the range
|
||||
info->mBuilder.SetPaintAllFrames();
|
||||
if (aForPrimarySelection) {
|
||||
info->mBuilder.SetSelectedFramesOnly();
|
||||
}
|
||||
info->mBuilder.EnterPresShell(ancestorFrame, ancestorRect);
|
||||
ancestorFrame->BuildDisplayListForStackingContext(&info->mBuilder,
|
||||
ancestorRect, &info->mList);
|
||||
@ -5685,7 +5689,7 @@ PresShell::RenderNode(nsIDOMNode* aNode,
|
||||
if (NS_FAILED(range->SelectNode(aNode)))
|
||||
return nsnull;
|
||||
|
||||
RangePaintInfo* info = CreateRangePaintInfo(range, area);
|
||||
RangePaintInfo* info = CreateRangePaintInfo(range, area, PR_FALSE);
|
||||
if (info && !rangeItems.AppendElement(info)) {
|
||||
delete info;
|
||||
return nsnull;
|
||||
@ -5733,7 +5737,7 @@ PresShell::RenderSelection(nsISelection* aSelection,
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
aSelection->GetRangeAt(r, getter_AddRefs(range));
|
||||
|
||||
RangePaintInfo* info = CreateRangePaintInfo(range, area);
|
||||
RangePaintInfo* info = CreateRangePaintInfo(range, area, PR_TRUE);
|
||||
if (info && !rangeItems.AppendElement(info)) {
|
||||
delete info;
|
||||
return nsnull;
|
||||
|
@ -1467,9 +1467,14 @@ nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
|
||||
dirty.Empty();
|
||||
}
|
||||
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();
|
||||
} else if (!(aChild->GetStateBits() & NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
|
||||
// No need to descend into aChild to catch placeholders for visible
|
||||
|
@ -3389,7 +3389,8 @@ nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
|
||||
nsAutoString data;
|
||||
if (mContent->Tag() == nsGkAtoms::object &&
|
||||
!mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::src) &&
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data)) {
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::data, data) &&
|
||||
!data.IsEmpty()) {
|
||||
mNumCachedAttrs++;
|
||||
}
|
||||
|
||||
|
@ -50,9 +50,10 @@ NS_IMPL_THREADSAFE_ISUPPORTS3(nsPNGEncoder, imgIEncoder, nsIInputStream, nsIAsyn
|
||||
|
||||
nsPNGEncoder::nsPNGEncoder() : mPNG(nsnull), mPNGinfo(nsnull),
|
||||
mIsAnimation(PR_FALSE),
|
||||
mFinished(PR_FALSE),
|
||||
mImageBuffer(nsnull), mImageBufferSize(0),
|
||||
mImageBufferUsed(0), mImageBufferReadPoint(0),
|
||||
mFinished(PR_FALSE), mCallback(nsnull),
|
||||
mCallback(nsnull),
|
||||
mCallbackTarget(nsnull), mNotifyThreshold(0),
|
||||
mMonitor("PNG Encoder Monitor")
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- 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
|
||||
*
|
||||
* 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 Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
@ -36,6 +35,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsITimer.h"
|
||||
#include "imgContainer.h"
|
||||
@ -43,8 +46,7 @@
|
||||
|
||||
static PRBool sInitialized = PR_FALSE;
|
||||
static PRBool sTimerOn = PR_FALSE;
|
||||
/* TODO - don't hardcode. See bug 478398. */
|
||||
static PRUint32 sMinDiscardTimeoutMs = 10000;
|
||||
static PRUint32 sMinDiscardTimeoutMs = 10000; /* Default if pref unreadable. */
|
||||
static nsITimer *sTimer = nsnull;
|
||||
static struct imgDiscardTrackerNode sHead, sSentinel, sTail;
|
||||
|
||||
@ -129,6 +131,9 @@ imgDiscardTracker::Initialize()
|
||||
sSentinel.prev = &sHead;
|
||||
sSentinel.next = &sTail;
|
||||
|
||||
// Load the timeout
|
||||
ReloadTimeout();
|
||||
|
||||
// Create and start the timer
|
||||
nsCOMPtr<nsITimer> t = do_CreateInstance("@mozilla.org/timer;1");
|
||||
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.
|
||||
*/
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* -*- 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
|
||||
*
|
||||
* 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 Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2001
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
@ -40,6 +38,8 @@
|
||||
#ifndef __imgDiscardTracker_h__
|
||||
#define __imgDiscardTracker_h__
|
||||
|
||||
#define DISCARD_TIMEOUT_PREF "image.mem.min_discard_timeout_ms"
|
||||
|
||||
class imgContainer;
|
||||
class nsITimer;
|
||||
|
||||
@ -73,6 +73,7 @@ class imgDiscardTracker
|
||||
static nsresult Reset(struct imgDiscardTrackerNode *node);
|
||||
static void Remove(struct imgDiscardTrackerNode *node);
|
||||
static void Shutdown();
|
||||
static void ReloadTimeout();
|
||||
private:
|
||||
static nsresult Initialize();
|
||||
static nsresult TimerOn();
|
||||
|
@ -78,6 +78,7 @@
|
||||
#include "nsIApplicationCacheContainer.h"
|
||||
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "nsIPrivateBrowsingService.h"
|
||||
|
||||
// we want to explore making the document own 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);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
imgLoader::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aData)
|
||||
{
|
||||
NS_ASSERTION(strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID) == 0,
|
||||
"invalid topic received");
|
||||
|
||||
if (strcmp(NS_ConvertUTF16toUTF8(aData).get(), "image.http.accept") == 0) {
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject);
|
||||
ReadAcceptHeaderPref(prefs);
|
||||
// We listen for pref change notifications...
|
||||
if (!strcmp(aTopic, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID)) {
|
||||
if (!strcmp(NS_ConvertUTF16toUTF8(aData).get(), "image.http.accept")) {
|
||||
nsCOMPtr<nsIPrefBranch> prefs = do_QueryInterface(aSubject);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,8 @@
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch2.h"
|
||||
|
||||
#include "imgDiscardTracker.h"
|
||||
|
||||
#define DISCARD_PREF "image.mem.discardable"
|
||||
#define DECODEONDRAW_PREF "image.mem.decodeondraw"
|
||||
|
||||
@ -103,6 +105,9 @@ ReloadPrefs(nsIPrefBranch *aBranch)
|
||||
rv = aBranch->GetBoolPref(DECODEONDRAW_PREF, &decodeondraw);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
gDecodeOnDraw = decodeondraw;
|
||||
|
||||
// Discard timeout
|
||||
imgDiscardTracker::ReloadTimeout();
|
||||
}
|
||||
|
||||
// Observer
|
||||
@ -124,7 +129,8 @@ imgRequestPrefObserver::Observe(nsISupports *aSubject,
|
||||
|
||||
// Right 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;
|
||||
|
||||
// Get the pref branch
|
||||
@ -224,6 +230,7 @@ nsresult imgRequest::Init(nsIURI *aURI,
|
||||
if (branch) {
|
||||
branch->AddObserver(DISCARD_PREF, observer, PR_FALSE);
|
||||
branch->AddObserver(DECODEONDRAW_PREF, observer, PR_FALSE);
|
||||
branch->AddObserver(DISCARD_TIMEOUT_PREF, observer, PR_FALSE);
|
||||
ReloadPrefs(branch);
|
||||
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
|
||||
// cache entry size. Otherwise, cancel the request, which adds an error
|
||||
// flag to mImageStatus.
|
||||
if (NS_SUCCEEDED(status)) {
|
||||
if (mImage && NS_SUCCEEDED(status)) {
|
||||
|
||||
// Flag that we loaded the image
|
||||
mImageStatus |= imgIRequest::STATUS_LOAD_COMPLETE;
|
||||
|
@ -69,6 +69,7 @@ _TEST_FILES = imgutils.js \
|
||||
test_bug497665.html \
|
||||
bug497665-iframe.html \
|
||||
bug497665.sjs \
|
||||
test_bug553982.html \
|
||||
$(NULL)
|
||||
|
||||
#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.
|
||||
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
|
||||
pref("webgl.enabled_for_all_sites", false);
|
||||
pref("webgl.software_render", false);
|
||||
|
@ -876,7 +876,6 @@ nsNPAPIPluginInstance::nsNPAPIPluginInstance(NPPluginFuncs* callbacks,
|
||||
mWantsAllNetworkStreams(PR_FALSE),
|
||||
mInPluginInitCall(PR_FALSE),
|
||||
mLibrary(aLibrary),
|
||||
mStreamListeners(nsnull),
|
||||
mMIMEType(nsnull),
|
||||
mOwner(nsnull),
|
||||
mCurrentPluginEvent(nsnull)
|
||||
@ -1093,9 +1092,6 @@ nsNPAPIPluginInstance::InitializePlugin()
|
||||
}
|
||||
}
|
||||
|
||||
// XXX Note that the NPPluginType_* enums were crafted to be
|
||||
// backward compatible...
|
||||
|
||||
PRInt32 mode;
|
||||
const char* mimetype;
|
||||
NPError error = NPERR_GENERIC_ERROR;
|
||||
|
@ -544,7 +544,7 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
|
||||
if (PluginWndProc == currentWndProc)
|
||||
return NS_OK;
|
||||
|
||||
LONG style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||
#ifdef MOZ_IPC
|
||||
// Out of process plugins must not have the WS_CLIPCHILDREN style set on their
|
||||
// parent windows or else synchronous paints (via UpdateWindow() and others)
|
||||
@ -588,7 +588,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
|
||||
if (currentWndProc == PluginWndProc)
|
||||
SubclassWindow(hWnd, (LONG_PTR)mPluginWinProc);
|
||||
|
||||
LONG style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||
LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
|
||||
style &= ~WS_CLIPCHILDREN;
|
||||
SetWindowLongPtr(hWnd, GWL_STYLE, style);
|
||||
}
|
||||
|
@ -179,11 +179,6 @@ HUD_SERVICE.prototype =
|
||||
*/
|
||||
filterPrefs: {},
|
||||
|
||||
/**
|
||||
* We keep track of all of the DOMMutation event listers in this object
|
||||
*/
|
||||
mutationEventFunctions: {},
|
||||
|
||||
/**
|
||||
* Event handler to get window errors
|
||||
* 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)
|
||||
{
|
||||
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");
|
||||
},
|
||||
|
||||
/**
|
||||
* 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
|
||||
* indexes
|
||||
@ -1568,10 +1482,6 @@ HUD_SERVICE.prototype =
|
||||
HUDService.registerHUDWeakReference(hudWeakRef, hudId);
|
||||
|
||||
aContentWindow.wrappedJSObject.console = _hud.console;
|
||||
var mutationFlag = this.getFilterState(this.hudId, "mutation");
|
||||
if (mutationFlag) {
|
||||
this.attachMutationListeners(aContentWindow, this.hudId);
|
||||
}
|
||||
}
|
||||
}
|
||||
// capture JS Errors
|
||||
@ -1714,11 +1624,7 @@ function HeadsUpDisplay(aConfig)
|
||||
let console = this.createConsole();
|
||||
|
||||
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
|
||||
try {
|
||||
this.createConsoleInput(this.contentWindow, this.consoleWrap, this.outputNode);
|
||||
@ -1948,8 +1854,7 @@ HeadsUpDisplay.prototype = {
|
||||
*/
|
||||
makeFilterToolbar: function HUD_makeFilterToolbar()
|
||||
{
|
||||
let buttons = ["Mutation", "Network", "CSSParser",
|
||||
"Exception", "Error",
|
||||
let buttons = ["Network", "CSSParser", "Exception", "Error",
|
||||
"Info", "Warn", "Log",];
|
||||
|
||||
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
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -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 PREFS_BRANCH_PREF = "devtools.hud.display.filter";
|
||||
const PREFS_PREFIX = "devtools.hud.display.filter.";
|
||||
const PREFS = { mutation: PREFS_PREFIX + "mutation",
|
||||
network: PREFS_PREFIX + "network",
|
||||
const PREFS = { network: PREFS_PREFIX + "network",
|
||||
cssparser: PREFS_PREFIX + "cssparser",
|
||||
exception: PREFS_PREFIX + "exception",
|
||||
error: PREFS_PREFIX + "error",
|
||||
@ -3012,7 +2779,6 @@ function ConsoleStorage()
|
||||
|
||||
if (filterPrefs) {
|
||||
defaultDisplayPrefs = {
|
||||
mutation: (prefs.getBoolPref(PREFS.mutation) ? true: false),
|
||||
network: (prefs.getBoolPref(PREFS.network) ? true: false),
|
||||
cssparser: (prefs.getBoolPref(PREFS.cssparser) ? true: false),
|
||||
exception: (prefs.getBoolPref(PREFS.exception) ? true: false),
|
||||
@ -3026,7 +2792,6 @@ function ConsoleStorage()
|
||||
else {
|
||||
prefs.setBoolPref(PREFS_BRANCH_PREF, false);
|
||||
// default prefs for each HeadsUpDisplay
|
||||
prefs.setBoolPref(PREFS.mutation, false);
|
||||
prefs.setBoolPref(PREFS.network, true);
|
||||
prefs.setBoolPref(PREFS.cssparser, true);
|
||||
prefs.setBoolPref(PREFS.exception, true);
|
||||
@ -3037,7 +2802,6 @@ function ConsoleStorage()
|
||||
prefs.setBoolPref(PREFS.global, false);
|
||||
|
||||
defaultDisplayPrefs = {
|
||||
mutation: prefs.getBoolPref(PREFS.mutation),
|
||||
network: prefs.getBoolPref(PREFS.network),
|
||||
cssparser: prefs.getBoolPref(PREFS.cssparser),
|
||||
exception: prefs.getBoolPref(PREFS.exception),
|
||||
@ -3055,7 +2819,6 @@ ConsoleStorage.prototype = {
|
||||
|
||||
updateDefaultDisplayPrefs:
|
||||
function CS_updateDefaultDisplayPrefs(aPrefsObject) {
|
||||
prefs.setBoolPref(PREFS.mutation, (aPrefsObject.mutation ? true : false));
|
||||
prefs.setBoolPref(PREFS.network, (aPrefsObject.network ? true : false));
|
||||
prefs.setBoolPref(PREFS.cssparser, (aPrefsObject.cssparser ? true : false));
|
||||
prefs.setBoolPref(PREFS.exception, (aPrefsObject.exception ? true : false));
|
||||
@ -3290,9 +3053,8 @@ HUDConsoleObserver = {
|
||||
Services.console.unregisterListener(this);
|
||||
}
|
||||
|
||||
if (aSubject instanceof Ci.nsIConsoleMessage) {
|
||||
var err = aSubject.QueryInterface(Ci.nsIScriptError);
|
||||
switch (err.category) {
|
||||
if (aSubject instanceof Ci.nsIScriptError) {
|
||||
switch (aSubject.category) {
|
||||
case "XPConnect JavaScript":
|
||||
case "component javascript":
|
||||
case "chrome javascript":
|
||||
@ -3302,7 +3064,7 @@ HUDConsoleObserver = {
|
||||
case "HUDConsole":
|
||||
case "CSS Parser":
|
||||
case "content javascript":
|
||||
HUDService.reportConsoleServiceContentScriptError(err);
|
||||
HUDService.reportConsoleServiceContentScriptError(aSubject);
|
||||
return;
|
||||
default:
|
||||
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_MUTATION_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-mutation.html";
|
||||
|
||||
function noCacheUriSpec(aUriSpec) {
|
||||
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() {
|
||||
ok(typeof cs.consoleDisplays == "object",
|
||||
"consoledisplays exist");
|
||||
@ -401,7 +379,6 @@ function test() {
|
||||
testConsoleLoggingAPI("exception");
|
||||
|
||||
testNet();
|
||||
// testDOMMutation();
|
||||
|
||||
// ConsoleStorageTests
|
||||
testCreateDisplay();
|
||||
|
@ -279,7 +279,11 @@ var popupTests = [
|
||||
},
|
||||
result: function(testname, step) {
|
||||
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) {
|
||||
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) {
|
||||
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[
|
||||
const SPACER = /^spacer\d+/;
|
||||
const SEPARATOR = /^separator\d+/;
|
||||
const SPLITTER = /^splitter\d+/;
|
||||
const SPRING = /^spring\d+/;
|
||||
|
||||
function testSet(aTb, aIDs, aResultIDs, aUseFixed) {
|
||||
@ -131,12 +130,11 @@
|
||||
[["spacer"], [SPACER]],
|
||||
[["spring"], [SPRING]],
|
||||
[["separator"], [SEPARATOR]],
|
||||
[["splitter"], [SPLITTER]],
|
||||
[["p11", "p11", "p12", "spacer", "p11"], ["p11", "p12", SPACER]],
|
||||
[["splitter", "separator", "p11", "spring", "spacer"],
|
||||
[SPLITTER, SEPARATOR, "p11", SPRING, SPACER]],
|
||||
[["splitter", "spacer", "splitter", "p11", "spring", "spacer", "p12", "spring"],
|
||||
[SPLITTER, SPACER, SPLITTER, "p11", SPRING, SPACER, "p12", SPRING]],
|
||||
[["separator", "separator", "p11", "spring", "spacer"],
|
||||
[SEPARATOR, SEPARATOR, "p11", SPRING, SPACER]],
|
||||
[["separator", "spacer", "separator", "p11", "spring", "spacer", "p12", "spring"],
|
||||
[SEPARATOR, SPACER, SEPARATOR, "p11", SPRING, SPACER, "p12", SPRING]],
|
||||
emptySet
|
||||
];
|
||||
|
||||
|
@ -146,8 +146,6 @@
|
||||
return "spring";
|
||||
case "toolbarspacer":
|
||||
return "spacer";
|
||||
case "splitter":
|
||||
return "splitter";
|
||||
default:
|
||||
return aNode.id;
|
||||
}
|
||||
@ -260,11 +258,6 @@
|
||||
if (aId == "spring")
|
||||
newItem.flex = 1;
|
||||
break;
|
||||
case "splitter":
|
||||
newItem = document.createElementNS(XUL_NS, "splitter");
|
||||
newItem.id = aId + Date.now() + this.childNodes.length;
|
||||
newItem.className = "toolbar-splitter";
|
||||
break;
|
||||
default:
|
||||
var toolbox = this.toolbox;
|
||||
if (!toolbox)
|
||||
|
@ -71,6 +71,13 @@ HOST_CPPSRCS += \
|
||||
stabs_to_module.cc \
|
||||
$(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.
|
||||
ifeq (Linux,$(OS_ARCH))
|
||||
HOST_CXXFLAGS += -DHAVE_A_OUT_H
|
||||
@ -81,13 +88,6 @@ endif
|
||||
|
||||
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
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
|
@ -47,10 +47,11 @@ Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var EXPORTED_SYMBOLS = [ "AddonManager", "AddonManagerPrivate" ];
|
||||
|
||||
const CATEGORY_PROVIDER_MODULE = "addon-provider-module";
|
||||
|
||||
// A list of providers to load by default
|
||||
const PROVIDERS = [
|
||||
const DEFAULT_PROVIDERS = [
|
||||
"resource://gre/modules/XPIProvider.jsm",
|
||||
"resource://gre/modules/PluginProvider.jsm",
|
||||
"resource://gre/modules/LightweightThemeManager.jsm"
|
||||
];
|
||||
|
||||
@ -191,15 +192,32 @@ var AddonManagerInternal = {
|
||||
}
|
||||
|
||||
// Ensure all default providers have had a chance to register themselves
|
||||
PROVIDERS.forEach(function(url) {
|
||||
DEFAULT_PROVIDERS.forEach(function(url) {
|
||||
try {
|
||||
Components.utils.import(url, {});
|
||||
}
|
||||
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;
|
||||
this.providers.forEach(function(provider) {
|
||||
callProvider(provider, "startup");
|
||||
|
@ -43,6 +43,7 @@ include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = extensions
|
||||
LIBRARY_NAME = extensions
|
||||
SHORT_LIBNAME = extnsion
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = AddonsModule
|
||||
GRE_MODULE = 1
|
||||
@ -71,11 +72,15 @@ EXTRA_PP_JS_MODULES = \
|
||||
AddonManager.jsm \
|
||||
AddonRepository.jsm \
|
||||
XPIProvider.jsm \
|
||||
PluginProvider.jsm \
|
||||
AddonUpdateChecker.jsm \
|
||||
AddonLogging.jsm \
|
||||
$(NULL)
|
||||
|
||||
ifdef MOZ_PLUGINS
|
||||
EXTRA_PP_JS_MODULES += PluginProvider.jsm
|
||||
DEFINES += -DMOZ_PLUGINS
|
||||
endif
|
||||
|
||||
EXTRA_JS_MODULES = \
|
||||
LightweightThemeManager.jsm \
|
||||
$(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}
|
||||
component {0f38e086-89a3-40a5-8ffc-9b694de1d04a} amWebInstallListener.js
|
||||
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