зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1502802 - Implement PostMessageOptions for Window, r=smaug
This commit is contained in:
Родитель
4817d8d6c8
Коммит
70526c2e29
|
@ -4124,6 +4124,25 @@ nsGlobalWindowInner::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessa
|
|||
aSubjectPrincipal, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const WindowPostMessageOptions& aOptions,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
JS::Rooted<JS::Value> transferArray(aCx, JS::UndefinedValue());
|
||||
|
||||
aRv = nsContentUtils::CreateJSValueFromSequenceOfObject(aCx,
|
||||
aOptions.mTransfer,
|
||||
&transferArray);
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
PostMessageMoz(aCx, aMessage, aOptions.mTargetOrigin, transferArray,
|
||||
aSubjectPrincipal, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::Close(ErrorResult& aError)
|
||||
{
|
||||
|
|
|
@ -133,6 +133,7 @@ class WakeLock;
|
|||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
class WindowOrientationObserver;
|
||||
#endif
|
||||
struct WindowPostMessageOptions;
|
||||
class Worklet;
|
||||
namespace cache {
|
||||
class CacheStorage;
|
||||
|
@ -736,6 +737,10 @@ public:
|
|||
const mozilla::dom::Sequence<JSObject*>& aTransfer,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
mozilla::ErrorResult& aError);
|
||||
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const mozilla::dom::WindowPostMessageOptions& aOptions,
|
||||
nsIPrincipal& aSubjectPrincipal,
|
||||
mozilla::ErrorResult& aError);
|
||||
int32_t SetTimeout(JSContext* aCx, mozilla::dom::Function& aFunction,
|
||||
int32_t aTimeout,
|
||||
const mozilla::dom::Sequence<JS::Value>& aArguments,
|
||||
|
|
|
@ -362,13 +362,6 @@ var tests =
|
|||
source: "idnKidNoWhitelist",
|
||||
returnOrigin: "http://sub1.xn--exaple-kqf.test",
|
||||
},
|
||||
// 55
|
||||
{
|
||||
args: ["NOT-RECEIVED", undefined],
|
||||
source: "sameDomain",
|
||||
name: "SyntaxError",
|
||||
code: DOMException.SYNTAX_ERR
|
||||
},
|
||||
];
|
||||
|
||||
function allTests(callback)
|
||||
|
|
|
@ -85,6 +85,8 @@ typedef OfflineResourceList ApplicationCache;
|
|||
|
||||
[Throws, CrossOriginCallable, NeedsSubjectPrincipal]
|
||||
void postMessage(any message, DOMString targetOrigin, optional sequence<object> transfer = []);
|
||||
[Throws, CrossOriginCallable, NeedsSubjectPrincipal]
|
||||
void postMessage(any message, optional WindowPostMessageOptions options);
|
||||
|
||||
// also has obsolete members
|
||||
};
|
||||
|
@ -576,3 +578,7 @@ partial interface Window {
|
|||
readonly attribute VisualViewport visualViewport;
|
||||
|
||||
};
|
||||
|
||||
dictionary WindowPostMessageOptions : PostMessageOptions {
|
||||
USVString targetOrigin = "/";
|
||||
};
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
[appcache-iframe.https.html]
|
||||
expected: TIMEOUT
|
||||
[iframe should be loaded from application caches for fallback.]
|
||||
expected: NOTRUN
|
||||
|
||||
[iframe should be loaded from application caches.]
|
||||
expected: TIMEOUT
|
||||
|
|
@ -347,12 +347,6 @@
|
|||
[Window interface: window must inherit property "onunhandledrejection" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: operation postMessage(any, USVString, [object Object\])]
|
||||
expected: FAIL
|
||||
|
||||
[Window interface: operation postMessage(any, [object Object\], WindowPostMessageOptions)]
|
||||
expected: FAIL
|
||||
|
||||
[html interfaces]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[host-specific-origin.tentative.html]
|
||||
[resolving url with stuff in host-specific]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[message-channel-transferable.tentative.html]
|
||||
[MessageChannel's ports as MessagePort objects]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[no-target-origin.tentative.html]
|
||||
[no targetOrigin]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[null-transfer.tentative.html]
|
||||
[null transfer]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[one-arg.tentative.html]
|
||||
[just one argument]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[slash-origin.tentative.html]
|
||||
[special value '/']
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[undefined-transferable.tentative.html]
|
||||
[undefined as transferable]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[unknown-parameter.tentative.html]
|
||||
[unknown parameter]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[027.html]
|
||||
[message channel as ports]
|
||||
expected: FAIL
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
[second-argument-null.html]
|
||||
[Using null in postMessage's second argument]
|
||||
expected: FAIL
|
||||
|
|
@ -5,8 +5,7 @@
|
|||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
assert_throws(new TypeError(), function() {
|
||||
postMessage('');
|
||||
});
|
||||
this.done();
|
||||
});
|
||||
</script>
|
||||
|
|
Загрузка…
Ссылка в новой задаче