зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1003797. Fire error events for <object> per spec. r=qdot
This commit is contained in:
Родитель
5254910dfb
Коммит
d157959ac1
|
@ -82,6 +82,7 @@
|
|||
#include "mozilla/dom/Event.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/PluginCrashedEvent.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
|
@ -2518,6 +2519,12 @@ nsObjectLoadingContent::LoadObject(bool aNotify,
|
|||
NS_ASSERTION(!mFrameLoader && !mInstanceOwner,
|
||||
"switched to type null but also loaded something");
|
||||
|
||||
// Don't fire error events if we're falling back to click-to-play; instead
|
||||
// pretend like this is a really slow-loading plug-in instead.
|
||||
if (fallbackType != eFallbackClickToPlay) {
|
||||
MaybeFireErrorEvent();
|
||||
}
|
||||
|
||||
if (mChannel) {
|
||||
// If we were loading with a channel but then failed over, throw it away
|
||||
CloseChannel();
|
||||
|
@ -3832,6 +3839,21 @@ nsObjectLoadingContent::GetOwnPropertyNames(JSContext* aCx,
|
|||
aRv = ScriptRequestPluginInstance(aCx, getter_AddRefs(pi));
|
||||
}
|
||||
|
||||
void
|
||||
nsObjectLoadingContent::MaybeFireErrorEvent()
|
||||
{
|
||||
nsCOMPtr<nsIContent> thisContent =
|
||||
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
|
||||
// Queue a task to fire an error event if we're an <object> element. The
|
||||
// queueing is important, since then we don't have to worry about reentry.
|
||||
if (thisContent->IsHTMLElement(nsGkAtoms::object)) {
|
||||
RefPtr<AsyncEventDispatcher> loadBlockingAsyncDispatcher =
|
||||
new LoadBlockingAsyncEventDispatcher(thisContent,
|
||||
NS_LITERAL_STRING("error"),
|
||||
false, false);
|
||||
loadBlockingAsyncDispatcher->PostDOMEvent();
|
||||
}
|
||||
}
|
||||
|
||||
// SetupProtoChainRunner implementation
|
||||
nsObjectLoadingContent::SetupProtoChainRunner::SetupProtoChainRunner(
|
||||
|
|
|
@ -577,6 +577,9 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||
JS::MutableHandle<JSObject*> plugin_obj,
|
||||
JS::MutableHandle<JSObject*> plugin_proto);
|
||||
|
||||
// Utility for firing an error event, if we're an <object>.
|
||||
void MaybeFireErrorEvent();
|
||||
|
||||
// The final listener for mChannel (uriloader, pluginstreamlistener, etc.)
|
||||
nsCOMPtr<nsIStreamListener> mFinalListener;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
[plugintypes-notype-data.sub.html]
|
||||
type: testharness
|
||||
[Expecting logs: ["PASS"\]]
|
||||
expected: NOTRUN
|
||||
|
||||
[Violation report status OK.]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[object-events.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[error event]
|
||||
expected: TIMEOUT
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: http-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: http-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: meta-csp\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: meta-csp\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[no-opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[no-opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[no-opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: no-opt-in\n origin: cross-origin-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[no-opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: keep-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[no-opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: no-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
[no-opt-in-blocks.https.html]
|
||||
type: testharness
|
||||
expected: TIMEOUT
|
||||
[opt_in_method: no-opt-in\n origin: same-host-http\n source_scheme: https\n context_nesting: top-level\n redirection: swap-scheme-redirect\n subresource: object-tag\n expectation: blocked]
|
||||
expected: NOTRUN
|
||||
|
|
@ -25,6 +25,21 @@ async_test(function(t) {
|
|||
document.body.appendChild(obj);
|
||||
}, "error event");
|
||||
|
||||
async_test(function(t) {
|
||||
var obj = document.createElement("object");
|
||||
obj.onerror = t.step_func_done(function(e){
|
||||
assert_equals(e.target, obj,
|
||||
"The error event should be fired on our element");
|
||||
});
|
||||
obj.onload = t.step_func_done(function(e){
|
||||
assert_unreached("The load event should not be fired.");
|
||||
});
|
||||
|
||||
obj.data = "http://test:test";
|
||||
document.body.appendChild(obj);
|
||||
}, "error event");
|
||||
|
||||
|
||||
async_test(function(t) {
|
||||
var obj = document.createElement("object");
|
||||
obj.onload = t.step_func_done(function(e){
|
||||
|
|
Загрузка…
Ссылка в новой задаче