Backed out changeset 2aa62db58f24 (bug 673919) due to Web compat

This commit is contained in:
Masatoshi Kimura 2013-08-01 06:44:51 +09:00
parent 7a902e12eb
commit a7c7daa22e
8 changed files with 114 additions and 3 deletions

View File

@ -145,6 +145,15 @@ static bool ConvertToMidasInternalCommand(const nsAString & inCommandID,
// ==================================================================
// =
// ==================================================================
static void
ReportUseOfDeprecatedMethod(nsHTMLDocument* aDoc, const char* aWarning)
{
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", aDoc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
static nsresult
RemoveFromAgentSheets(nsCOMArray<nsIStyleSheet> &aAgentSheets, const nsAString& url)
{
@ -2238,6 +2247,27 @@ nsHTMLDocument::GetSelection(ErrorResult& rv)
return sel.forget();
}
NS_IMETHODIMP
nsHTMLDocument::CaptureEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDocument::ReleaseEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsHTMLDocument::RouteEvent(nsIDOMEvent* aEvt)
{
ReportUseOfDeprecatedMethod(this, "UseOfRouteEventWarning");
return NS_OK;
}
// Mapped to document.embeds for NS4 compatibility
NS_IMETHODIMP
nsHTMLDocument::GetPlugins(nsIDOMHTMLCollection** aPlugins)

View File

@ -104,6 +104,11 @@ public:
// nsIDOMHTMLDocument interface
NS_DECL_NSIDOMHTMLDOCUMENT
void RouteEvent(nsDOMEvent& aEvent)
{
RouteEvent(&aEvent);
}
/**
* Returns the result of document.all[aID] which can either be a node
* or a nodelist depending on if there are multiple nodes with the same
@ -242,6 +247,9 @@ public:
// Deprecated
}
already_AddRefed<nsISelection> GetSelection(mozilla::ErrorResult& rv);
// The XPCOM CaptureEvents works fine for us.
// The XPCOM ReleaseEvents works fine for us.
// The XPCOM RouteEvent works fine for us.
// We're picking up GetLocation from Document
already_AddRefed<nsIDOMLocation> GetLocation() const {
return nsIDocument::GetLocation();

View File

@ -6232,6 +6232,49 @@ nsGlobalWindow::SetResizable(bool aResizable)
return NS_OK;
}
static void
ReportUseOfDeprecatedMethod(nsGlobalWindow* aWindow, const char* aWarning)
{
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
"DOM Events", doc,
nsContentUtils::eDOM_PROPERTIES,
aWarning);
}
NS_IMETHODIMP
nsGlobalWindow::CaptureEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfCaptureEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::ReleaseEvents(int32_t aEventFlags)
{
ReportUseOfDeprecatedMethod(this, "UseOfReleaseEventsWarning");
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::RouteEvent(nsIDOMEvent* aEvt)
{
ReportUseOfDeprecatedMethod(this, "UseOfRouteEventWarning");
return NS_OK;
}
NS_IMETHODIMP
nsGlobalWindow::EnableExternalCapture()
{
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsGlobalWindow::DisableExternalCapture()
{
return NS_ERROR_FAILURE;
}
static
bool IsPopupBlocked(nsIDocument* aDoc)
{

View File

@ -5,7 +5,7 @@
#include "domstubs.idl"
[scriptable, uuid(f28c92a2-302a-4448-b589-46af599de352)]
[scriptable, uuid(80adc1fe-c0a0-44f7-8a0e-d3d928e2ecc9)]
interface nsIDOMJSWindow : nsISupports
{
void dump(in DOMString str);
@ -33,6 +33,16 @@ interface nsIDOMJSWindow : nsISupports
*/
void setResizable(in boolean resizable);
/**
* @deprecated These are old Netscape 4 methods. Do not use,
* the implementation is no-op.
*/
void captureEvents(in long eventFlags);
void releaseEvents(in long eventFlags);
void routeEvent(in nsIDOMEvent evt);
void enableExternalCapture();
void disableExternalCapture();
/**
* This is the scriptable version of nsIDOMWindow::open()
* that takes 3 optional arguments. Its binary name is OpenJS to

View File

@ -13,7 +13,7 @@
*/
interface nsISelection;
[scriptable, uuid(cb0cc619-5862-4e00-86d3-dca3c6ecc34b)]
[scriptable, uuid(bd920ed4-ddc6-46db-bd4d-d1ddc0692ad4)]
interface nsIDOMHTMLDocument : nsIDOMDocument
{
attribute DOMString domain;
@ -88,4 +88,14 @@ interface nsIDOMHTMLDocument : nsIDOMDocument
// DOM Range
nsISelection getSelection();
// Mozilla extensions
/**
* @deprecated These are old Netscape 4 methods. Do not use,
* the implementation is no-op.
*/
void captureEvents(in long eventFlags);
void releaseEvents(in long eventFlags);
void routeEvent(in nsIDOMEvent evt);
};

View File

@ -16,6 +16,9 @@ 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
UseOfRouteEventWarning=Use of routeEvent() is deprecated. To upgrade your code, use the DOM 2 dispatchEvent() method. For more help http://developer.mozilla.org/en/docs/DOM:element.dispatchEvent
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().

View File

@ -71,4 +71,11 @@ interface HTMLDocument : Document {
// https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections
[Throws]
Selection getSelection();
// @deprecated These are old Netscape 4 methods. Do not use,
// the implementation is no-op.
// XXXbz do we actually need these anymore?
void captureEvents(long eventFlags);
void releaseEvents(long eventFlags);
void routeEvent(Event evt);
};

View File

@ -8,7 +8,7 @@ function boom()
var frame = document.getElementById("frame");
var frameWin = frame.contentWindow;
var frameWinner = Object.create(frameWin);
var v = frameWinner.clearTimeout.bind(frameWinner);
var v = frameWinner.captureEvents.bind(frameWinner);
frame.src = "local-file-not-found";
setTimeout(function() { setTimeout(finish); v(0); });
}