Bug 933563 - Consolidate ReportUseOfDeprecatedMethod and WarnOnceAbout. r=sicking, r=ms2ger

This commit is contained in:
Vendelin Ruzicka 2013-11-11 16:12:18 -05:00
parent 4c2b6b9015
commit be972363d7
5 changed files with 20 additions and 36 deletions

View File

@ -34,4 +34,7 @@ DEPRECATED_OPERATION(LenientThis)
DEPRECATED_OPERATION(GetPreventDefault)
DEPRECATED_OPERATION(GetSetUserData)
DEPRECATED_OPERATION(MozGetAsFile)
DEPRECATED_OPERATION(UseOfCaptureEvents)
DEPRECATED_OPERATION(UseOfReleaseEvents)
DEPRECATED_OPERATION(UseOfDOM3LoadMethod)
DEPRECATED_OPERATION(ShowModalDialog)

View File

@ -143,15 +143,6 @@ static bool ConvertToMidasInternalCommand(const nsAString & inCommandID,
// ==================================================================
// =
// ==================================================================
static void
ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("DOM Events"), aDoc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
static nsresult
RemoveFromAgentSheets(nsCOMArray<nsIStyleSheet> &aAgentSheets, const nsAString& url)
{
@ -2134,14 +2125,14 @@ nsHTMLDocument::GetSelection(ErrorResult& rv)
NS_IMETHODIMP
nsHTMLDocument::CaptureEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
WarnOnceAbout(nsIDocument::eUseOfCaptureEvents);
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDocument::ReleaseEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
WarnOnceAbout(nsIDocument::eUseOfReleaseEvents);
return NS_OK;
}

View File

@ -274,15 +274,6 @@ XMLDocument::SetAsync(bool aAsync)
return NS_OK;
}
static void
ReportUseOfDeprecatedMethod(nsIDocument *aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("DOM3 Load"), aDoc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
NS_IMETHODIMP
XMLDocument::Load(const nsAString& aUrl, bool *aReturn)
{
@ -302,7 +293,7 @@ XMLDocument::Load(const nsAString& aUrl, ErrorResult& aRv)
return false;
}
ReportUseOfDeprecatedMethod(this, "UseOfDOM3LoadMethodWarning");
WarnOnceAbout(nsIDocument::eUseOfDOM3LoadMethod);
nsCOMPtr<nsIDocument> callingDoc = nsContentUtils::GetDocumentFromContext();

View File

@ -6962,27 +6962,23 @@ nsGlobalWindow::SetResizable(bool aResizable)
return NS_OK;
}
static void
ReportUseOfDeprecatedMethod(nsGlobalWindow* aWindow, const char* aWarning)
{
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("DOM Events"), doc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
NS_IMETHODIMP
nsGlobalWindow::CaptureEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
if (mDoc) {
mDoc->WarnOnceAbout(nsIDocument::eUseOfCaptureEvents);
}
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::ReleaseEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
if (mDoc) {
mDoc->WarnOnceAbout(nsIDocument::eUseOfReleaseEvents);
}
return NS_OK;
}

View File

@ -16,9 +16,6 @@ OnBeforeUnloadTitle=Are you sure?
OnBeforeUnloadMessage=This page is asking you to confirm that you want to leave - data you have entered may not be saved.
OnBeforeUnloadStayButton=Stay on Page
OnBeforeUnloadLeaveButton=Leave Page
UseOfCaptureEventsWarning=Use of captureEvents() is deprecated. To upgrade your code, use the DOM 2 addEventListener() method. For more help http://developer.mozilla.org/en/docs/DOM:element.addEventListener
UseOfReleaseEventsWarning=Use of releaseEvents() is deprecated. To upgrade your code, use the DOM 2 removeEventListener() method. For more help http://developer.mozilla.org/en/docs/DOM:element.removeEventListener
UseOfDOM3LoadMethodWarning=Use of Document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest
UnexpectedCanvasVariantStyle=canvas: an attempt to set strokeStyle or fillStyle to a value that is neither a string, a CanvasGradient, or a CanvasPattern was ignored.
EmptyGetElementByIdParam=Empty string passed to getElementById().
LowMemoryTitle=Warning: Low memory
@ -137,5 +134,11 @@ GetPreventDefaultWarning=Use of getPreventDefault() is deprecated. Use defaultP
GetSetUserDataWarning=Use of getUserData() or setUserData() is deprecated. Use WeakMap or element.dataset instead.
# LOCALIZATION NOTE: Do not translate "mozGetAsFile" or "toBlob"
MozGetAsFileWarning=The non-standard mozGetAsFile method is deprecated and will soon be removed. Use the standard toBlob method instead.
# LOCALIZATION NOTE: Do not translate "captureEvents()" or "addEventListener()"
UseOfCaptureEventsWarning=Use of captureEvents() is deprecated. To upgrade your code, use the DOM 2 addEventListener() method. For more help http://developer.mozilla.org/en/docs/DOM:element.addEventListener
# LOCALIZATION NOTE: Do not translate "releaseEvents()" or "removeEventListener()"
UseOfReleaseEventsWarning=Use of releaseEvents() is deprecated. To upgrade your code, use the DOM 2 removeEventListener() method. For more help http://developer.mozilla.org/en/docs/DOM:element.removeEventListener
# LOCALIZATION NOTE: Do not translate "document.load()" or "XMLHttpRequest"
UseOfDOM3LoadMethodWarning=Use of document.load() is deprecated. To upgrade your code, use the DOM XMLHttpRequest object. For more help https://developer.mozilla.org/en/XMLHttpRequest
# LOCALIZATION NOTE: Do not translate "window.showModalDialog()" or "window.open()"
ShowModalDialogWarning=Use of window.showModalDialog() is deprecated. Use window.open() instead. For more help https://developer.mozilla.org/en-US/docs/Web/API/Window.open