mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1148030 - Correctly reflect object and embed RequestContext values; r=smaug
Note that these elements cannot be intercepted for now. See bug 1168676 for the background.
This commit is contained in:
parent
fd21120a21
commit
eb1370f8cf
@ -1485,8 +1485,10 @@ nsObjectLoadingContent::CheckLoadPolicy(int16_t *aContentPolicy)
|
|||||||
|
|
||||||
nsIDocument* doc = thisContent->OwnerDoc();
|
nsIDocument* doc = thisContent->OwnerDoc();
|
||||||
|
|
||||||
|
nsContentPolicyType contentPolicyType = GetContentPolicyType();
|
||||||
|
|
||||||
*aContentPolicy = nsIContentPolicy::ACCEPT;
|
*aContentPolicy = nsIContentPolicy::ACCEPT;
|
||||||
nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_OBJECT,
|
nsresult rv = NS_CheckContentLoadPolicy(contentPolicyType,
|
||||||
mURI,
|
mURI,
|
||||||
doc->NodePrincipal(),
|
doc->NodePrincipal(),
|
||||||
thisContent,
|
thisContent,
|
||||||
@ -1532,7 +1534,7 @@ nsObjectLoadingContent::CheckProcessPolicy(int16_t *aContentPolicy)
|
|||||||
objectType = nsIContentPolicy::TYPE_DOCUMENT;
|
objectType = nsIContentPolicy::TYPE_DOCUMENT;
|
||||||
break;
|
break;
|
||||||
case eType_Plugin:
|
case eType_Plugin:
|
||||||
objectType = nsIContentPolicy::TYPE_OBJECT;
|
objectType = GetContentPolicyType();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
NS_NOTREACHED("Calling checkProcessPolicy with a unloadable type");
|
NS_NOTREACHED("Calling checkProcessPolicy with a unloadable type");
|
||||||
@ -2485,11 +2487,13 @@ nsObjectLoadingContent::OpenChannel()
|
|||||||
securityFlags |= nsILoadInfo::SEC_SANDBOXED;
|
securityFlags |= nsILoadInfo::SEC_SANDBOXED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsContentPolicyType contentPolicyType = GetContentPolicyType();
|
||||||
|
|
||||||
rv = NS_NewChannel(getter_AddRefs(chan),
|
rv = NS_NewChannel(getter_AddRefs(chan),
|
||||||
mURI,
|
mURI,
|
||||||
thisContent,
|
thisContent,
|
||||||
securityFlags,
|
securityFlags,
|
||||||
nsIContentPolicy::TYPE_OBJECT,
|
contentPolicyType,
|
||||||
group, // aLoadGroup
|
group, // aLoadGroup
|
||||||
shim, // aCallbacks
|
shim, // aCallbacks
|
||||||
nsIChannel::LOAD_CALL_CONTENT_SNIFFERS |
|
nsIChannel::LOAD_CALL_CONTENT_SNIFFERS |
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include "nsImageLoadingContent.h"
|
#include "nsImageLoadingContent.h"
|
||||||
#include "nsIStreamListener.h"
|
#include "nsIStreamListener.h"
|
||||||
#include "nsIChannelEventSink.h"
|
#include "nsIChannelEventSink.h"
|
||||||
|
#include "nsIContentPolicy.h"
|
||||||
#include "nsIObjectLoadingContent.h"
|
#include "nsIObjectLoadingContent.h"
|
||||||
#include "nsIRunnable.h"
|
#include "nsIRunnable.h"
|
||||||
#include "nsIThreadInternal.h"
|
#include "nsIThreadInternal.h"
|
||||||
@ -332,6 +333,11 @@ class nsObjectLoadingContent : public nsImageLoadingContent
|
|||||||
void UnbindFromTree(bool aDeep = true,
|
void UnbindFromTree(bool aDeep = true,
|
||||||
bool aNullParent = true);
|
bool aNullParent = true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the content policy type used for loading the element.
|
||||||
|
*/
|
||||||
|
virtual nsContentPolicyType GetContentPolicyType() const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// Object parameter changes returned by UpdateObjectParameters
|
// Object parameter changes returned by UpdateObjectParameters
|
||||||
|
@ -128,9 +128,12 @@ InternalRequest::MapContentPolicyTypeToRequestContext(nsContentPolicyType aConte
|
|||||||
case nsIContentPolicy::TYPE_STYLESHEET:
|
case nsIContentPolicy::TYPE_STYLESHEET:
|
||||||
context = RequestContext::Style;
|
context = RequestContext::Style;
|
||||||
break;
|
break;
|
||||||
case nsIContentPolicy::TYPE_OBJECT:
|
case nsIContentPolicy::TYPE_INTERNAL_OBJECT:
|
||||||
context = RequestContext::Object;
|
context = RequestContext::Object;
|
||||||
break;
|
break;
|
||||||
|
case nsIContentPolicy::TYPE_INTERNAL_EMBED:
|
||||||
|
context = RequestContext::Embed;
|
||||||
|
break;
|
||||||
case nsIContentPolicy::TYPE_DOCUMENT:
|
case nsIContentPolicy::TYPE_DOCUMENT:
|
||||||
context = RequestContext::Internal;
|
context = RequestContext::Internal;
|
||||||
break;
|
break;
|
||||||
|
@ -34,7 +34,7 @@ namespace dom {
|
|||||||
* beacon | TYPE_BEACON
|
* beacon | TYPE_BEACON
|
||||||
* cspreport | TYPE_CSP_REPORT
|
* cspreport | TYPE_CSP_REPORT
|
||||||
* download |
|
* download |
|
||||||
* embed | TYPE_OBJECT
|
* embed | TYPE_INTERNAL_EMBED
|
||||||
* eventsource |
|
* eventsource |
|
||||||
* favicon |
|
* favicon |
|
||||||
* fetch | TYPE_FETCH
|
* fetch | TYPE_FETCH
|
||||||
@ -49,7 +49,7 @@ namespace dom {
|
|||||||
* internal | TYPE_DOCUMENT, TYPE_XBL, TYPE_OTHER
|
* internal | TYPE_DOCUMENT, TYPE_XBL, TYPE_OTHER
|
||||||
* location |
|
* location |
|
||||||
* manifest | TYPE_WEB_MANIFEST
|
* manifest | TYPE_WEB_MANIFEST
|
||||||
* object | TYPE_OBJECT
|
* object | TYPE_INTERNAL_OBJECT
|
||||||
* ping | TYPE_PING
|
* ping | TYPE_PING
|
||||||
* plugin | TYPE_OBJECT_SUBREQUEST
|
* plugin | TYPE_OBJECT_SUBREQUEST
|
||||||
* prefetch |
|
* prefetch |
|
||||||
@ -74,7 +74,6 @@ namespace dom {
|
|||||||
* TODO: Add a content type for form
|
* TODO: Add a content type for form
|
||||||
* TODO: Add a content type for favicon
|
* TODO: Add a content type for favicon
|
||||||
* TODO: Add a content type for download
|
* TODO: Add a content type for download
|
||||||
* TODO: Split TYPE_OBJECT into TYPE_EMBED and TYPE_OBJECT
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Request;
|
class Request;
|
||||||
|
@ -246,7 +246,12 @@ private:
|
|||||||
* value. This is used to know the default tabindex value.
|
* value. This is used to know the default tabindex value.
|
||||||
*/
|
*/
|
||||||
bool IsFocusableForTabIndex();
|
bool IsFocusableForTabIndex();
|
||||||
|
|
||||||
|
nsContentPolicyType GetContentPolicyType() const override
|
||||||
|
{
|
||||||
|
return nsIContentPolicy::TYPE_INTERNAL_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void GetItemValueText(DOMString& text) override;
|
virtual void GetItemValueText(DOMString& text) override;
|
||||||
virtual void SetItemValueText(const nsAString& text) override;
|
virtual void SetItemValueText(const nsAString& text) override;
|
||||||
|
|
||||||
|
@ -387,5 +387,18 @@ HTMLSharedObjectElement::WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenPr
|
|||||||
return rootedObj;
|
return rootedObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsContentPolicyType
|
||||||
|
HTMLSharedObjectElement::GetContentPolicyType() const
|
||||||
|
{
|
||||||
|
if (mNodeInfo->Equals(nsGkAtoms::applet)) {
|
||||||
|
// We use TYPE_INTERNAL_OBJECT for applet too, since it is not exposed
|
||||||
|
// through RequestContext yet.
|
||||||
|
return nsIContentPolicy::TYPE_INTERNAL_OBJECT;
|
||||||
|
} else {
|
||||||
|
MOZ_ASSERT(mNodeInfo->Equals(nsGkAtoms::embed));
|
||||||
|
return nsIContentPolicy::TYPE_INTERNAL_EMBED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dom
|
} // namespace dom
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
@ -207,6 +207,8 @@ private:
|
|||||||
nsGkAtoms::src;
|
nsGkAtoms::src;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsContentPolicyType GetContentPolicyType() const override;
|
||||||
|
|
||||||
// mIsDoneAddingChildren is only really used for <applet>. This boolean is
|
// mIsDoneAddingChildren is only really used for <applet>. This boolean is
|
||||||
// always true for <embed>, per the documentation in nsIContent.h.
|
// always true for <embed>, per the documentation in nsIContent.h.
|
||||||
bool mIsDoneAddingChildren;
|
bool mIsDoneAddingChildren;
|
||||||
|
@ -128,8 +128,7 @@
|
|||||||
document.documentElement.appendChild(embed);
|
document.documentElement.appendChild(embed);
|
||||||
navigator.serviceWorker.addEventListener("message", function onMessage(e) {
|
navigator.serviceWorker.addEventListener("message", function onMessage(e) {
|
||||||
if (e.data.data == "embed") {
|
if (e.data.data == "embed") {
|
||||||
// FIXME: Bug 1148030: This should be "embed".
|
is(e.data.context, "embed", "Expected the object context on an embed");
|
||||||
is(e.data.context, "object", "Expected the object context on an embed");
|
|
||||||
navigator.serviceWorker.removeEventListener("message", onMessage);
|
navigator.serviceWorker.removeEventListener("message", onMessage);
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user