forked from mirrors/gecko-dev
Backed out changeset 7fa7d6e6dedc (bug 1442778) for devtools failures on browser_webconsole_check_stubs_console_api.js CLOSED TREE
This commit is contained in:
parent
888d83038c
commit
78fc71e3c3
37 changed files with 68 additions and 149 deletions
|
|
@ -447,6 +447,7 @@ nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
|
|||
return *aPrincipal ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// nsScriptSecurityManager //
|
||||
/////////////////////////////
|
||||
|
|
@ -1148,8 +1149,7 @@ nsresult nsScriptSecurityManager::ReportError(const char* aMessageTag,
|
|||
|
||||
// using category of "SOP" so we can link to MDN
|
||||
rv = error->Init(message, EmptyString(), EmptyString(), 0, 0,
|
||||
nsIScriptError::errorFlag, "SOP", aFromPrivateWindow,
|
||||
true /* From chrome context */);
|
||||
nsIScriptError::errorFlag, "SOP", aFromPrivateWindow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
console->LogMessage(error);
|
||||
return NS_OK;
|
||||
|
|
|
|||
|
|
@ -79,10 +79,10 @@ void nsChromeRegistry::LogMessageWithContext(nsIURI* aURL, uint32_t aLineNumber,
|
|||
nsCString spec;
|
||||
if (aURL) aURL->GetSpec(spec);
|
||||
|
||||
rv = error->Init(
|
||||
NS_ConvertUTF8toUTF16(formatted.get()), NS_ConvertUTF8toUTF16(spec),
|
||||
EmptyString(), aLineNumber, 0, flags, "chrome registration",
|
||||
false /* from private window */, true /* from chrome context */);
|
||||
rv = error->Init(NS_ConvertUTF8toUTF16(formatted.get()),
|
||||
NS_ConvertUTF8toUTF16(spec), EmptyString(), aLineNumber, 0,
|
||||
flags, "chrome registration",
|
||||
false /* from private window */);
|
||||
|
||||
if (NS_FAILED(rv)) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
#include "mozilla/dom/StructuredCloneTags.h"
|
||||
#include "mozilla/dom/UnionConversions.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDocShell.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIConsoleService.h"
|
||||
|
|
@ -135,10 +136,9 @@ PostMessageEvent::Run() {
|
|||
rv = NS_GetSanitizedURIStringFromURI(callerDocumentURI, uriSpec);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = errorObject->Init(
|
||||
errorText, uriSpec, EmptyString(), 0, 0, nsIScriptError::errorFlag,
|
||||
"DOM Window", mIsFromPrivateWindow,
|
||||
nsContentUtils::IsSystemPrincipal(mProvidedPrincipal));
|
||||
rv = errorObject->Init(errorText, uriSpec, EmptyString(), 0, 0,
|
||||
nsIScriptError::errorFlag, "DOM Window",
|
||||
mIsFromPrivateWindow);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,6 @@
|
|||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/MaybeOneOf.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -3736,17 +3736,16 @@ nsresult nsContentUtils::FormatLocalizedString(
|
|||
/* static */
|
||||
void nsContentUtils::LogSimpleConsoleError(const nsAString& aErrorText,
|
||||
const char* classification,
|
||||
bool aFromPrivateWindow,
|
||||
bool aFromChromeContext) {
|
||||
bool aFromPrivateWindow) {
|
||||
nsCOMPtr<nsIScriptError> scriptError =
|
||||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID);
|
||||
if (scriptError) {
|
||||
nsCOMPtr<nsIConsoleService> console =
|
||||
do_GetService(NS_CONSOLESERVICE_CONTRACTID);
|
||||
if (console && NS_SUCCEEDED(scriptError->Init(
|
||||
aErrorText, EmptyString(), EmptyString(), 0, 0,
|
||||
nsIScriptError::errorFlag, classification,
|
||||
aFromPrivateWindow, aFromChromeContext))) {
|
||||
if (console &&
|
||||
NS_SUCCEEDED(scriptError->Init(aErrorText, EmptyString(), EmptyString(),
|
||||
0, 0, nsIScriptError::errorFlag,
|
||||
classification, aFromPrivateWindow))) {
|
||||
console->LogMessage(scriptError);
|
||||
}
|
||||
}
|
||||
|
|
@ -5300,7 +5299,6 @@ nsContentUtils::GetMostRecentNonPBWindow() {
|
|||
void nsContentUtils::WarnScriptWasIgnored(Document* aDocument) {
|
||||
nsAutoString msg;
|
||||
bool privateBrowsing = false;
|
||||
bool chromeContext = false;
|
||||
|
||||
if (aDocument) {
|
||||
nsCOMPtr<nsIURI> uri = aDocument->GetDocumentURI();
|
||||
|
|
@ -5310,12 +5308,11 @@ void nsContentUtils::WarnScriptWasIgnored(Document* aDocument) {
|
|||
}
|
||||
privateBrowsing =
|
||||
!!aDocument->NodePrincipal()->OriginAttributesRef().mPrivateBrowsingId;
|
||||
chromeContext = IsSystemPrincipal(aDocument->NodePrincipal());
|
||||
}
|
||||
|
||||
msg.AppendLiteral(
|
||||
"Unable to run script because scripts are blocked internally.");
|
||||
LogSimpleConsoleError(msg, "DOM", privateBrowsing, chromeContext);
|
||||
LogSimpleConsoleError(msg, "DOM", privateBrowsing);
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
|||
|
|
@ -1024,8 +1024,7 @@ class nsContentUtils {
|
|||
*/
|
||||
static void LogSimpleConsoleError(const nsAString& aErrorText,
|
||||
const char* classification,
|
||||
bool aFromPrivateWindow,
|
||||
bool aFromChromeContext);
|
||||
bool aFromPrivateWindow);
|
||||
|
||||
/**
|
||||
* Report a non-localized error message to the error console.
|
||||
|
|
|
|||
|
|
@ -409,8 +409,7 @@ bool nsFrameMessageManager::GetParamsForMessage(JSContext* aCx,
|
|||
"you trying to send an XPCOM object?"),
|
||||
filename, EmptyString(), lineno, column,
|
||||
nsIScriptError::warningFlag, "chrome javascript",
|
||||
false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
false /* from private window */);
|
||||
console->LogMessage(error);
|
||||
}
|
||||
|
||||
|
|
@ -825,8 +824,7 @@ void nsFrameMessageManager::ReceiveMessage(
|
|||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||
error->Init(msg, EmptyString(), EmptyString(), 0, 0,
|
||||
nsIScriptError::warningFlag, "chrome javascript",
|
||||
false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
false /* from private window */);
|
||||
console->LogMessage(error);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5951,8 +5951,7 @@ bool nsGlobalWindowOuter::GetPrincipalForPostMessage(
|
|||
R"(origin "%s" from a system principal scope with mismatched )"
|
||||
R"(origin "%s".)",
|
||||
targetURL.get(), targetOrigin.get(), sourceOrigin.get())),
|
||||
"DOM", !!principal->PrivateBrowsingId(),
|
||||
nsContentUtils::IsSystemPrincipal(principal));
|
||||
"DOM", !!principal->PrivateBrowsingId());
|
||||
|
||||
attrs = principal->OriginAttributesRef();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,8 +93,6 @@ interface nsIScriptError : nsIConsoleMessage
|
|||
|
||||
readonly attribute boolean isFromPrivateWindow;
|
||||
|
||||
readonly attribute boolean isFromChromeContext;
|
||||
|
||||
attribute jsval stack;
|
||||
|
||||
/**
|
||||
|
|
@ -127,8 +125,7 @@ interface nsIScriptError : nsIConsoleMessage
|
|||
in uint32_t columnNumber,
|
||||
in uint32_t flags,
|
||||
in string category,
|
||||
[optional] in bool fromPrivateWindow,
|
||||
[optional] in bool fromChromeContext);
|
||||
[optional] in bool fromPrivateWindow);
|
||||
|
||||
/* This should be called instead of nsIScriptError.init to
|
||||
* initialize with a window id. The window id should be for the
|
||||
|
|
|
|||
|
|
@ -44,8 +44,7 @@ nsScriptErrorBase::nsScriptErrorBase()
|
|||
mTimeStamp(0),
|
||||
mTimeWarpTarget(0),
|
||||
mInitializedOnMainThread(false),
|
||||
mIsFromPrivateWindow(false),
|
||||
mIsFromChromeContext(false) {}
|
||||
mIsFromPrivateWindow(false) {}
|
||||
|
||||
nsScriptErrorBase::~nsScriptErrorBase() {}
|
||||
|
||||
|
|
@ -63,7 +62,7 @@ void nsScriptErrorBase::InitializeOnMainThread() {
|
|||
if (window) {
|
||||
nsPIDOMWindowOuter* outer = window->GetOuterWindow();
|
||||
if (outer) mOuterWindowID = outer->WindowID();
|
||||
mIsFromChromeContext = ComputeIsFromChromeContext(window);
|
||||
|
||||
mIsFromPrivateWindow = ComputeIsFromPrivateWindow(window);
|
||||
}
|
||||
}
|
||||
|
|
@ -205,15 +204,13 @@ NS_IMETHODIMP
|
|||
nsScriptErrorBase::Init(const nsAString& message, const nsAString& sourceName,
|
||||
const nsAString& sourceLine, uint32_t lineNumber,
|
||||
uint32_t columnNumber, uint32_t flags,
|
||||
const char* category, bool fromPrivateWindow,
|
||||
bool fromChromeContext) {
|
||||
const char* category, bool fromPrivateWindow) {
|
||||
InitializationHelper(message, sourceLine, lineNumber, columnNumber, flags,
|
||||
category ? nsDependentCString(category) : EmptyCString(),
|
||||
0 /* inner Window ID */);
|
||||
AssignSourceNameHelper(mSourceName, sourceName);
|
||||
|
||||
mIsFromPrivateWindow = fromPrivateWindow;
|
||||
mIsFromChromeContext = fromChromeContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -383,18 +380,6 @@ nsScriptErrorBase::GetTimeWarpTarget(uint64_t* aTarget) {
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptErrorBase::GetIsFromChromeContext(bool* aIsFromChromeContext) {
|
||||
NS_WARNING_ASSERTION(NS_IsMainThread() || mInitializedOnMainThread,
|
||||
"This can't be safely determined off the main thread, "
|
||||
"returning an inaccurate value!");
|
||||
if (!mInitializedOnMainThread && NS_IsMainThread()) {
|
||||
InitializeOnMainThread();
|
||||
}
|
||||
*aIsFromChromeContext = mIsFromChromeContext;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsScriptErrorBase::GetNotes(nsIArray** aNotes) {
|
||||
nsresult rv = NS_OK;
|
||||
|
|
@ -418,13 +403,6 @@ bool nsScriptErrorBase::ComputeIsFromPrivateWindow(
|
|||
!nsContentUtils::IsSystemPrincipal(winPrincipal);
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool nsScriptErrorBase::ComputeIsFromChromeContext(
|
||||
nsGlobalWindowInner* aWindow) {
|
||||
nsIPrincipal* winPrincipal = aWindow->GetPrincipal();
|
||||
return nsContentUtils::IsSystemPrincipal(winPrincipal);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsScriptError, nsIConsoleMessage, nsIScriptError)
|
||||
|
||||
nsScriptErrorNote::nsScriptErrorNote()
|
||||
|
|
|
|||
|
|
@ -54,8 +54,6 @@ class nsScriptErrorBase : public nsIScriptError {
|
|||
|
||||
static bool ComputeIsFromPrivateWindow(nsGlobalWindowInner* aWindow);
|
||||
|
||||
static bool ComputeIsFromChromeContext(nsGlobalWindowInner* aWindow);
|
||||
|
||||
protected:
|
||||
virtual ~nsScriptErrorBase();
|
||||
|
||||
|
|
@ -82,11 +80,10 @@ class nsScriptErrorBase : public nsIScriptError {
|
|||
uint64_t mInnerWindowID;
|
||||
int64_t mTimeStamp;
|
||||
uint64_t mTimeWarpTarget;
|
||||
// mInitializedOnMainThread, mIsFromPrivateWindow and mIsFromChromeContext are
|
||||
// set on the main thread from InitializeOnMainThread().
|
||||
// mInitializedOnMainThread and mIsFromPrivateWindow are set on the main
|
||||
// thread from InitializeOnMainThread().
|
||||
mozilla::Atomic<bool> mInitializedOnMainThread;
|
||||
bool mIsFromPrivateWindow;
|
||||
bool mIsFromChromeContext;
|
||||
};
|
||||
|
||||
class nsScriptError final : public nsScriptErrorBase {
|
||||
|
|
|
|||
|
|
@ -1276,7 +1276,6 @@ void Console::ProfileMethodMainthread(JSContext* aCx, const nsAString& aAction,
|
|||
|
||||
RootedDictionary<ConsoleProfileEvent> event(aCx);
|
||||
event.mAction = aAction;
|
||||
event.mChromeContext = nsContentUtils::ThreadsafeIsSystemCaller(aCx);
|
||||
|
||||
event.mArguments.Construct();
|
||||
Sequence<JS::Value>& sequence = event.mArguments.Value();
|
||||
|
|
@ -1684,8 +1683,6 @@ bool Console::PopulateConsoleNotificationInTheTargetScope(
|
|||
event.mID.Construct();
|
||||
event.mInnerID.Construct();
|
||||
|
||||
event.mChromeContext = nsContentUtils::ThreadsafeIsSystemCaller(aCx);
|
||||
|
||||
if (aData->mIDType == ConsoleCallData::eString) {
|
||||
event.mID.Value().SetAsString() = aData->mOuterIDString;
|
||||
event.mInnerID.Value().SetAsString() = aData->mInnerIDString;
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ ConsoleLogLevel PrefToValue(const nsAString& aPref) {
|
|||
"Console.maxLogLevelPref used with a non-existing pref: ");
|
||||
message.Append(aPref);
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false,
|
||||
true /* from chrome context*/);
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false);
|
||||
return ConsoleLogLevel::All;
|
||||
}
|
||||
|
||||
|
|
@ -51,8 +50,7 @@ ConsoleLogLevel PrefToValue(const nsAString& aPref) {
|
|||
message.AssignLiteral("Invalid Console.maxLogLevelPref value: ");
|
||||
message.Append(NS_ConvertUTF8toUTF16(value));
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false,
|
||||
true /* from chrome context*/);
|
||||
nsContentUtils::LogSimpleConsoleError(message, "chrome", false);
|
||||
return ConsoleLogLevel::All;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ consoleListener.prototype = {
|
|||
observe(aSubject, aTopic, aData) {
|
||||
if (aTopic == "console-api-log-event") {
|
||||
var obj = aSubject.wrappedJSObject;
|
||||
ok(!obj.chromeContext, "Thils is not a chrome context");
|
||||
if (order + 1 == parseInt(obj.arguments[0])) {
|
||||
ok(true, "Message received: " + obj.arguments[0]);
|
||||
order++;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ function consoleListener(expected) {
|
|||
let observer = {
|
||||
observe: function listener(aSubject, aTopic, aData) {
|
||||
var obj = aSubject.wrappedJSObject;
|
||||
ok(!obj.chromeContext, "This is not a chrome context");
|
||||
messages.push(parseInt(obj.arguments[0]));
|
||||
if (messages.length == expected) {
|
||||
SpecialPowers.removeObserver(observer, "console-api-log-event");
|
||||
|
|
|
|||
|
|
@ -34,8 +34,6 @@ consoleListener.prototype = {
|
|||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "console-api-log-event") {
|
||||
var obj = aSubject.wrappedJSObject;
|
||||
ok(obj.chromeContext, "JSM is always a chrome context");
|
||||
|
||||
if (obj.innerID == JSM) {
|
||||
is(obj.ID, "jsm", "ID and InnerID are correctly set.");
|
||||
is(obj.arguments[0], "Hello world!", "Message matches");
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
|||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(
|
||||
nsPrintfCString("IndexedDB %s: %s:%" PRIu32, aStr, aFile, aLine)),
|
||||
"indexedDB", false /* no IDB in private window */,
|
||||
true /* Internal errors are chrome context only */);
|
||||
"indexedDB", false /* no IDB in private window */);
|
||||
}
|
||||
|
||||
} // namespace indexedDB
|
||||
|
|
|
|||
|
|
@ -111,8 +111,7 @@ class ScriptErrorRunnable final : public mozilla::Runnable {
|
|||
aMessage, aFilename,
|
||||
/* aSourceLine */ EmptyString(), aLineNumber, aColumnNumber,
|
||||
aSeverityFlag, category.get(),
|
||||
/* IDB doesn't run on Private browsing mode */ false,
|
||||
/* from chrome context */ aIsChrome));
|
||||
/* IDB doesn't run on Private browsing mode */ false));
|
||||
}
|
||||
|
||||
MOZ_ALWAYS_SUCCEEDS(consoleService->LogMessage(scriptError));
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
|
|||
nsAutoString msg, sourceName, sourceLine;
|
||||
nsCString category;
|
||||
uint32_t lineNum, colNum, flags;
|
||||
bool fromPrivateWindow, fromChromeContext;
|
||||
bool fromPrivateWindow;
|
||||
|
||||
nsresult rv = scriptError->GetErrorMessage(msg);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
@ -465,8 +465,6 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = scriptError->GetIsFromPrivateWindow(&fromPrivateWindow);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = scriptError->GetIsFromChromeContext(&fromChromeContext);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
{
|
||||
AutoJSAPI jsapi;
|
||||
|
|
@ -498,15 +496,15 @@ ConsoleListener::Observe(nsIConsoleMessage* aMessage) {
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mChild->SendScriptErrorWithStack(
|
||||
msg, sourceName, sourceLine, lineNum, colNum, flags, category,
|
||||
fromPrivateWindow, fromChromeContext, cloned);
|
||||
mChild->SendScriptErrorWithStack(msg, sourceName, sourceLine, lineNum,
|
||||
colNum, flags, category,
|
||||
fromPrivateWindow, cloned);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
mChild->SendScriptError(msg, sourceName, sourceLine, lineNum, colNum, flags,
|
||||
category, fromPrivateWindow, fromChromeContext);
|
||||
category, fromPrivateWindow);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -1757,9 +1755,9 @@ bool ContentChild::SendPBrowserConstructor(
|
|||
return false;
|
||||
}
|
||||
|
||||
return PContentChild::SendPBrowserConstructor(
|
||||
aActor, aTabId, aSameTabGroupAs, aContext, aChromeFlags, aCpID,
|
||||
aBrowsingContext, aIsForBrowser);
|
||||
return PContentChild::SendPBrowserConstructor(aActor, aTabId, aSameTabGroupAs,
|
||||
aContext, aChromeFlags, aCpID,
|
||||
aBrowsingContext, aIsForBrowser);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentChild::RecvPBrowserConstructor(
|
||||
|
|
@ -3757,8 +3755,7 @@ mozilla::ipc::IPCResult ContentChild::RecvRegisterBrowsingContextGroup(
|
|||
MOZ_ASSERT_IF(parent, parent->Group() == group);
|
||||
#endif
|
||||
|
||||
RefPtr<BrowsingContext> ctxt =
|
||||
BrowsingContext::CreateFromIPC(std::move(init), group, nullptr);
|
||||
RefPtr<BrowsingContext> ctxt = BrowsingContext::CreateFromIPC(std::move(init), group, nullptr);
|
||||
|
||||
// FIXME: We should deal with cached & detached contexts as well.
|
||||
ctxt->Attach(/* aFromIPC */ true);
|
||||
|
|
|
|||
|
|
@ -4095,11 +4095,10 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptError(
|
|||
const nsString& aMessage, const nsString& aSourceName,
|
||||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow,
|
||||
const bool& aFromChromeContext) {
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow) {
|
||||
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
|
||||
aLineNumber, aColNumber, aFlags, aCategory,
|
||||
aFromPrivateWindow, aFromChromeContext);
|
||||
aFromPrivateWindow);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorWithStack(
|
||||
|
|
@ -4107,10 +4106,10 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorWithStack(
|
|||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow,
|
||||
const bool& aFromChromeContext, const ClonedMessageData& aFrame) {
|
||||
return RecvScriptErrorInternal(
|
||||
aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber, aFlags,
|
||||
aCategory, aFromPrivateWindow, aFromChromeContext, &aFrame);
|
||||
const ClonedMessageData& aFrame) {
|
||||
return RecvScriptErrorInternal(aMessage, aSourceName, aSourceLine,
|
||||
aLineNumber, aColNumber, aFlags, aCategory,
|
||||
aFromPrivateWindow, &aFrame);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
|
||||
|
|
@ -4118,7 +4117,7 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
|
|||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aFromPrivateWindow,
|
||||
const bool& aFromChromeContext, const ClonedMessageData* aStack) {
|
||||
const ClonedMessageData* aStack) {
|
||||
RefPtr<nsConsoleService> consoleService = GetConsoleService();
|
||||
if (!consoleService) {
|
||||
return IPC_OK();
|
||||
|
|
@ -4153,9 +4152,9 @@ mozilla::ipc::IPCResult ContentParent::RecvScriptErrorInternal(
|
|||
msg = new nsScriptError();
|
||||
}
|
||||
|
||||
nsresult rv = msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber,
|
||||
aColNumber, aFlags, aCategory.get(),
|
||||
aFromPrivateWindow, aFromChromeContext);
|
||||
nsresult rv =
|
||||
msg->Init(aMessage, aSourceName, aSourceLine, aLineNumber, aColNumber,
|
||||
aFlags, aCategory.get(), aFromPrivateWindow);
|
||||
if (NS_FAILED(rv)) return IPC_OK();
|
||||
|
||||
consoleService->LogMessageWithMode(msg, nsConsoleService::SuppressLog);
|
||||
|
|
|
|||
|
|
@ -1007,15 +1007,14 @@ class ContentParent final : public PContentParent,
|
|||
const nsString& aMessage, const nsString& aSourceName,
|
||||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow,
|
||||
const bool& aIsFromChromeContext);
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow);
|
||||
|
||||
mozilla::ipc::IPCResult RecvScriptErrorWithStack(
|
||||
const nsString& aMessage, const nsString& aSourceName,
|
||||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow,
|
||||
const bool& aIsFromChromeContext, const ClonedMessageData& aStack);
|
||||
const ClonedMessageData& aStack);
|
||||
|
||||
private:
|
||||
mozilla::ipc::IPCResult RecvScriptErrorInternal(
|
||||
|
|
@ -1023,7 +1022,6 @@ class ContentParent final : public PContentParent,
|
|||
const nsString& aSourceLine, const uint32_t& aLineNumber,
|
||||
const uint32_t& aColNumber, const uint32_t& aFlags,
|
||||
const nsCString& aCategory, const bool& aIsFromPrivateWindow,
|
||||
const bool& aIsFromChromeContext,
|
||||
const ClonedMessageData* aStack = nullptr);
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -931,12 +931,11 @@ parent:
|
|||
async ConsoleMessage(nsString message);
|
||||
async ScriptError(nsString message, nsString sourceName, nsString sourceLine,
|
||||
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
|
||||
nsCString category, bool privateWindow,
|
||||
bool fromChromeContext);
|
||||
nsCString category, bool privateWindow);
|
||||
async ScriptErrorWithStack(nsString message, nsString sourceName, nsString sourceLine,
|
||||
uint32_t lineNumber, uint32_t colNumber, uint32_t flags,
|
||||
nsCString category, bool privateWindow,
|
||||
bool fromChromeContext, ClonedMessageData stack);
|
||||
ClonedMessageData stack);
|
||||
|
||||
// Places the items within dataTransfer on the clipboard.
|
||||
async SetClipboard(IPCDataTransfer aDataTransfer,
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
|||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(
|
||||
nsPrintfCString("LocalStorage %s: %s:%" PRIu32, aStr, aFile, aLine)),
|
||||
"localstorage", false, true /* Internal errors are chrome context only*/);
|
||||
"localstorage", false);
|
||||
}
|
||||
|
||||
} // namespace localstorage
|
||||
|
|
|
|||
|
|
@ -1369,8 +1369,8 @@ void ReportInternalError(const char* aFile, uint32_t aLine, const char* aStr) {
|
|||
nsContentUtils::LogSimpleConsoleError(
|
||||
NS_ConvertUTF8toUTF16(
|
||||
nsPrintfCString("Quota %s: %s:%" PRIu32, aStr, aFile, aLine)),
|
||||
"quota", false /* Quota Manager is not active in private browsing mode */,
|
||||
true /* Quota Manager runs always in a chrome context */);
|
||||
"quota",
|
||||
false /* Quota Manager is not active in private browsing mode */);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
|
|||
|
|
@ -159,8 +159,7 @@ void CSP_LogMessage(const nsAString& aMessage, const nsAString& aSourceName,
|
|||
aInnerWindowID);
|
||||
} else {
|
||||
rv = error->Init(cspMsg, aSourceName, aSourceLine, aLineNumber,
|
||||
aColumnNumber, aFlags, category.get(), aFromPrivateWindow,
|
||||
true /* from chrome context */);
|
||||
aColumnNumber, aFlags, category.get(), aFromPrivateWindow);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -107,14 +107,12 @@ dictionary ConsoleEvent {
|
|||
any timer = null;
|
||||
any counter = null;
|
||||
DOMString prefix = "";
|
||||
boolean chromeContext = false;
|
||||
};
|
||||
|
||||
// Event for profile operations
|
||||
dictionary ConsoleProfileEvent {
|
||||
DOMString action = "";
|
||||
sequence<any> arguments;
|
||||
boolean chromeContext = false;
|
||||
};
|
||||
|
||||
// This dictionary is used to manage stack trace data.
|
||||
|
|
|
|||
|
|
@ -102,7 +102,6 @@ class WebSocketImpl final : public nsIInterfaceRequestor,
|
|||
mScriptColumn(0),
|
||||
mInnerWindowID(0),
|
||||
mPrivateBrowsing(false),
|
||||
mIsChromeContext(false),
|
||||
mIsMainThread(true),
|
||||
mMutex("WebSocketImpl::mMutex"),
|
||||
mWorkerShuttingDown(false) {
|
||||
|
|
@ -202,7 +201,6 @@ class WebSocketImpl final : public nsIInterfaceRequestor,
|
|||
uint32_t mScriptColumn;
|
||||
uint64_t mInnerWindowID;
|
||||
bool mPrivateBrowsing;
|
||||
bool mIsChromeContext;
|
||||
|
||||
RefPtr<ThreadSafeWorkerRef> mWorkerRef;
|
||||
|
||||
|
|
@ -346,7 +344,7 @@ void WebSocketImpl::PrintErrorOnConsole(const char* aBundleURI,
|
|||
rv = errorObject->Init(message, NS_ConvertUTF8toUTF16(mScriptFile),
|
||||
EmptyString(), mScriptLine, mScriptColumn,
|
||||
nsIScriptError::errorFlag, "Web Socket",
|
||||
mPrivateBrowsing, mIsChromeContext);
|
||||
mPrivateBrowsing);
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
|
@ -1506,7 +1504,6 @@ nsresult WebSocketImpl::Init(JSContext* aCx, nsIPrincipal* aLoadingPrincipal,
|
|||
}
|
||||
|
||||
mPrivateBrowsing = !!aPrincipal->OriginAttributesRef().mPrivateBrowsingId;
|
||||
mIsChromeContext = nsContentUtils::IsSystemPrincipal(aPrincipal);
|
||||
|
||||
// parses the url
|
||||
rv = ParseURL(aURL);
|
||||
|
|
|
|||
|
|
@ -98,8 +98,7 @@ bool JavaScriptParent::allowMessage(JSContext* cx) {
|
|||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||
error->Init(NS_LITERAL_STRING("unsafe/forbidden CPOW usage"), filename,
|
||||
EmptyString(), lineno, column, nsIScriptError::warningFlag,
|
||||
"chrome javascript", false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
"chrome javascript", false /* from private window */);
|
||||
console->LogMessage(error);
|
||||
} else {
|
||||
NS_WARNING("Unsafe synchronous IPC message");
|
||||
|
|
|
|||
|
|
@ -240,8 +240,7 @@ already_AddRefed<XPCNativeInterface> XPCNativeInterface::NewInstance(
|
|||
do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||
error->Init(NS_ConvertUTF8toUTF16(errorMsg), filename, EmptyString(),
|
||||
lineno, column, nsIScriptError::warningFlag,
|
||||
"chrome javascript", false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
"chrome javascript", false /* from private window */);
|
||||
console->LogMessage(error);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3862,10 +3862,8 @@ HttpChannelChild::LogBlockedCORSRequest(const nsAString& aMessage,
|
|||
uint64_t innerWindowID = mLoadInfo->GetInnerWindowID();
|
||||
bool privateBrowsing =
|
||||
!!mLoadInfo->GetOriginAttributes().mPrivateBrowsingId;
|
||||
bool fromChromeContext =
|
||||
nsContentUtils::IsSystemPrincipal(mLoadInfo->TriggeringPrincipal());
|
||||
nsCORSListenerProxy::LogBlockedCORSRequest(
|
||||
innerWindowID, privateBrowsing, fromChromeContext, aMessage, aCategory);
|
||||
nsCORSListenerProxy::LogBlockedCORSRequest(innerWindowID, privateBrowsing,
|
||||
aMessage, aCategory);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,13 +103,6 @@ static void LogBlockedRequest(nsIRequest* aRequest, const char* aProperty,
|
|||
privateBrowsing = nsContentUtils::IsInPrivateBrowsing(loadGroup);
|
||||
}
|
||||
|
||||
bool fromChromeContext = false;
|
||||
if (channel) {
|
||||
nsCOMPtr<nsILoadInfo> loadInfo = channel->LoadInfo();
|
||||
fromChromeContext =
|
||||
nsContentUtils::IsSystemPrincipal(loadInfo->TriggeringPrincipal());
|
||||
}
|
||||
|
||||
// we are passing aProperty as the category so we can link to the
|
||||
// appropriate MDN docs depending on the specific error.
|
||||
uint64_t innerWindowID = nsContentUtils::GetInnerWindowID(aRequest);
|
||||
|
|
@ -123,7 +116,7 @@ static void LogBlockedRequest(nsIRequest* aRequest, const char* aProperty,
|
|||
}
|
||||
}
|
||||
nsCORSListenerProxy::LogBlockedCORSRequest(innerWindowID, privateBrowsing,
|
||||
fromChromeContext, msg, category);
|
||||
msg, category);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -1525,7 +1518,6 @@ nsresult nsCORSListenerProxy::StartCORSPreflight(
|
|||
// static
|
||||
void nsCORSListenerProxy::LogBlockedCORSRequest(uint64_t aInnerWindowID,
|
||||
bool aPrivateBrowsing,
|
||||
bool aFromChromeContext,
|
||||
const nsAString& aMessage,
|
||||
const nsACString& aCategory) {
|
||||
nsresult rv = NS_OK;
|
||||
|
|
@ -1563,8 +1555,7 @@ void nsCORSListenerProxy::LogBlockedCORSRequest(uint64_t aInnerWindowID,
|
|||
0, // lineNumber
|
||||
0, // columnNumber
|
||||
nsIScriptError::warningFlag, category.get(),
|
||||
aPrivateBrowsing,
|
||||
aFromChromeContext); // From chrome context
|
||||
aPrivateBrowsing);
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING(
|
||||
|
|
|
|||
|
|
@ -68,7 +68,6 @@ class nsCORSListenerProxy final : public nsIStreamListener,
|
|||
// browser console if no valid inner window ID is found.
|
||||
static void LogBlockedCORSRequest(uint64_t aInnerWindowID,
|
||||
bool aPrivateBrowsing,
|
||||
bool aFromChromeContext,
|
||||
const nsAString& aMessage,
|
||||
const nsACString& aCategory);
|
||||
|
||||
|
|
|
|||
|
|
@ -1330,8 +1330,7 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) {
|
|||
msg.AppendLiteral(" : server does not support RFC 5746, see CVE-2009-3555");
|
||||
|
||||
nsContentUtils::LogSimpleConsoleError(
|
||||
msg, "SSL", !!infoObject->GetOriginAttributes().mPrivateBrowsingId,
|
||||
true /* from chrome context */);
|
||||
msg, "SSL", !!infoObject->GetOriginAttributes().mPrivateBrowsingId);
|
||||
}
|
||||
|
||||
infoObject->NoteTimeUntilReady();
|
||||
|
|
|
|||
|
|
@ -114,8 +114,7 @@ void LogToBrowserConsole(uint32_t aLogLevel, const nsAString& aMsg) {
|
|||
|
||||
nsCOMPtr<nsIScriptError> error(do_CreateInstance(NS_SCRIPTERROR_CONTRACTID));
|
||||
error->Init(aMsg, EmptyString(), EmptyString(), 0, 0, aLogLevel,
|
||||
"chrome javascript", false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
"chrome javascript", false /* from private window */);
|
||||
console->LogMessage(error);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -540,7 +540,6 @@ function sendConsoleAPIMessage(aConsole, aLevel, aFrame, aArgs, aOptions = {}) {
|
|||
timeStamp: Date.now(),
|
||||
arguments: aArgs,
|
||||
prefix: aConsole.prefix,
|
||||
chromeContext: true,
|
||||
};
|
||||
|
||||
consoleEvent.wrappedJSObject = consoleEvent;
|
||||
|
|
@ -699,7 +698,6 @@ ConsoleAPI.prototype = {
|
|||
wrappedJSObject: {
|
||||
action: "profile",
|
||||
arguments: [ profileName ],
|
||||
chromeContext: true,
|
||||
},
|
||||
}, "console-api-profiler");
|
||||
dumpMessage(this, "profile", `'${profileName}'`);
|
||||
|
|
@ -713,7 +711,6 @@ ConsoleAPI.prototype = {
|
|||
wrappedJSObject: {
|
||||
action: "profileEnd",
|
||||
arguments: [ profileName ],
|
||||
chromeContext: true,
|
||||
},
|
||||
}, "console-api-profiler");
|
||||
dumpMessage(this, "profileEnd", `'${profileName}'`);
|
||||
|
|
|
|||
|
|
@ -158,8 +158,7 @@ void LogMessageWithContext(FileLocation& aFile, uint32_t aLineNumber,
|
|||
nsresult rv = error->Init(
|
||||
NS_ConvertUTF8toUTF16(formatted.get()), NS_ConvertUTF8toUTF16(file),
|
||||
EmptyString(), aLineNumber, 0, nsIScriptError::warningFlag,
|
||||
"chrome registration", false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
"chrome registration", false /* from private window */);
|
||||
if (NS_FAILED(rv)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,8 +195,7 @@ nsresult nsObserverService::FilterHttpOnTopics(const char* aTopic) {
|
|||
error->Init(NS_LITERAL_STRING(
|
||||
"http-on-* observers only work in the parent process"),
|
||||
EmptyString(), EmptyString(), 0, 0, nsIScriptError::warningFlag,
|
||||
"chrome javascript", false /* from private window */,
|
||||
true /* from chrome context */);
|
||||
"chrome javascript", false /* from private window */);
|
||||
console->LogMessage(error);
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
|
|
|||
Loading…
Reference in a new issue