import changes from `dev' branch of rmottola/Arctic-Fox:

- Bug 586587 - support kHTMLMime in the Windows clipboard as CF_HTML. r=jimm (6af5a0d7fa)
- Bug 1159604: Use a fallible allocation in nsClipboard::GetGlobalData. r=bbondy (c9645301a4)
- Bug 1048624 - Cleanup and refactor the media crashtest manifests and re-enable some disabled tests that now pass. (d712e08056)
- crashtest for bug 1020370 r=padenot (c0900de1df)
- crashtest for bug 1206362 r=padenot (07ace6a42f)
- Bug 1207546 - Integrate WebRTC with audio channels, r=roc (0ecafba529)
- Bug 1219478: Replace PRLogModuleInfo usage with LazyLogModule in dom folders except media.r=amerchesini (2e67bd7308)
- Bug 1198422 - CSP: Allow nonce to load if default-src is not specified in second policy (r=dveditz) (8a8bca1eb3)
- Bug 1187152 (part 1) - Replace nsBaseHashtable::Enumerate() calls in modules/ with iterators. r=mwu. (85cea6dce7)
- Bug 1187152 (part 2) - Replace nsBaseHashtable::Enumerate() calls in modules/ with iterators. r=froydnj. (e909442934)
- Bug 1187152 (part 3) - Replace nsBaseHashtable::Enumerate() calls in modules/ with iterators. r=froydnj. (48c78d75e6)
This commit is contained in:
2023-03-23 10:03:31 +08:00
parent 7bf7c35e9f
commit 21cd830e68
70 changed files with 502 additions and 377 deletions
+1 -4
View File
@@ -23,7 +23,7 @@ NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil)
//
// NSPR_LOG_MODULES=thirdPartyUtil:5
//
static PRLogModuleInfo *gThirdPartyLog;
static mozilla::LazyLogModule gThirdPartyLog("thirdPartyUtil");
#undef LOG
#define LOG(args) MOZ_LOG(gThirdPartyLog, mozilla::LogLevel::Debug, args)
@@ -35,9 +35,6 @@ ThirdPartyUtil::Init()
nsresult rv;
mTLDService = do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID, &rv);
if (!gThirdPartyLog)
gThirdPartyLog = PR_NewLogModule("thirdPartyUtil");
return rv;
}
+1 -4
View File
@@ -30,7 +30,7 @@ using mozilla::LogLevel;
NS_IMPL_ISUPPORTS(nsContentPolicy, nsIContentPolicy)
static PRLogModuleInfo* gConPolLog;
static mozilla::LazyLogModule gConPolLog("nsContentPolicy");
nsresult
NS_NewContentPolicy(nsIContentPolicy **aResult)
@@ -46,9 +46,6 @@ nsContentPolicy::nsContentPolicy()
: mPolicies(NS_CONTENTPOLICY_CATEGORY)
, mSimplePolicies(NS_SIMPLECONTENTPOLICY_CATEGORY)
{
if (! gConPolLog) {
gConPolLog = PR_NewLogModule("nsContentPolicy");
}
}
nsContentPolicy::~nsContentPolicy()
+25 -24
View File
@@ -51,19 +51,16 @@
#include "nsParserConstants.h"
#include "nsSandboxFlags.h"
static PRLogModuleInfo*
using namespace mozilla;
static LogModule*
GetSriLog()
{
static PRLogModuleInfo *gSriPRLog;
if (!gSriPRLog) {
gSriPRLog = PR_NewLogModule("SRI");
}
static LazyLogModule gSriPRLog("SRI");
return gSriPRLog;
}
using namespace mozilla;
PRLogModuleInfo* gContentSinkLogModuleInfo;
LazyLogModule gContentSinkLogModuleInfo("nscontentsink");
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsContentSink)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsContentSink)
@@ -110,12 +107,6 @@ nsContentSink::nsContentSink()
NS_ASSERTION(mInMonolithicContainer == 0, "What?");
NS_ASSERTION(mInNotification == 0, "What?");
NS_ASSERTION(!mDeferredLayoutStart, "What?");
#ifdef DEBUG
if (!gContentSinkLogModuleInfo) {
gContentSinkLogModuleInfo = PR_NewLogModule("nscontentsink");
}
#endif
}
nsContentSink::~nsContentSink()
@@ -968,8 +959,10 @@ nsContentSink::SelectDocAppCache(nsIApplicationCache *aLoadApplicationCache,
nsAutoCString docURISpec, clientID;
mDocumentURI->GetAsciiSpec(docURISpec);
aLoadApplicationCache->GetClientID(clientID);
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_CALLS,
("Selection: assigning app cache %s to document %s", clientID.get(), docURISpec.get()));
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_CALLS,
("Selection: assigning app cache %s to document %s",
clientID.get(), docURISpec.get()));
#endif
rv = applicationCacheDocument->SetApplicationCache(aLoadApplicationCache);
@@ -1022,8 +1015,10 @@ nsContentSink::SelectDocAppCacheNoManifest(nsIApplicationCache *aLoadApplication
nsAutoCString docURISpec, clientID;
mDocumentURI->GetAsciiSpec(docURISpec);
aLoadApplicationCache->GetClientID(clientID);
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_CALLS,
("Selection, no manifest: assigning app cache %s to document %s", clientID.get(), docURISpec.get()));
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_CALLS,
("Selection, no manifest: assigning app cache %s to document %s",
clientID.get(), docURISpec.get()));
#endif
rv = applicationCacheDocument->SetApplicationCache(aLoadApplicationCache);
@@ -1337,7 +1332,8 @@ nsContentSink::WillInterruptImpl()
{
nsresult result = NS_OK;
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_CALLS,
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_CALLS,
("nsContentSink::WillInterrupt: this=%p", this));
#ifndef SINK_NO_INCREMENTAL
if (WaitForPendingSheets()) {
@@ -1351,7 +1347,8 @@ nsContentSink::WillInterruptImpl()
// If it's already time for us to have a notification
if (diff > interval || mDroppedTimer) {
mBackoffCount--;
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_REFLOW,
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_REFLOW,
("nsContentSink::WillInterrupt: flushing tags since we've "
"run out time; backoff count: %d", mBackoffCount));
result = FlushTags();
@@ -1369,7 +1366,8 @@ nsContentSink::WillInterruptImpl()
mNotificationTimer = do_CreateInstance("@mozilla.org/timer;1",
&result);
if (NS_SUCCEEDED(result)) {
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_REFLOW,
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_REFLOW,
("nsContentSink::WillInterrupt: setting up timer with "
"delay %d", delay));
@@ -1383,7 +1381,8 @@ nsContentSink::WillInterruptImpl()
}
}
} else {
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_REFLOW,
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_REFLOW,
("nsContentSink::WillInterrupt: flushing tags "
"unconditionally"));
result = FlushTags();
@@ -1398,7 +1397,8 @@ nsContentSink::WillInterruptImpl()
nsresult
nsContentSink::WillResumeImpl()
{
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_CALLS,
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_CALLS,
("nsContentSink::WillResume: this=%p", this));
mParsing = true;
@@ -1518,7 +1518,8 @@ nsContentSink::DidBuildModelImpl(bool aTerminated)
// Cancel a timer if we had one out there
if (mNotificationTimer) {
SINK_TRACE(gContentSinkLogModuleInfo, SINK_TRACE_REFLOW,
SINK_TRACE(static_cast<LogModule*>(gContentSinkLogModuleInfo),
SINK_TRACE_REFLOW,
("nsContentSink::DidBuildModel: canceling notification "
"timeout"));
mNotificationTimer->Cancel();
+2 -2
View File
@@ -47,13 +47,13 @@ class Loader;
#ifdef DEBUG
extern PRLogModuleInfo* gContentSinkLogModuleInfo;
extern mozilla::LazyLogModule gContentSinkLogModuleInfo;
#define SINK_TRACE_CALLS 0x1
#define SINK_TRACE_REFLOW 0x2
#define SINK_ALWAYS_REFLOW 0x4
#define SINK_LOG_TEST(_lm, _bit) (int((_lm)->level) & (_bit))
#define SINK_LOG_TEST(_lm, _bit) (int((_lm)->Level()) & (_bit))
#define SINK_TRACE(_lm, _bit, _args) \
PR_BEGIN_MACRO \
+2 -8
View File
@@ -256,8 +256,8 @@ using namespace mozilla::dom;
typedef nsTArray<Link*> LinkArray;
static PRLogModuleInfo* gDocumentLeakPRLog;
static PRLogModuleInfo* gCspPRLog;
static LazyLogModule gDocumentLeakPRLog("DocumentLeak");
static LazyLogModule gCspPRLog("CSP");
#define NAME_NOT_VALID ((nsSimpleContentList*)1)
@@ -1470,16 +1470,10 @@ nsDocument::nsDocument(const char* aContentType)
{
SetContentTypeInternal(nsDependentCString(aContentType));
if (!gDocumentLeakPRLog)
gDocumentLeakPRLog = PR_NewLogModule("DocumentLeak");
if (gDocumentLeakPRLog)
MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug,
("DOCUMENT %p created", this));
if (!gCspPRLog)
gCspPRLog = PR_NewLogModule("CSP");
// Start out mLastStyleSheetSet as null, per spec
SetDOMStringToNull(mLastStyleSheetSet);
+2 -5
View File
@@ -77,8 +77,8 @@ using namespace mozilla::widget;
// Two types of focus pr logging are available:
// 'Focus' for normal focus manager calls
// 'FocusNavigation' for tab and document navigation
PRLogModuleInfo* gFocusLog;
PRLogModuleInfo* gFocusNavigationLog;
LazyLogModule gFocusLog("Focus");
LazyLogModule gFocusNavigationLog("FocusNavigation");
#define LOGFOCUS(args) MOZ_LOG(gFocusLog, mozilla::LogLevel::Debug, args)
#define LOGFOCUSNAVIGATION(args) MOZ_LOG(gFocusNavigationLog, mozilla::LogLevel::Debug, args)
@@ -194,9 +194,6 @@ nsFocusManager::Init()
NS_ADDREF(fm);
sInstance = fm;
gFocusLog = PR_NewLogModule("Focus");
gFocusNavigationLog = PR_NewLogModule("FocusNavigation");
nsIContent::sTabFocusModelAppliesToXUL =
Preferences::GetBool("accessibility.tabfocus_applies_to_xul",
nsIContent::sTabFocusModelAppliesToXUL);
+2 -3
View File
@@ -250,8 +250,6 @@ class nsIScriptTimeoutHandler;
#include <android/log.h>
#endif
static PRLogModuleInfo* gDOMLeakPRLog;
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
@@ -271,6 +269,8 @@ using mozilla::TimeDuration;
using mozilla::dom::cache::CacheStorage;
using mozilla::dom::indexedDB::IDBFactory;
static LazyLogModule gDOMLeakPRLog("DOMLeak");
nsGlobalWindow::WindowByIdTable *nsGlobalWindow::sWindowsById = nullptr;
bool nsGlobalWindow::sWarnedAboutWindowInternal = false;
bool nsGlobalWindow::sIdleObserversAPIFuzzTimeDisabled = false;
@@ -1282,7 +1282,6 @@ nsGlobalWindow::Init()
NS_ASSERTION(gEntropyCollector,
"gEntropyCollector should have been initialized!");
gDOMLeakPRLog = PR_NewLogModule("DOMLeak");
NS_ASSERTION(gDOMLeakPRLog, "gDOMLeakPRLog should have been initialized!");
sWindowsById = new WindowByIdTable();
+1 -4
View File
@@ -36,7 +36,7 @@ using mozilla::dom::NodeInfo;
#include "mozilla/Logging.h"
static PRLogModuleInfo* gNodeInfoManagerLeakPRLog;
static LazyLogModule gNodeInfoManagerLeakPRLog("NodeInfoManagerLeak");
PLHashNumber
nsNodeInfoManager::GetNodeInfoInnerHashValue(const void *key)
@@ -115,9 +115,6 @@ nsNodeInfoManager::nsNodeInfoManager()
{
nsLayoutStatics::AddRef();
if (!gNodeInfoManagerLeakPRLog)
gNodeInfoManagerLeakPRLog = PR_NewLogModule("NodeInfoManagerLeak");
if (gNodeInfoManagerLeakPRLog)
MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug,
("NODEINFOMANAGER %p created", this));
+2 -4
View File
@@ -109,12 +109,10 @@ static const char *kPrefYoutubeRewrite = "plugins.rewrite_youtube_embeds";
using namespace mozilla;
using namespace mozilla::dom;
static PRLogModuleInfo*
static LogModule*
GetObjectLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("objlc");
static LazyLogModule sLog("objlc");
return sLog;
}
+9 -15
View File
@@ -57,21 +57,18 @@
#include "mozilla/dom/SRICheck.h"
#include "nsIScriptError.h"
static PRLogModuleInfo* gCspPRLog;
static PRLogModuleInfo*
GetSriLog()
{
static PRLogModuleInfo *gSriPRLog;
if (!gSriPRLog) {
gSriPRLog = PR_NewLogModule("SRI");
}
return gSriPRLog;
}
using namespace mozilla;
using namespace mozilla::dom;
static LazyLogModule gCspPRLog("CSP");
static LogModule*
GetSriLog()
{
static LazyLogModule gSriPRLog("SRI");
return gSriPRLog;
}
// The nsScriptLoadRequest is passed as the context to necko, and thus
// it needs to be threadsafe. Necko won't do anything with this
// context, but it will AddRef and Release it on other threads.
@@ -120,9 +117,6 @@ nsScriptLoader::nsScriptLoader(nsIDocument *aDocument)
mDocumentParsingDone(false),
mBlockingDOMContentLoaded(false)
{
// enable logging for CSP
if (!gCspPRLog)
gCspPRLog = PR_NewLogModule("CSP");
}
nsScriptLoader::~nsScriptLoader()
+7 -10
View File
@@ -31,19 +31,16 @@
#include "nsStyleUtil.h"
#include "nsQueryObject.h"
static PRLogModuleInfo*
GetSriLog()
{
static PRLogModuleInfo *gSriPRLog;
if (!gSriPRLog) {
gSriPRLog = PR_NewLogModule("SRI");
}
return gSriPRLog;
}
using namespace mozilla;
using namespace mozilla::dom;
static LogModule*
GetSriLog()
{
static LazyLogModule gSriPRLog("SRI");
return gSriPRLog;
}
nsStyleLinkElement::nsStyleLinkElement()
: mDontLoadStyle(false)
, mUpdatesEnabled(true)
+25 -14
View File
@@ -92,6 +92,17 @@ function testCopyPaste (isXHTML) {
transferable.getTransferData(mime, data, {}) ;
return data;
}
function testHtmlClipboardValue(mime, expected) {
// For Windows, navigator.platform returns "Win32".
var expectedValue = expected;
if (navigator.platform.indexOf("Win") >= 0) {
// Windows has extra content.
var expectedValue = "<html><body>\n<!--StartFragment-->" +
expected.replace(/\n/g, '\n') +
"<!--EndFragment-->\n</body>\n</html>";
}
testClipboardValue(mime, expectedValue);
}
function testClipboardValue(mime, expected) {
if (suppressHTMLCheck && mime == "text/html")
return null;
@@ -133,37 +144,37 @@ function testCopyPaste (isXHTML) {
testSelectionToString("This is a draggable bit of text.");
testClipboardValue("text/unicode",
"This is a draggable bit of text.");
testClipboardValue("text/html",
testHtmlClipboardValue("text/html",
"<div id=\"draggable\" title=\"title to have a long HTML line\">This is a <em>draggable</em> bit of text.</div>");
testPasteText("This is a draggable bit of text.");
copyChildrenToClipboard("alist");
testSelectionToString(" bla\n\n foo\n bar\n\n");
testClipboardValue("text/unicode", " bla\n\n foo\n bar\n\n");
testClipboardValue("text/html", "<div id=\"alist\">\n bla\n <ul>\n <li>foo</li>\n \n <li>bar</li>\n </ul>\n </div>");
testHtmlClipboardValue("text/html", "<div id=\"alist\">\n bla\n <ul>\n <li>foo</li>\n \n <li>bar</li>\n </ul>\n </div>");
testPasteText(" bla\n\n foo\n bar\n\n");
copyChildrenToClipboard("blist");
testSelectionToString(" mozilla\n\n foo\n bar\n\n");
testClipboardValue("text/unicode", " mozilla\n\n foo\n bar\n\n");
testClipboardValue("text/html", "<div id=\"blist\">\n mozilla\n <ol>\n <li>foo</li>\n \n <li>bar</li>\n </ol>\n </div>");
testHtmlClipboardValue("text/html", "<div id=\"blist\">\n mozilla\n <ol>\n <li>foo</li>\n \n <li>bar</li>\n </ol>\n </div>");
testPasteText(" mozilla\n\n foo\n bar\n\n");
copyChildrenToClipboard("clist");
testSelectionToString(" mzla\n\n foo\n bazzinga!\n bar\n\n");
testClipboardValue("text/unicode", " mzla\n\n foo\n bazzinga!\n bar\n\n");
testClipboardValue("text/html", "<div id=\"clist\">\n mzla\n <ul>\n <li>foo<ul>\n <li>bazzinga!</li>\n </ul></li>\n \n <li>bar</li>\n </ul>\n </div>");
testHtmlClipboardValue("text/html", "<div id=\"clist\">\n mzla\n <ul>\n <li>foo<ul>\n <li>bazzinga!</li>\n </ul></li>\n \n <li>bar</li>\n </ul>\n </div>");
testPasteText(" mzla\n\n foo\n bazzinga!\n bar\n\n");
copyChildrenToClipboard("div4");
testSelectionToString(" Tt t t ");
testClipboardValue("text/unicode", " Tt t t ");
if (isXHTML) {
testClipboardValue("text/html", "<div id=\"div4\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\">t t t</textarea>\n</div>");
testHtmlClipboardValue("text/html", "<div id=\"div4\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\">t t t</textarea>\n</div>");
testInnerHTML("div4", "\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\">t t t</textarea>\n");
}
else {
testClipboardValue("text/html", "<div id=\"div4\">\n T<textarea>t t t</textarea>\n</div>");
testHtmlClipboardValue("text/html", "<div id=\"div4\">\n T<textarea>t t t</textarea>\n</div>");
testInnerHTML("div4", "\n T<textarea>t t t</textarea>\n");
}
testPasteText(" Tt t t ");
@@ -172,11 +183,11 @@ function testCopyPaste (isXHTML) {
testSelectionToString(" T ");
testClipboardValue("text/unicode", " T ");
if (isXHTML) {
testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n</div>");
testHtmlClipboardValue("text/html", "<div id=\"div5\">\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n</div>");
testInnerHTML("div5", "\n T<textarea xmlns=\"http://www.w3.org/1999/xhtml\"> </textarea>\n");
}
else {
testClipboardValue("text/html", "<div id=\"div5\">\n T<textarea> </textarea>\n</div>");
testHtmlClipboardValue("text/html", "<div id=\"div5\">\n T<textarea> </textarea>\n</div>");
testInnerHTML("div5", "\n T<textarea> </textarea>\n");
}
testPasteText(" T ");
@@ -214,7 +225,7 @@ if (false) {
copyRangeToClipboard($("div9").childNodes[0],0, $("div9").childNodes[0],4,suppressUnicodeCheckIfHidden);
testSelectionToString("div9");
testClipboardValue("text/unicode", "div9");
testClipboardValue("text/html", "div9");
testHtmlClipboardValue("text/html", "div9");
testInnerHTML("div9", "div9");
copyToClipboard($("div10"), suppressUnicodeCheckIfHidden);
@@ -357,7 +368,7 @@ if (false) {
copyChildrenToClipboard("div13");
testSelectionToString("__");
testClipboardValue("text/unicode", "__");
testClipboardValue("text/html", "<div id=\"div13\">__</div>");
testHtmlClipboardValue("text/html", "<div id=\"div13\">__</div>");
testPasteText("__");
// ============ converting cell boundaries to tabs in tables
@@ -370,7 +381,7 @@ if (false) {
copyRangeToClipboard($("tr2"),0,$("tr3"),0);
testClipboardValue("text/unicode", "1\t2\n3\t4\n");
testClipboardValue("text/html", '<table><tbody><tr id="tr2"><tr id="tr2"><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr><tr id="tr3"></tr></tr></tbody></table>');
testHtmlClipboardValue("text/html", '<table><tbody><tr id="tr2"><tr id="tr2"><td>1</td><td>2</td></tr><tr><td>3</td><td>4</td></tr><tr id="tr3"></tr></tr></tbody></table>');
// ============ spanning multiple rows in multi-range selection
@@ -379,20 +390,20 @@ if (false) {
addRange($("tr3"),0,$("tr3"),2);
copySelectionToClipboard();
testClipboardValue("text/unicode", "1\t2\n5\t6");
testClipboardValue("text/html", '<table><tbody><tr id="tr2"><td>1</td><td>2</td></tr><tr id="tr3"><td>5</td><td>6</td></tr></tbody></table>');
testHtmlClipboardValue("text/html", '<table><tbody><tr id="tr2"><td>1</td><td>2</td></tr><tr id="tr3"><td>5</td><td>6</td></tr></tbody></table>');
}
// ============ manipulating Selection in oncopy
copyRangeToClipboard($("div11").childNodes[0],0, $("div11").childNodes[1],2);
testClipboardValue("text/unicode", "Xdiv11");
testClipboardValue("text/html", "<div><p>X<span>div</span>11</p></div>");
testHtmlClipboardValue("text/html", "<div><p>X<span>div</span>11</p></div>");
setTimeout(function(){testSelectionToString("div11")},0);
setTimeout(function(){
copyRangeToClipboard($("div12").childNodes[0],0, $("div12").childNodes[1],2);
testClipboardValue("text/unicode", "Xdiv12");
testClipboardValue("text/html", "<div><p>X<span>div</span>12</p></div>");
testHtmlClipboardValue("text/html", "<div><p>X<span>div</span>12</p></div>");
setTimeout(function(){
testSelectionToString("div12");
setTimeout(SimpleTest.finish,0);
+2
View File
@@ -270,6 +270,8 @@ support-files =
[test_audioWindowUtils.html]
[test_audioNotification.html]
skip-if = buildapp == 'mulet'
[test_audioNotificationStream.html]
skip-if = buildapp == 'mulet'
[test_audioNotificationStopOnNavigation.html]
skip-if = buildapp == 'mulet'
[test_audioNotificationWithEarlyPlay.html]
@@ -0,0 +1,71 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Test for audio controller in windows</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<pre id="test">
</pre>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var expectedNotification = null;
var observer = {
observe: function(subject, topic, data) {
is(topic, "audio-playback", "audio-playback received");
is(data, expectedNotification, "This is the right notification");
runTest();
}
};
var observerService = SpecialPowers.Cc["@mozilla.org/observer-service;1"]
.getService(SpecialPowers.Ci.nsIObserverService);
var audio = new Audio();
audio.srcObject = (new AudioContext()).createMediaStreamDestination().stream;
var tests = [
function() {
observerService.addObserver(observer, "audio-playback", false);
ok(true, "Observer set");
runTest();
},
function() {
expectedNotification = 'active';
audio.play();
},
function() {
expectedNotification = 'inactive';
audio.pause();
},
function() {
observerService.removeObserver(observer, "audio-playback");
ok(true, "Observer removed");
runTest();
}
];
function runTest() {
if (!tests.length) {
SimpleTest.finish();
return;
}
var test = tests.shift();
test();
}
runTest();
</script>
</body>
</html>
+9 -1
View File
@@ -67,6 +67,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=816298
transferable.getTransferData(mime, data, {}) ;
return SpecialPowers.wrap(data);
}
function testHtmlClipboardValue(mime, expected, test) {
var expectedValue = expected;
// For Windows, navigator.platform returns "Win32".
if (navigator.platform.indexOf("Win") >= 0) {
expectedValue = "<html><body>\n<!--StartFragment-->" + expected + "<!--EndFragment-->\n</body>\n</html>";
}
testClipboardValue(mime, expectedValue, test);
}
function testClipboardValue(mime, expected, test) {
var data = getClipboardData(mime);
is (data.value == null ? data.value :
@@ -140,7 +148,7 @@ for (var i = 0; i < originalStrings.length; i++) {
var id = 'test' + i;
copyChildrenToClipboard(id);
is(window.getSelection().toString(), originalStrings[i], id + ' Selection.toString()');
testClipboardValue("text/html", clipboardHTML[i], id);
testHtmlClipboardValue("text/html", clipboardHTML[i], id);
testClipboardValue("text/unicode", clipboardUnicode[i], id);
testInnerHTML(id, innerHTMLStrings[i]);
testPasteText(textareaStrings[i], id + '.innerHTML');
+5 -1
View File
@@ -71,7 +71,11 @@ function testCopyImage () {
// Is the text/uncodie data correct ?
testClipboardValue('text/unicode', 'about:logo');
// Is the text/html data correct ?
testClipboardValue('text/html', '<img id="logo" src="about:logo">');
var expected = '<img id="logo" src="about:logo">';
if (navigator.platform.indexOf("Win") >= 0) {
expected = "<html><body>\n<!--StartFragment-->" + expected + "<!--EndFragment-->\n</body>\n</html>";
}
testClipboardValue('text/html', expected);
SimpleTest.finish();
}
+1 -1
View File
@@ -9,7 +9,7 @@
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetCameraLog();
extern mozilla::LogModule* GetCameraLog();
#define DOM_CAMERA_LOG( type, ... ) MOZ_LOG(GetCameraLog(), (mozilla::LogLevel)type, ( __VA_ARGS__ ))
#define DOM_CAMERA_LOGA( ... ) DOM_CAMERA_LOG( mozilla::LogLevel::Error, __VA_ARGS__ )
+2 -5
View File
@@ -42,13 +42,10 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMCameraManager)
* Set the NSPR_LOG_MODULES environment variable to enable logging
* in a debug build, e.g. NSPR_LOG_MODULES=Camera:5
*/
PRLogModuleInfo*
LogModule*
GetCameraLog()
{
static PRLogModuleInfo *sLog;
if (!sLog) {
sLog = PR_NewLogModule("Camera");
}
static LazyLogModule sLog("Camera");
return sLog;
}
+1 -1
View File
@@ -1,5 +1,5 @@
# WebGL Reftests!
default-preferences pref(webgl.force-enabled,true)
default-preferences pref(webgl.force-enabled,true) pref(media.useAudioChannelAPI,true) pref(dom.audiochannel.mutedByDefault,false)
# Check that disabling works:
== webgl-disable-test.html?nogl wrapper.html?green.png
+8 -1
View File
@@ -1381,7 +1381,14 @@ DataTransfer::FillInExternalData(TransferItem& aItem, uint32_t aIndex)
variant->SetAsAString(str);
}
else {
variant->SetAsISupports(data);
nsCOMPtr<nsISupportsCString> supportscstr = do_QueryInterface(data);
if (supportscstr) {
nsAutoCString str;
supportscstr->GetData(str);
variant->SetAsACString(str);
} else {
variant->SetAsISupports(data);
}
}
aItem.mData = variant;
+1 -4
View File
@@ -40,7 +40,7 @@ namespace mozilla {
using namespace widget;
PRLogModuleInfo* sIMECOLog = nullptr;
LazyLogModule sIMECOLog("IMEContentObserver");
static const char*
ToChar(bool aBool)
@@ -208,9 +208,6 @@ IMEContentObserver::IMEContentObserver()
#ifdef DEBUG
mTextChangeData.Test();
#endif
if (!sIMECOLog) {
sIMECOLog = PR_NewLogModule("IMEContentObserver");
}
}
void
+1 -5
View File
@@ -57,7 +57,7 @@ using namespace widget;
* for debug, log the information with LogLevel::Debug. In this case, the log
* should start with "ISM: <method name>(),".
*/
PRLogModuleInfo* sISMLog = nullptr;
LazyLogModule sISMLog("IMEStateManager");
static const char*
GetBoolName(bool aBool)
@@ -175,10 +175,6 @@ bool IMEStateManager::sRemoteHasFocus = false;
void
IMEStateManager::Init()
{
if (!sISMLog) {
sISMLog = PR_NewLogModule("IMEStateManager");
}
Preferences::AddBoolVarCache(
&sCheckForIMEUnawareWebApps,
"intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition",
+8 -8
View File
@@ -90,8 +90,9 @@
#include <algorithm>
#include <cmath>
static PRLogModuleInfo* gMediaElementLog;
static PRLogModuleInfo* gMediaElementEventsLog;
static mozilla::LazyLogModule gMediaElementLog("nsMediaElement");
static mozilla::LazyLogModule gMediaElementEventsLog("nsMediaElementEvents");
#define LOG(type, msg) MOZ_LOG(gMediaElementLog, type, msg)
#define LOG_EVENT(type, msg) MOZ_LOG(gMediaElementEventsLog, type, msg)
@@ -2073,12 +2074,6 @@ HTMLMediaElement::HTMLMediaElement(already_AddRefed<mozilla::dom::NodeInfo>& aNo
mFirstFrameLoaded(false),
mDefaultPlaybackStartPosition(0.0)
{
if (!gMediaElementLog) {
gMediaElementLog = PR_NewLogModule("nsMediaElement");
}
if (!gMediaElementEventsLog) {
gMediaElementEventsLog = PR_NewLogModule("nsMediaElementEvents");
}
ErrorResult rv;
double defaultVolume = Preferences::GetFloat("media.default_volume", 1.0);
@@ -4729,6 +4724,11 @@ HTMLMediaElement::IsPlayingThroughTheAudioChannel() const
return true;
}
// If we are playing an external stream.
if (mSrcAttrStream) {
return true;
}
return false;
}
+1 -4
View File
@@ -40,7 +40,7 @@
#include "nsThreadUtils.h"
#include "nsVideoFrame.h"
static PRLogModuleInfo* gTrackElementLog;
static mozilla::LazyLogModule gTrackElementLog("nsTrackElement");
#define LOG(type, msg) MOZ_LOG(gTrackElementLog, type, msg)
// Replace the usual NS_IMPL_NS_NEW_HTML_ELEMENT(Track) so
@@ -76,9 +76,6 @@ static MOZ_CONSTEXPR const char* kKindTableDefaultString = kKindTable->tag;
HTMLTrackElement::HTMLTrackElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
if (!gTrackElementLog) {
gTrackElementLog = PR_NewLogModule("nsTrackElement");
}
}
HTMLTrackElement::~HTMLTrackElement()
+2 -6
View File
@@ -291,7 +291,7 @@ IndexedDatabaseManager::~IndexedDatabaseManager()
bool IndexedDatabaseManager::sIsMainProcess = false;
bool IndexedDatabaseManager::sFullSynchronousMode = false;
PRLogModuleInfo* IndexedDatabaseManager::sLoggingModule;
mozilla::LazyLogModule IndexedDatabaseManager::sLoggingModule("IndexedDB");
Atomic<IndexedDatabaseManager::LoggingMode>
IndexedDatabaseManager::sLoggingMode(
@@ -313,10 +313,6 @@ IndexedDatabaseManager::GetOrCreate()
if (!gDBManager) {
sIsMainProcess = XRE_IsParentProcess();
if (!sLoggingModule) {
sLoggingModule = PR_NewLogModule("IndexedDB");
}
if (sIsMainProcess && Preferences::GetBool("disk_space_watcher.enabled", false)) {
// See if we're starting up in low disk space conditions.
nsCOMPtr<nsIDiskSpaceWatcher> watcher =
@@ -703,7 +699,7 @@ IndexedDatabaseManager::GetLoggingMode()
}
// static
PRLogModuleInfo*
mozilla::LogModule*
IndexedDatabaseManager::GetLoggingModule()
{
MOZ_ASSERT(gDBManager,
+2 -4
View File
@@ -18,8 +18,6 @@
#include "nsHashKeys.h"
#include "nsITimer.h"
struct PRLogModuleInfo;
namespace mozilla {
class EventChainPostVisitor;
@@ -99,7 +97,7 @@ public:
}
#endif
static PRLogModuleInfo*
static mozilla::LogModule*
GetLoggingModule()
#ifdef DEBUG
;
@@ -214,7 +212,7 @@ private:
static bool sIsMainProcess;
static bool sFullSynchronousMode;
static PRLogModuleInfo* sLoggingModule;
static LazyLogModule sLoggingModule;
static Atomic<LoggingMode> sLoggingMode;
static mozilla::Atomic<bool> sLowDiskSpaceMode;
};
+1 -1
View File
@@ -279,7 +279,7 @@ LoggingHelper(bool aUseProfiler, const char* aFmt, ...)
IndexedDatabaseManager::Logging_Disabled);
MOZ_ASSERT(aFmt);
PRLogModuleInfo* logModule = IndexedDatabaseManager::GetLoggingModule();
mozilla::LogModule* logModule = IndexedDatabaseManager::GetLoggingModule();
MOZ_ASSERT(logModule);
static const mozilla::LogLevel logLevel = LogLevel::Warning;
+6 -8
View File
@@ -28,6 +28,10 @@
#include "nsComponentManagerUtils.h"
#include "nsCRT.h"
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::hal;
#ifdef XP_WIN
#include <process.h>
#define getpid _getpid
@@ -69,12 +73,10 @@
NameWithComma().get(), \
static_cast<uint64_t>(ChildID()), Pid(), ##__VA_ARGS__)
#else
static PRLogModuleInfo*
static LogModule*
GetPPMLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("ProcessPriorityManager");
static LazyLogModule sLog("ProcessPriorityManager");
return sLog;
}
# define LOG(fmt, ...) \
@@ -87,10 +89,6 @@
static_cast<uint64_t>(ChildID()), Pid(), ##__VA_ARGS__))
#endif
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::hal;
namespace {
class ParticularProcessPriorityManager;
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script>
const rate = 44100;
var context = new window.OfflineAudioContext(1, 512, rate);
var buffer = context.createBuffer(1, 128, rate);
var source = context.createBufferSource();
source.buffer = buffer;
source.start(0, 0, 86400);
context.startRendering().
then(function() {
document.documentElement.removeAttribute("class");
});
</script>
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html class="reftest-wait">
<script>
const rate = 44101; // not divisible by 2
var context = new window.OfflineAudioContext(1, 512, rate);
var buffer = context.createBuffer(1, 128, rate);
buffer.getChannelData(0)[0] = 1.0;
var source = context.createBufferSource();
source.buffer = buffer;
source.playbackRate.value = rate / (Math.pow(2, 30) * 1.0000001);
source.start(512 / rate);
context.startRendering().
then(function() {
document.documentElement.removeAttribute("class");
});
</script>
+14 -14
View File
@@ -1,5 +1,5 @@
skip-if(Android||B2G) load 0-timescale.html # bug 1048628 for Android
skip-if(Android||B2G) load 459439-1.html # bug 888557
skip-if(Android||B2G) load 0-timescale.html # bug 1048628
skip-if(Android) load 459439-1.html # bug 888557
load 466607-1.html
load 466945-1.html
load 468763-1.html
@@ -71,26 +71,26 @@ load 995289.html
load 1012609.html
load 1015662.html
load 1020205.html
skip-if(Android||B2G) test-pref(media.navigator.permission.disabled,true) load 1028458.html # bug 1048863
load 1041466.html
load 1045650.html
skip-if(Android||B2G) test-pref(media.navigator.permission.disabled,true) load 1028458.html # bug 1048863
load 1080986.html
load 1122218.html
load 1127188.html
load 1157994.html
load 1158427.html
load 1185176.html
load 1185192.html
load analyser-channels-1.html
load audiocontext-double-suspend.html
load buffer-source-duration-1.html
load buffer-source-ended-1.html
load buffer-source-resampling-start-1.html
load doppler-1.html
HTTP load media-element-source-seek-1.html
load offline-buffer-source-ended-1.html
load oscillator-ended-1.html
load oscillator-ended-2.html
load 1080986.html
load 1158427.html
load 1157994.html
load 1122218.html
load 1127188.html
load 1158427.html
load audiocontext-double-suspend.html
load 1185176.html
load 1185192.html
include ../../mediasource/test/crashtests/crashtests.list
# This needs to run at the end to avoid leaking busted state into other tests.
skip-if(B2G||winWidget||OSX==1006||OSX==1010&&isDebugBuild) load 691096-1.html
skip-if(B2G) load 691096-1.html # bug 852821
+3 -7
View File
@@ -170,9 +170,9 @@ static const char kDirectoryServiceContractID[] = "@mozilla.org/file/directory_s
#define kPluginRegistryFilename NS_LITERAL_CSTRING("pluginreg.dat")
#ifdef PLUGIN_LOGGING
PRLogModuleInfo* nsPluginLogging::gNPNLog = nullptr;
PRLogModuleInfo* nsPluginLogging::gNPPLog = nullptr;
PRLogModuleInfo* nsPluginLogging::gPluginLog = nullptr;
LazyLogModule nsPluginLogging::gNPNLog(NPN_LOG_NAME);
LazyLogModule nsPluginLogging::gNPPLog(NPP_LOG_NAME);
LazyLogModule nsPluginLogging::gPluginLog(PLUGIN_LOG_NAME);
#endif
// #defines for plugin cache and prefs
@@ -281,10 +281,6 @@ nsPluginHost::nsPluginHost()
}
#ifdef PLUGIN_LOGGING
nsPluginLogging::gNPNLog = PR_NewLogModule(NPN_LOG_NAME);
nsPluginLogging::gNPPLog = PR_NewLogModule(NPP_LOG_NAME);
nsPluginLogging::gPluginLog = PR_NewLogModule(PLUGIN_LOG_NAME);
MOZ_LOG(nsPluginLogging::gNPNLog, PLUGIN_LOG_ALWAYS,("NPN Logging Active!\n"));
MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_ALWAYS,("General Plugin Logging Active! (nsPluginHost::ctor)\n"));
MOZ_LOG(nsPluginLogging::gNPPLog, PLUGIN_LOG_ALWAYS,("NPP Logging Active!\n"));
+3 -3
View File
@@ -50,9 +50,9 @@
class nsPluginLogging
{
public:
static PRLogModuleInfo* gNPNLog; // 4.x NP API, calls into navigator
static PRLogModuleInfo* gNPPLog; // 4.x NP API, calls into plugin
static PRLogModuleInfo* gPluginLog; // general plugin log
static mozilla::LazyLogModule gNPNLog; // 4.x NP API, calls into navigator
static mozilla::LazyLogModule gNPPLog; // 4.x NP API, calls into plugin
static mozilla::LazyLogModule gPluginLog; // general plugin log
};
#endif // PLUGIN_LOGGING
+2 -4
View File
@@ -120,12 +120,10 @@ UnmungePluginDsoPath(const string& munged)
}
PRLogModuleInfo*
LogModule*
GetPluginLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("IPCPlugins");
static LazyLogModule sLog("IPCPlugins");
return sLog;
}
+1 -1
View File
@@ -50,7 +50,7 @@ MungePluginDsoPath(const std::string& path);
std::string
UnmungePluginDsoPath(const std::string& munged);
extern PRLogModuleInfo* GetPluginLog();
extern mozilla::LogModule* GetPluginLog();
#if defined(_MSC_VER)
#define FULLFUNCTION __FUNCSIG__
+2 -5
View File
@@ -22,13 +22,10 @@
#include "nsNetUtil.h"
#include "nsWhitespaceTokenizer.h"
static PRLogModuleInfo*
static mozilla::LogModule*
GetSriLog()
{
static PRLogModuleInfo *gSriPRLog;
if (!gSriPRLog) {
gSriPRLog = PR_NewLogModule("SRI");
}
static mozilla::LazyLogModule gSriPRLog("SRI");
return gSriPRLog;
}
+2 -5
View File
@@ -11,13 +11,10 @@
#include "mozilla/Logging.h"
#include "nsICryptoHash.h"
static PRLogModuleInfo*
static mozilla::LogModule*
GetSriMetadataLog()
{
static PRLogModuleInfo *gSriMetadataPRLog;
if (!gSriMetadataPRLog) {
gSriMetadataPRLog = PR_NewLogModule("SRIMetadata");
}
static mozilla::LazyLogModule gSriMetadataPRLog("SRIMetadata");
return gSriMetadataPRLog;
}
+2 -4
View File
@@ -45,12 +45,10 @@
using namespace mozilla;
static PRLogModuleInfo *
static LogModule*
GetCspContextLog()
{
static PRLogModuleInfo *gCspContextPRLog;
if (!gCspContextPRLog)
gCspContextPRLog = PR_NewLogModule("CSPContext");
static LazyLogModule gCspContextPRLog("CSPContext");
return gCspContextPRLog;
}
+2 -4
View File
@@ -19,12 +19,10 @@
using namespace mozilla;
static PRLogModuleInfo*
static LogModule*
GetCspParserLog()
{
static PRLogModuleInfo* gCspParserPRLog;
if (!gCspParserPRLog)
gCspParserPRLog = PR_NewLogModule("CSPParser");
static LazyLogModule gCspParserPRLog("CSPParser");
return gCspParserPRLog;
}
+1 -4
View File
@@ -27,14 +27,11 @@ using namespace mozilla;
/* Keeps track of whether or not CSP is enabled */
bool CSPService::sCSPEnabled = true;
static PRLogModuleInfo* gCspPRLog;
static LazyLogModule gCspPRLog("CSP");
CSPService::CSPService()
{
Preferences::AddBoolVarCache(&sCSPEnabled, "security.csp.enable");
if (!gCspPRLog)
gCspPRLog = PR_NewLogModule("CSP");
}
CSPService::~CSPService()
+15 -7
View File
@@ -16,12 +16,10 @@
#define DEFAULT_PORT -1
static PRLogModuleInfo*
static mozilla::LogModule*
GetCspUtilsLog()
{
static PRLogModuleInfo* gCspUtilsPRLog;
if (!gCspUtilsPRLog)
gCspUtilsPRLog = PR_NewLogModule("CSPUtils");
static mozilla::LazyLogModule gCspUtilsPRLog("CSPUtils");
return gCspUtilsPRLog;
}
@@ -679,6 +677,11 @@ nsCSPKeywordSrc::allows(enum CSPKeyword aKeyword, const nsAString& aHashOrNonce)
void
nsCSPKeywordSrc::toString(nsAString& outStr) const
{
if (mInvalidated) {
MOZ_ASSERT(mKeyword == CSP_UNSAFE_INLINE,
"can only ignore 'unsafe-inline' within toString()");
return;
}
outStr.AppendASCII(CSP_EnumToKeyword(mKeyword));
}
@@ -686,8 +689,8 @@ void
nsCSPKeywordSrc::invalidate()
{
mInvalidated = true;
NS_ASSERTION(mInvalidated == CSP_UNSAFE_INLINE,
"invalidate 'unsafe-inline' only within script-src");
MOZ_ASSERT(mKeyword == CSP_UNSAFE_INLINE,
"invalidate 'unsafe-inline' only within script-src");
}
/* ===== nsCSPNonceSrc ==================== */
@@ -1165,8 +1168,13 @@ nsCSPPolicy::allows(nsContentPolicyType aContentType,
}
}
// Only match {nonce,hash}-source on specific directives (not default-src)
// {nonce,hash}-source should not consult default-src:
// * return false if default-src is specified
// * but allow the load if default-src is *not* specified (Bug 1198422)
if (aKeyword == CSP_NONCE || aKeyword == CSP_HASH) {
if (!defaultDir) {
return true;
}
return false;
}
@@ -6,8 +6,8 @@
#include "StumblerLogging.h"
PRLogModuleInfo* GetLog()
mozilla::LogModule* GetLog()
{
static PRLogModuleInfo* log = PR_NewLogModule("mozstumbler");
static mozilla::LazyLogModule log("mozstumbler");
return log;
}
@@ -9,7 +9,7 @@
#include "mozilla/Logging.h"
PRLogModuleInfo* GetLog();
mozilla::LogModule* GetLog();
#define STUMBLER_DBG(arg, ...) MOZ_LOG(GetLog(), mozilla::LogLevel::Debug, ("STUMBLER - %s: " arg, __func__, ##__VA_ARGS__))
#define STUMBLER_LOG(arg, ...) MOZ_LOG(GetLog(), mozilla::LogLevel::Info, ("STUMBLER - %s: " arg, __func__, ##__VA_ARGS__))
+5 -7
View File
@@ -11,16 +11,14 @@
class txLog
{
public:
static PRLogModuleInfo *xpath;
static PRLogModuleInfo *xslt;
static mozilla::LazyLogModule xpath;
static mozilla::LazyLogModule xslt;
};
#define TX_LG_IMPL \
PRLogModuleInfo * txLog::xpath = 0; \
PRLogModuleInfo * txLog::xslt = 0;
mozilla::LazyLogModule txLog::xpath("xpath"); \
mozilla::LazyLogModule txLog::xslt("xslt");
#define TX_LG_CREATE \
txLog::xpath = PR_NewLogModule("xpath"); \
txLog::xslt = PR_NewLogModule("xslt")
#define TX_LG_CREATE
#endif
+1 -4
View File
@@ -131,7 +131,7 @@ const nsForwardReference::Phase nsForwardReference::kPasses[] = {
int32_t XULDocument::gRefCnt = 0;
PRLogModuleInfo* XULDocument::gXULLog;
LazyLogModule XULDocument::gXULLog("XULDocument");
//----------------------------------------------------------------------
@@ -1870,9 +1870,6 @@ XULDocument::Init()
Preferences::RegisterCallback(XULDocument::DirectionChanged,
"intl.uidirection.", this);
if (! gXULLog)
gXULLog = PR_NewLogModule("XULDocument");
return NS_OK;
}
+1 -3
View File
@@ -43,8 +43,6 @@ class nsIObjectOutputStream;
#include "nsURIHashKey.h"
#include "nsInterfaceHashtable.h"
struct PRLogModuleInfo;
class nsRefMapEntry : public nsStringHashKey
{
public:
@@ -294,7 +292,7 @@ protected:
static nsIRDFResource* kNC_attribute;
static nsIRDFResource* kNC_value;
static PRLogModuleInfo* gXULLog;
static LazyLogModule gXULLog;
nsresult
Persist(nsIContent* aElement, int32_t aNameSpaceID, nsIAtom* aAttribute);
+1 -4
View File
@@ -37,16 +37,13 @@
using namespace mozilla;
static PRLogModuleInfo* gCommandLog;
static LazyLogModule gCommandLog("nsXULCommandDispatcher");
////////////////////////////////////////////////////////////////////////
nsXULCommandDispatcher::nsXULCommandDispatcher(nsIDocument* aDocument)
: mDocument(aDocument), mUpdaters(nullptr)
{
if (! gCommandLog)
gCommandLog = PR_NewLogModule("nsXULCommandDispatcher");
}
nsXULCommandDispatcher::~nsXULCommandDispatcher()
+1 -4
View File
@@ -57,7 +57,7 @@
#include "nsIScriptError.h"
#include "nsContentTypeParser.h"
static PRLogModuleInfo* gContentSinkLog;
static mozilla::LazyLogModule gContentSinkLog("nsXULContentSink");;
//----------------------------------------------------------------------
@@ -162,9 +162,6 @@ XULContentSinkImpl::XULContentSinkImpl()
mConstrainSize(true),
mState(eInProlog)
{
if (! gContentSinkLog)
gContentSinkLog = PR_NewLogModule("nsXULContentSink");
}
+1 -1
View File
@@ -16,7 +16,7 @@
using mozilla::LogLevel;
extern PRLogModuleInfo* gXULTemplateLog;
extern mozilla::LazyLogModule gXULTemplateLog;
nsContentTestNode::nsContentTestNode(nsXULTemplateQueryProcessorRDF* aProcessor,
nsIAtom* aRefVariable)
+1 -1
View File
@@ -8,7 +8,7 @@
#include "nsXULTemplateQueryProcessorRDF.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* gXULTemplateLog;
extern mozilla::LazyLogModule gXULTemplateLog;
nsInstantiationNode::nsInstantiationNode(nsXULTemplateQueryProcessorRDF* aProcessor,
nsRDFQuery* aQuery)
@@ -16,7 +16,7 @@
using mozilla::LogLevel;
extern PRLogModuleInfo* gXULTemplateLog;
extern mozilla::LazyLogModule gXULTemplateLog;
static const char*
TestToString(nsRDFConInstanceTestNode::Test aTest) {
+1 -1
View File
@@ -16,7 +16,7 @@
using mozilla::LogLevel;
extern PRLogModuleInfo* gXULTemplateLog;
extern mozilla::LazyLogModule gXULTemplateLog;
nsRDFConMemberTestNode::nsRDFConMemberTestNode(TestNode* aParent,
nsXULTemplateQueryProcessorRDF* aProcessor,
+1 -1
View File
@@ -11,7 +11,7 @@
using mozilla::LogLevel;
extern PRLogModuleInfo* gXULTemplateLog;
extern mozilla::LazyLogModule gXULTemplateLog;
#include "nsIRDFLiteral.h"
nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent,
+1 -1
View File
@@ -21,7 +21,6 @@
#include "plhash.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* gXULTemplateLog;
#include "nsString.h"
#include "nsUnicharUtils.h"
@@ -33,6 +32,7 @@ extern PRLogModuleInfo* gXULTemplateLog;
#include "nsRDFPropertyTestNode.h"
using namespace mozilla;
extern LazyLogModule gXULTemplateLog;
//----------------------------------------------------------------------
//
+1 -1
View File
@@ -66,7 +66,7 @@ nsIRDFService* nsXULContentUtils::gRDF;
nsIDateTimeFormat* nsXULContentUtils::gFormat;
nsICollation *nsXULContentUtils::gCollation;
extern PRLogModuleInfo* gXULTemplateLog;
extern LazyLogModule gXULTemplateLog;
#define XUL_RESOURCE(ident, uri) nsIRDFResource* nsXULContentUtils::ident
#define XUL_LITERAL(ident, val) nsIRDFLiteral* nsXULContentUtils::ident
+1 -4
View File
@@ -86,7 +86,7 @@ nsIScriptSecurityManager* nsXULTemplateBuilder::gScriptSecurityManager;
nsIPrincipal* nsXULTemplateBuilder::gSystemPrincipal;
nsIObserverService* nsXULTemplateBuilder::gObserverService;
PRLogModuleInfo* gXULTemplateLog;
LazyLogModule gXULTemplateLog("nsXULTemplateBuilder");
#define NS_QUERY_PROCESSOR_CONTRACTID_PREFIX "@mozilla.org/xul/xul-query-processor;1?name="
@@ -165,9 +165,6 @@ nsXULTemplateBuilder::InitGlobals()
return rv;
}
if (! gXULTemplateLog)
gXULTemplateLog = PR_NewLogModule("nsXULTemplateBuilder");
return NS_OK;
}
+1 -1
View File
@@ -26,7 +26,7 @@
#include "nsCycleCollectionParticipant.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* gXULTemplateLog;
extern mozilla::LazyLogModule gXULTemplateLog;
class nsIContent;
class nsIObserverService;
@@ -29,7 +29,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* gXULTemplateLog;
extern mozilla::LazyLogModule gXULTemplateLog;
class nsIContent;
class nsXULTemplateResultRDF;
+53 -29
View File
@@ -812,8 +812,7 @@ NS_IMETHODIMP nsHTMLEditor::PrepareTransferable(nsITransferable **transferable)
}
nsresult
nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable,
bool aHavePrivFlavor)
nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable)
{
// Create generic Transferable for getting the data
nsresult rv = CallCreateInstance("@mozilla.org/widget/transferable;1", aTransferable);
@@ -831,10 +830,7 @@ nsHTMLEditor::PrepareHTMLTransferable(nsITransferable **aTransferable,
// This should only happen in html editors, not plaintext
if (!IsPlaintextEditor())
{
if (!aHavePrivFlavor)
{
(*aTransferable)->AddDataFlavor(kNativeHTMLMime);
}
(*aTransferable)->AddDataFlavor(kNativeHTMLMime);
(*aTransferable)->AddDataFlavor(kHTMLMime);
(*aTransferable)->AddDataFlavor(kFileMime);
@@ -1095,6 +1091,7 @@ nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable,
nsIDOMDocument *aSourceDoc,
const nsAString & aContextStr,
const nsAString & aInfoStr,
bool havePrivateHTMLFlavor,
nsIDOMNode *aDestinationNode,
int32_t aDestOffset,
bool aDoDeleteSelection)
@@ -1134,12 +1131,24 @@ nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable,
if (NS_SUCCEEDED(rv) && !cffragment.IsEmpty())
{
nsAutoEditBatch beginBatching(this);
rv = DoInsertHTMLWithContext(cffragment,
cfcontext, cfselection, flavor,
aSourceDoc,
aDestinationNode, aDestOffset,
aDoDeleteSelection,
isSafe);
// If we have our private HTML flavor, we will only use the fragment
// from the CF_HTML. The rest comes from the clipboard.
if (havePrivateHTMLFlavor) {
rv = DoInsertHTMLWithContext(cffragment,
aContextStr, aInfoStr, flavor,
aSourceDoc,
aDestinationNode, aDestOffset,
aDoDeleteSelection,
isSafe);
} else {
rv = DoInsertHTMLWithContext(cffragment,
cfcontext, cfselection, flavor,
aSourceDoc,
aDestinationNode, aDestOffset,
aDoDeleteSelection,
isSafe);
}
} else {
// In some platforms (like Linux), the clipboard might return data
// requested for unknown flavors (for example:
@@ -1241,9 +1250,10 @@ nsresult nsHTMLEditor::InsertFromDataTransfer(DataTransfer *aDataTransfer,
aSourceDoc, aDestinationNode, aDestOffset, aDoDeleteSelection);
}
}
else if (!hasPrivateHTMLFlavor && type.EqualsLiteral(kNativeHTMLMime)) {
else if (type.EqualsLiteral(kNativeHTMLMime)) {
// Windows only clipboard parsing.
nsAutoString text;
GetStringFromDataTransfer(aDataTransfer, NS_LITERAL_STRING(kNativeHTMLMime), aIndex, text);
GetStringFromDataTransfer(aDataTransfer, type, aIndex, text);
NS_ConvertUTF16toUTF8 cfhtml(text);
nsXPIDLString cfcontext, cffragment, cfselection; // cfselection left emtpy for now
@@ -1252,12 +1262,28 @@ nsresult nsHTMLEditor::InsertFromDataTransfer(DataTransfer *aDataTransfer,
if (NS_SUCCEEDED(rv) && !cffragment.IsEmpty())
{
nsAutoEditBatch beginBatching(this);
return DoInsertHTMLWithContext(cffragment,
cfcontext, cfselection, type,
aSourceDoc,
aDestinationNode, aDestOffset,
aDoDeleteSelection,
isSafe);
if (hasPrivateHTMLFlavor) {
// If we have our private HTML flavor, we will only use the fragment
// from the CF_HTML. The rest comes from the clipboard.
nsAutoString contextString, infoString;
GetStringFromDataTransfer(aDataTransfer, NS_LITERAL_STRING(kHTMLContext), aIndex, contextString);
GetStringFromDataTransfer(aDataTransfer, NS_LITERAL_STRING(kHTMLInfo), aIndex, infoString);
return DoInsertHTMLWithContext(cffragment,
contextString, infoString, type,
aSourceDoc,
aDestinationNode, aDestOffset,
aDoDeleteSelection,
isSafe);
}
else {
return DoInsertHTMLWithContext(cffragment,
cfcontext, cfselection, type,
aSourceDoc,
aDestinationNode, aDestOffset,
aDoDeleteSelection,
isSafe);
}
}
}
else if (type.EqualsLiteral(kHTMLMime)) {
@@ -1321,13 +1347,9 @@ NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType)
nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1", &rv));
NS_ENSURE_SUCCESS(rv, rv);
// find out if we have our internal html flavor on the clipboard. We don't want to mess
// around with cfhtml if we do.
bool bHavePrivateHTMLFlavor = HavePrivateHTMLFlavor(clipboard);
// Get the nsITransferable interface for getting the data from the clipboard
nsCOMPtr<nsITransferable> trans;
rv = PrepareHTMLTransferable(getter_AddRefs(trans), bHavePrivateHTMLFlavor);
rv = PrepareHTMLTransferable(getter_AddRefs(trans));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(trans, NS_ERROR_FAILURE);
// Get the Data from the clipboard
@@ -1340,7 +1362,9 @@ NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType)
// also get additional html copy hints, if present
nsAutoString contextStr, infoStr;
// also get additional html copy hints, if present
// If we have our internal html flavor on the clipboard, there is special
// context to use instead of cfhtml context.
bool bHavePrivateHTMLFlavor = HavePrivateHTMLFlavor(clipboard);
if (bHavePrivateHTMLFlavor)
{
nsCOMPtr<nsISupports> contextDataObj, infoDataObj;
@@ -1388,7 +1412,7 @@ NS_IMETHODIMP nsHTMLEditor::Paste(int32_t aSelectionType)
if (!nsEditorHookUtils::DoInsertionHook(domdoc, nullptr, trans))
return NS_OK;
return InsertFromTransferable(trans, nullptr, contextStr, infoStr,
return InsertFromTransferable(trans, nullptr, contextStr, infoStr, bHavePrivateHTMLFlavor,
nullptr, 0, true);
}
@@ -1406,7 +1430,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteTransferable(nsITransferable *aTransferable)
return NS_OK;
nsAutoString contextStr, infoStr;
return InsertFromTransferable(aTransferable, nullptr, contextStr, infoStr,
return InsertFromTransferable(aTransferable, nullptr, contextStr, infoStr, false,
nullptr, 0, true);
}
@@ -1436,7 +1460,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteNoFormatting(int32_t aSelectionType)
if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable())
{
const nsAFlatString& empty = EmptyString();
rv = InsertFromTransferable(trans, nullptr, empty, empty, nullptr, 0,
rv = InsertFromTransferable(trans, nullptr, empty, empty, false, nullptr, 0,
true);
}
}
+2 -1
View File
@@ -552,11 +552,12 @@ protected:
// factored methods for handling insertion of data from transferables (drag&drop or clipboard)
NS_IMETHOD PrepareTransferable(nsITransferable **transferable) override;
nsresult PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
nsresult PrepareHTMLTransferable(nsITransferable **transferable);
nsresult InsertFromTransferable(nsITransferable *transferable,
nsIDOMDocument *aSourceDoc,
const nsAString & aContextStr,
const nsAString & aInfoStr,
bool havePrivateHTMLFlavor,
nsIDOMNode *aDestinationNode,
int32_t aDestinationOffset,
bool aDoDeleteSelection);
+7 -1
View File
@@ -26,7 +26,13 @@ function runTest() {
function verifyContent(s) {
var e = document.getElementById('i1');
var doc = e.contentDocument;
is(doc.body.innerHTML, s, "");
if (navigator.platform.indexOf("Win") >= 0) {
// On Windows ignore \n which got left over from the removal of the fragment tags
// <html><body>\n<!--StartFragment--> and <!--EndFragment-->\n</body>\n</html>.
is(doc.body.innerHTML.replace(/\n/g, ""), s, "");
} else {
is(doc.body.innerHTML, s, "");
}
}
function pasteInto(trans, html, target_id) {
+7 -11
View File
@@ -1351,16 +1351,6 @@ nsZipReaderCache::ReleaseZip(nsJAR* zip)
return NS_OK;
}
static PLDHashOperator
FindFlushableZip(const nsACString &aKey, RefPtr<nsJAR>& aCurrent, void*)
{
if (aCurrent->GetReleaseTime() != PR_INTERVAL_NO_TIMEOUT) {
aCurrent->SetZipReaderCache(nullptr);
return PL_DHASH_REMOVE;
}
return PL_DHASH_NEXT;
}
NS_IMETHODIMP
nsZipReaderCache::Observe(nsISupports *aSubject,
const char *aTopic,
@@ -1368,7 +1358,13 @@ nsZipReaderCache::Observe(nsISupports *aSubject,
{
if (strcmp(aTopic, "memory-pressure") == 0) {
MutexAutoLock lock(mLock);
mZips.Enumerate(FindFlushableZip, nullptr);
for (auto iter = mZips.Iter(); !iter.Done(); iter.Next()) {
RefPtr<nsJAR>& current = iter.Data();
if (current->GetReleaseTime() != PR_INTERVAL_NO_TIMEOUT) {
current->SetZipReaderCache(nullptr);
iter.Remove();
}
}
}
else if (strcmp(aTopic, "chrome-flush-caches") == 0) {
MutexAutoLock lock(mLock);
+41 -58
View File
@@ -261,60 +261,10 @@ public:
protected:
static const uint32_t kSuspectReferentCount = 1000;
static PLDHashOperator CountReferents(PrefCallback* aKey,
nsAutoPtr<PrefCallback>& aCallback,
void* aClosure);
};
NS_IMPL_ISUPPORTS(PreferenceServiceReporter, nsIMemoryReporter)
struct PreferencesReferentCount {
PreferencesReferentCount() : numStrong(0), numWeakAlive(0), numWeakDead(0) {}
size_t numStrong;
size_t numWeakAlive;
size_t numWeakDead;
nsTArray<nsCString> suspectPreferences;
// Count of the number of referents for each preference.
nsDataHashtable<nsCStringHashKey, uint32_t> prefCounter;
};
PLDHashOperator
PreferenceServiceReporter::CountReferents(PrefCallback* aKey,
nsAutoPtr<PrefCallback>& aCallback,
void* aClosure)
{
PreferencesReferentCount* referentCount =
static_cast<PreferencesReferentCount*>(aClosure);
nsPrefBranch* prefBranch = aCallback->GetPrefBranch();
const char* pref = prefBranch->getPrefName(aCallback->GetDomain().get());
if (aCallback->IsWeak()) {
nsCOMPtr<nsIObserver> callbackRef = do_QueryReferent(aCallback->mWeakRef);
if (callbackRef) {
referentCount->numWeakAlive++;
} else {
referentCount->numWeakDead++;
}
} else {
referentCount->numStrong++;
}
nsDependentCString prefString(pref);
uint32_t oldCount = 0;
referentCount->prefCounter.Get(prefString, &oldCount);
uint32_t currentCount = oldCount + 1;
referentCount->prefCounter.Put(prefString, currentCount);
// Keep track of preferences that have a suspiciously large
// number of referents (symptom of leak).
if (currentCount == kSuspectReferentCount) {
referentCount->suspectPreferences.AppendElement(prefString);
}
return PL_DHASH_NEXT;
}
MOZ_DEFINE_MALLOC_SIZE_OF(PreferenceServiceMallocSizeOf)
NS_IMETHODIMP
@@ -342,13 +292,46 @@ PreferenceServiceReporter::CollectReports(nsIMemoryReporterCallback* aCb,
return NS_OK;
}
PreferencesReferentCount referentCount;
rootBranch->mObservers.Enumerate(&CountReferents, &referentCount);
size_t numStrong = 0;
size_t numWeakAlive = 0;
size_t numWeakDead = 0;
nsTArray<nsCString> suspectPreferences;
// Count of the number of referents for each preference.
nsDataHashtable<nsCStringHashKey, uint32_t> prefCounter;
for (uint32_t i = 0; i < referentCount.suspectPreferences.Length(); i++) {
nsCString& suspect = referentCount.suspectPreferences[i];
for (auto iter = rootBranch->mObservers.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<PrefCallback>& callback = iter.Data();
nsPrefBranch* prefBranch = callback->GetPrefBranch();
const char* pref = prefBranch->getPrefName(callback->GetDomain().get());
if (callback->IsWeak()) {
nsCOMPtr<nsIObserver> callbackRef = do_QueryReferent(callback->mWeakRef);
if (callbackRef) {
numWeakAlive++;
} else {
numWeakDead++;
}
} else {
numStrong++;
}
nsDependentCString prefString(pref);
uint32_t oldCount = 0;
prefCounter.Get(prefString, &oldCount);
uint32_t currentCount = oldCount + 1;
prefCounter.Put(prefString, currentCount);
// Keep track of preferences that have a suspiciously large number of
// referents (a symptom of a leak).
if (currentCount == kSuspectReferentCount) {
suspectPreferences.AppendElement(prefString);
}
}
for (uint32_t i = 0; i < suspectPreferences.Length(); i++) {
nsCString& suspect = suspectPreferences[i];
uint32_t totalReferentCount = 0;
referentCount.prefCounter.Get(suspect, &totalReferentCount);
prefCounter.Get(suspect, &totalReferentCount);
nsPrintfCString suspectPath("preference-service-suspect/"
"referent(pref=%s)", suspect.get());
@@ -360,16 +343,16 @@ PreferenceServiceReporter::CollectReports(nsIMemoryReporterCallback* aCb,
}
REPORT(NS_LITERAL_CSTRING("preference-service/referent/strong"),
KIND_OTHER, UNITS_COUNT, referentCount.numStrong,
KIND_OTHER, UNITS_COUNT, numStrong,
"The number of strong referents held by the preference service.");
REPORT(NS_LITERAL_CSTRING("preference-service/referent/weak/alive"),
KIND_OTHER, UNITS_COUNT, referentCount.numWeakAlive,
KIND_OTHER, UNITS_COUNT, numWeakAlive,
"The number of weak referents held by the preference service "
"that are still alive.");
REPORT(NS_LITERAL_CSTRING("preference-service/referent/weak/dead"),
KIND_OTHER, UNITS_COUNT, referentCount.numWeakDead,
KIND_OTHER, UNITS_COUNT, numWeakDead,
"The number of weak referents held by the preference service "
"that are dead.");
+15 -26
View File
@@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@@ -635,8 +636,8 @@ NS_IMETHODIMP nsPrefBranch::RemoveObserver(const char *aDomain, nsIObserver *aOb
// it hasn't been already.
//
// It's important that we don't touch mObservers in any way -- even a Get()
// which retuns null might cause the hashtable to resize itself, which will
// break the Enumerator in freeObserverList.
// which returns null might cause the hashtable to resize itself, which will
// break the iteration in freeObserverList.
if (mFreeingObserverList)
return NS_OK;
@@ -686,32 +687,20 @@ void nsPrefBranch::NotifyObserver(const char *newpref, void *data)
NS_ConvertASCIItoUTF16(suffix).get());
}
PLDHashOperator
FreeObserverFunc(PrefCallback *aKey,
nsAutoPtr<PrefCallback> &aCallback,
void *aArgs)
{
// Calling NS_RELEASE below might trigger a call to
// nsPrefBranch::RemoveObserver, since some classes remove themselves from
// the pref branch on destruction. We don't need to worry about this causing
// double-frees, however, because freeObserverList sets mFreeingObserverList
// to true, which prevents RemoveObserver calls from doing anything.
nsPrefBranch *prefBranch = aCallback->GetPrefBranch();
const char *pref = prefBranch->getPrefName(aCallback->GetDomain().get());
PREF_UnregisterCallback(pref, nsPrefBranch::NotifyObserver, aCallback);
return PL_DHASH_REMOVE;
}
void nsPrefBranch::freeObserverList(void)
{
// We need to prevent anyone from modifying mObservers while we're
// enumerating over it. In particular, some clients will call
// RemoveObserver() when they're destructed; we need to keep those calls from
// touching mObservers.
// We need to prevent anyone from modifying mObservers while we're iterating
// over it. In particular, some clients will call RemoveObserver() when
// they're removed and destructed via the iterator; we set
// mFreeingObserverList to keep those calls from touching mObservers.
mFreeingObserverList = true;
mObservers.Enumerate(&FreeObserverFunc, nullptr);
for (auto iter = mObservers.Iter(); !iter.Done(); iter.Next()) {
nsAutoPtr<PrefCallback>& callback = iter.Data();
nsPrefBranch *prefBranch = callback->GetPrefBranch();
const char *pref = prefBranch->getPrefName(callback->GetDomain().get());
PREF_UnregisterCallback(pref, nsPrefBranch::NotifyObserver, callback);
iter.Remove();
}
mFreeingObserverList = false;
}
+2 -3
View File
@@ -16,7 +16,9 @@ include ../../dom/html/crashtests/crashtests.list
include ../../dom/indexedDB/crashtests/crashtests.list
include ../../dom/jsurl/crashtests/crashtests.list
include ../../dom/mathml/crashtests/crashtests.list
include ../../dom/media/mediasource/test/crashtests/crashtests.list
include ../../dom/media/test/crashtests/crashtests.list
skip-if(!webrtc) include ../../dom/media/tests/crashtests/crashtests.list
include ../../dom/offline/crashtests/crashtests.list
include ../../dom/plugins/test/crashtests/crashtests.list
include ../../dom/smil/crashtests/crashtests.list
@@ -28,9 +30,6 @@ include ../../dom/xslt/crashtests/crashtests.list
include ../../dom/xul/crashtests/crashtests.list
include ../../dom/xul/templates/crashtests/crashtests.list
# Bug 811873 - mozRTCPeerConnection doesn't support remote browser yet
skip-if(browserIsRemote||!webrtc) include ../../dom/media/tests/crashtests/crashtests.list
include ../../editor/composer/crashtests/crashtests.list
include ../../editor/libeditor/crashtests/crashtests.list
include ../../editor/txmgr/tests/crashtests/crashtests.list
+34
View File
@@ -80,6 +80,40 @@ nsPrimitiveHelpers :: CreatePrimitiveForData ( const char* aFlavor, const void*
} // CreatePrimitiveForData
//
// CreatePrimitiveForCFHTML
//
// Platform specific CreatePrimitive, windows CF_HTML.
//
void
nsPrimitiveHelpers :: CreatePrimitiveForCFHTML ( const void* aDataBuff,
uint32_t* aDataLen, nsISupports** aPrimitive )
{
if (!aPrimitive)
return;
nsCOMPtr<nsISupportsString> primitive =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID);
if (!primitive)
return;
// We need to duplicate the input buffer, since the removal of linebreaks
// might reallocte it.
void* utf8 = moz_xmalloc(*aDataLen);
if (!utf8)
return;
memcpy(utf8, aDataBuff, *aDataLen);
int32_t signedLen = static_cast<int32_t>(*aDataLen);
nsLinebreakHelpers::ConvertPlatformToDOMLinebreaks(kTextMime, &utf8, &signedLen);
*aDataLen = signedLen;
nsAutoString str(NS_ConvertUTF8toUTF16(reinterpret_cast<const char*>(utf8), *aDataLen));
free(utf8);
*aDataLen = str.Length() * sizeof(char16_t);
primitive->SetData(str);
NS_ADDREF(*aPrimitive = primitive);
}
//
// CreateDataFromPrimitive
+4
View File
@@ -23,6 +23,10 @@ public:
static void CreatePrimitiveForData ( const char* aFlavor, const void* aDataBuff,
uint32_t aDataLen, nsISupports** aPrimitive ) ;
// A specific case of CreatePrimitive for windows CF_HTML handling in DataTransfer
static void CreatePrimitiveForCFHTML ( const void* aDataBuff,
uint32_t* aDataLen, nsISupports** aPrimitive ) ;
// Given a nsISupports* primitive and the flavor it represents, creates a new data
// buffer with the data in it. This data will be null terminated, but the length
// parameter does not reflect that.
+28 -4
View File
@@ -275,7 +275,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, uint32_t * aLe
if (aHGBL != nullptr) {
LPSTR lpStr = (LPSTR) GlobalLock(aHGBL);
DWORD allocSize = GlobalSize(aHGBL);
char* data = static_cast<char*>(moz_xmalloc(allocSize + sizeof(char16_t)));
char* data = static_cast<char*>(malloc(allocSize + sizeof(char16_t)));
if ( data ) {
memcpy ( data, lpStr, allocSize );
data[allocSize] = data[allocSize + 1] = '\0'; // null terminate for safety
@@ -629,11 +629,12 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject * aDataObject,
genericDataWrapper = do_QueryInterface(file);
free(data);
}
else if ( strcmp(flavorStr, kNativeHTMLMime) == 0) {
else if ( strcmp(flavorStr, kNativeHTMLMime) == 0 ) {
uint32_t dummy;
// the editor folks want CF_HTML exactly as it's on the clipboard, no conversions,
// no fancy stuff. Pull it off the clipboard, stuff it into a wrapper and hand
// it back to them.
if ( FindPlatformHTML(aDataObject, anIndex, &data, &dataLen) )
if ( FindPlatformHTML(aDataObject, anIndex, &data, &dummy, &dataLen) )
nsPrimitiveHelpers::CreatePrimitiveForData ( flavorStr, data, dataLen, getter_AddRefs(genericDataWrapper) );
else
{
@@ -642,6 +643,23 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject * aDataObject,
}
free(data);
}
else if ( strcmp(flavorStr, kHTMLMime) == 0 ) {
uint32_t startOfData = 0;
// The JS folks want CF_HTML exactly as it is on the clipboard, but
// minus the CF_HTML header index information.
// It also needs to be converted to UTF16 and have linebreaks changed.
if ( FindPlatformHTML(aDataObject, anIndex, &data, &startOfData, &dataLen) ) {
dataLen -= startOfData;
nsPrimitiveHelpers::CreatePrimitiveForCFHTML ( static_cast<char*>(data) + startOfData,
&dataLen, getter_AddRefs(genericDataWrapper) );
}
else
{
free(data);
continue; // something wrong with this flavor, keep looking for other data
}
free(data);
}
else if ( strcmp(flavorStr, kJPEGImageMime) == 0 ||
strcmp(flavorStr, kJPGImageMime) == 0 ||
strcmp(flavorStr, kPNGImageMime) == 0) {
@@ -689,7 +707,9 @@ nsresult nsClipboard::GetDataFromDataObject(IDataObject * aDataObject,
// Someone asked for the OS CF_HTML flavor. We give it back to them exactly as-is.
//
bool
nsClipboard :: FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen )
nsClipboard :: FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex,
void** outData, uint32_t* outStartOfData,
uint32_t* outDataLen )
{
// Reference: MSDN doc entitled "HTML Clipboard Format"
// http://msdn.microsoft.com/en-us/library/aa767917(VS.85).aspx#unknown_854
@@ -732,6 +752,10 @@ nsClipboard :: FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void*
// We want to return the buffer not offset by startOfData because it will be
// parsed out later (probably by nsHTMLEditor::ParseCFHTML) when it is still
// in CF_HTML format.
// We return the byte offset from the start of the data buffer to where the
// HTML data starts. The caller might want to extract the HTML only.
*outStartOfData = startOfData;
*outDataLen = endOfData;
return true;
}
+2 -1
View File
@@ -69,7 +69,8 @@ protected:
static bool FindURLFromLocalFile ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
static bool FindURLFromNativeURL ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
static bool FindUnicodeFromPlainText ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen ) ;
static bool FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void** outData, uint32_t* outDataLen );
static bool FindPlatformHTML ( IDataObject* inDataObject, UINT inIndex, void** outData,
uint32_t* outStartOfData, uint32_t* outDataLen );
static void ResolveShortcut ( nsIFile* inFileName, nsACString& outURL ) ;
nsIWidget * mWindow;
+8
View File
@@ -539,6 +539,14 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, bool *_retval)
if (mDataObject->QueryGetData(&fe) == S_OK)
*_retval = true; // found it!
}
else if (strcmp(aDataFlavor, kHTMLMime) == 0) {
// If the client wants html, maybe it's in "HTML Format".
format = nsClipboard::GetFormat(kHTMLMime);
SET_FORMATETC(fe, format, 0, DVASPECT_CONTENT, -1,
TYMED_HGLOBAL);
if (mDataObject->QueryGetData(&fe) == S_OK)
*_retval = true; // found it!
}
} // else try again
}