Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge mozilla-central into mozilla-inbound

  • Loading branch information...
commit 57174a632143f5e117bc07e281af48ecb654ae60 2 parents 4de8a30 + 1ac30f9
@ehsan ehsan authored
View
4 build/mobile/sutagent/android/DoCommand.java
@@ -107,7 +107,7 @@
String ffxProvider = "org.mozilla.ffxcp";
String fenProvider = "org.mozilla.fencp";
- private final String prgVersion = "SUTAgentAndroid Version 1.15";
+ private final String prgVersion = "SUTAgentAndroid Version 1.16";
public enum Command
{
@@ -3414,7 +3414,7 @@ public String StartJavaPrg(String [] sArgs, Intent preIntent)
else
prgIntent.setAction(Intent.ACTION_MAIN);
- if (sArgs[0].contains("fennec"))
+ if (sArgs[0].contains("fennec") || sArgs[0].contains("firefox"))
{
sArgList = "";
sUrl = "";
View
28 content/base/public/nsContentPolicyUtils.h
@@ -144,7 +144,7 @@ NS_CP_ContentTypeName(uint32_t contentType)
*
* Note: requestOrigin is scoped outside the PR_BEGIN_MACRO/PR_END_MACRO on
* purpose */
-#define CHECK_PRINCIPAL \
+#define CHECK_PRINCIPAL_AND_DATA(action) \
nsCOMPtr<nsIURI> requestOrigin; \
PR_BEGIN_MACRO \
if (originPrincipal) { \
@@ -153,12 +153,32 @@ NS_CP_ContentTypeName(uint32_t contentType)
secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID); \
} \
if (secMan) { \
- bool isSystem; \
+ bool isSystem; \
nsresult rv = secMan->IsSystemPrincipal(originPrincipal, \
&isSystem); \
NS_ENSURE_SUCCESS(rv, rv); \
if (isSystem) { \
*decision = nsIContentPolicy::ACCEPT; \
+ nsCOMPtr<nsINode> n = do_QueryInterface(context); \
+ if (!n) { \
+ nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(context); \
+ n = win ? win->GetExtantDoc() : nullptr; \
+ } \
+ if (n) { \
+ nsIDocument* d = n->OwnerDoc(); \
+ if (d->IsLoadedAsData() || d->IsBeingUsedAsImage() || \
+ d->IsResourceDoc()) { \
+ nsCOMPtr<nsIContentPolicy> dataPolicy = \
+ do_GetService( \
+ "@mozilla.org/data-document-content-policy;1"); \
+ if (dataPolicy) { \
+ dataPolicy-> action (contentType, contentLocation, \
+ requestOrigin, context, \
+ mimeType, extra, \
+ originPrincipal, decision); \
+ } \
+ } \
+ } \
return NS_OK; \
} \
} \
@@ -187,7 +207,7 @@ NS_CheckContentLoadPolicy(uint32_t contentType,
nsIContentPolicy *policyService = nullptr,
nsIScriptSecurityManager* aSecMan = nullptr)
{
- CHECK_PRINCIPAL;
+ CHECK_PRINCIPAL_AND_DATA(ShouldLoad);
if (policyService) {
CHECK_CONTENT_POLICY_WITH_SERVICE(ShouldLoad, policyService);
}
@@ -214,7 +234,7 @@ NS_CheckContentProcessPolicy(uint32_t contentType,
nsIContentPolicy *policyService = nullptr,
nsIScriptSecurityManager* aSecMan = nullptr)
{
- CHECK_PRINCIPAL;
+ CHECK_PRINCIPAL_AND_DATA(ShouldProcess);
if (policyService) {
CHECK_CONTENT_POLICY_WITH_SERVICE(ShouldProcess, policyService);
}
View
7 content/base/src/nsDataDocumentContentPolicy.cpp
@@ -30,6 +30,9 @@ HasFlags(nsIURI* aURI, uint32_t aURIFlags)
return NS_SUCCEEDED(rv) && hasFlags;
}
+// If you change DataDocumentContentPolicy, make sure to check that
+// CHECK_PRINCIPAL_AND_DATA in nsContentPolicyUtils is still valid.
+// nsContentPolicyUtils may not pass all the parameters to ShouldLoad.
NS_IMETHODIMP
nsDataDocumentContentPolicy::ShouldLoad(uint32_t aContentType,
nsIURI *aContentLocation,
@@ -123,6 +126,10 @@ nsDataDocumentContentPolicy::ShouldLoad(uint32_t aContentType,
*aDecision = nsIContentPolicy::REJECT_TYPE;
}
+ // If you add more restrictions here, make sure to check that
+ // CHECK_PRINCIPAL_AND_DATA in nsContentPolicyUtils is still valid.
+ // nsContentPolicyUtils may not pass all the parameters to ShouldLoad
+
return NS_OK;
}
View
22 docshell/base/nsDocShell.cpp
@@ -8672,6 +8672,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
return NS_ERROR_FAILURE;
}
+ NS_ENSURE_STATE(!HasUnloadedParent());
+
rv = CheckLoadingPermissions();
if (NS_FAILED(rv)) {
return rv;
@@ -12461,3 +12463,23 @@ nsDocShell::GetAsyncPanZoomEnabled(bool* aOut)
*aOut = false;
return NS_OK;
}
+
+bool
+nsDocShell::HasUnloadedParent()
+{
+ nsCOMPtr<nsIDocShellTreeItem> currentTreeItem = this;
+ while (currentTreeItem) {
+ nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
+ currentTreeItem->GetParent(getter_AddRefs(parentTreeItem));
+ nsCOMPtr<nsIDocShell> parent = do_QueryInterface(parentTreeItem);
+ if (parent) {
+ bool inUnload = false;
+ parent->GetIsInUnload(&inUnload);
+ if (inUnload) {
+ return true;
+ }
+ }
+ currentTreeItem.swap(parentTreeItem);
+ }
+ return false;
+}
View
2  docshell/base/nsDocShell.h
@@ -675,6 +675,8 @@ class nsDocShell : public nsDocLoader,
FrameType GetInheritedFrameType();
+ bool HasUnloadedParent();
+
// hash of session storages, keyed by domain
nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorage> mStorages;
View
10 dom/workers/RuntimeService.cpp
@@ -389,6 +389,14 @@ CTypesActivityCallback(JSContext* aCx,
worker->EndCTypesCall();
break;
+ case js::CTYPES_CALLBACK_BEGIN:
+ worker->BeginCTypesCallback();
+ break;
+
+ case js::CTYPES_CALLBACK_END:
+ worker->EndCTypesCallback();
+ break;
+
default:
MOZ_NOT_REACHED("Unknown type flag!");
}
@@ -434,7 +442,7 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate)
return nullptr;
}
- JS_SetContextPrivate(workerCx, aWorkerPrivate);
+ JS_SetRuntimePrivate(runtime, aWorkerPrivate);
JS_SetErrorReporter(workerCx, ErrorReporter);
View
2  dom/workers/WorkerPrivate.cpp
@@ -4200,7 +4200,7 @@ WorkerPrivate*
GetWorkerPrivateFromContext(JSContext* aCx)
{
NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
- return static_cast<WorkerPrivate*>(JS_GetContextPrivate(aCx));
+ return static_cast<WorkerPrivate*>(JS_GetRuntimePrivate(JS_GetRuntime(aCx)));
}
JSStructuredCloneCallbacks*
View
16 dom/workers/WorkerPrivate.h
@@ -771,6 +771,22 @@ class WorkerPrivate : public WorkerPrivateParent<WorkerPrivate>
void
EndCTypesCall();
+ void
+ BeginCTypesCallback()
+ {
+ // If a callback is beginning then we need to do the exact same thing as
+ // when a ctypes call ends.
+ EndCTypesCall();
+ }
+
+ void
+ EndCTypesCallback()
+ {
+ // If a callback is ending then we need to do the exact same thing as
+ // when a ctypes call begins.
+ BeginCTypesCall();
+ }
+
private:
WorkerPrivate(JSContext* aCx, JSObject* aObject, WorkerPrivate* aParent,
JSContext* aParentJSContext, const nsAString& aScriptURL,
View
14 js/src/ctypes/CTypes.cpp
@@ -5790,9 +5790,7 @@ FunctionType::Call(JSContext* cx,
}
// Let the runtime callback know that we are about to call into C.
- js::CTypesActivityCallback activityCallback = cx->runtime->ctypesActivityCallback;
- if (activityCallback)
- activityCallback(cx, js::CTYPES_CALL_BEGIN);
+ js::AutoCTypesActivityCallback autoCallback(cx, js::CTYPES_CALL_BEGIN, js::CTYPES_CALL_END);
uintptr_t fn = *reinterpret_cast<uintptr_t*>(CData::GetData(obj));
@@ -5821,8 +5819,8 @@ FunctionType::Call(JSContext* cx,
errno = savedErrno;
- if (activityCallback)
- activityCallback(cx, js::CTYPES_CALL_END);
+ // We're no longer calling into C.
+ autoCallback.DoEndCallback();
// Store the error value for later consultation with |ctypes.getStatus|
JSObject *objCTypes = CType::GetGlobalCTypes(cx, typeObj);
@@ -6105,6 +6103,12 @@ CClosure::ClosureStub(ffi_cif* cif, void* result, void** args, void* userData)
// Retrieve the essentials from our closure object.
ClosureInfo* cinfo = static_cast<ClosureInfo*>(userData);
JSContext* cx = cinfo->cx;
+
+ // Let the runtime callback know that we are about to call into JS again. The end callback will
+ // fire automatically when we exit this function.
+ js::AutoCTypesActivityCallback autoCallback(cx, js::CTYPES_CALLBACK_BEGIN,
+ js::CTYPES_CALLBACK_END);
+
RootedObject typeObj(cx, cinfo->typeObj);
RootedObject thisObj(cx, cinfo->thisObj);
RootedObject jsfnObj(cx, cinfo->jsfnObj);
View
12 js/src/jsfriendapi.cpp
@@ -990,3 +990,15 @@ js::SetCTypesActivityCallback(JSRuntime *rt, CTypesActivityCallback cb)
{
rt->ctypesActivityCallback = cb;
}
+
+js::AutoCTypesActivityCallback::AutoCTypesActivityCallback(JSContext *cx,
+ js::CTypesActivityType beginType,
+ js::CTypesActivityType endType
+ MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL)
+ : cx(cx), callback(cx->runtime->ctypesActivityCallback), beginType(beginType), endType(endType)
+{
+ MOZ_GUARD_OBJECT_NOTIFIER_INIT;
+
+ if (callback)
+ callback(cx, beginType);
+}
View
27 js/src/jsfriendapi.h
@@ -1569,7 +1569,9 @@ IsTypedArrayThisCheck(JS::IsAcceptableThis test);
enum CTypesActivityType {
CTYPES_CALL_BEGIN,
- CTYPES_CALL_END
+ CTYPES_CALL_END,
+ CTYPES_CALLBACK_BEGIN,
+ CTYPES_CALLBACK_END
};
typedef void
@@ -1582,6 +1584,29 @@ typedef void
JS_FRIEND_API(void)
SetCTypesActivityCallback(JSRuntime *rt, CTypesActivityCallback cb);
+class JS_FRIEND_API(AutoCTypesActivityCallback) {
+ private:
+ JSContext *cx;
+ CTypesActivityCallback callback;
+ CTypesActivityType beginType;
+ CTypesActivityType endType;
+ MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+
+ public:
+ AutoCTypesActivityCallback(JSContext *cx, CTypesActivityType beginType,
+ CTypesActivityType endType
+ MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
+ ~AutoCTypesActivityCallback() {
+ DoEndCallback();
+ }
+ void DoEndCallback() {
+ if (callback) {
+ callback(cx, endType);
+ callback = NULL;
+ }
+ }
+};
+
} /* namespace js */
#endif /* jsfriendapi_h___ */
View
5 js/xpconnect/src/XPCJSRuntime.cpp
@@ -431,11 +431,12 @@ CanSkipWrappedJS(nsXPCWrappedJS *wrappedJS)
// If traversing wrappedJS wouldn't release it, nor
// cause any other objects to be added to the graph, no
// need to add it to the graph at all.
+ bool isRootWrappedJS = wrappedJS->GetRootWrapper() == wrappedJS;
if (nsCCUncollectableMarker::sGeneration &&
(!obj || !xpc_IsGrayGCThing(obj)) &&
!wrappedJS->IsSubjectToFinalization() &&
- wrappedJS->GetRootWrapper() == wrappedJS) {
- if (!wrappedJS->IsAggregatedToNative()) {
+ (isRootWrappedJS || CanSkipWrappedJS(wrappedJS->GetRootWrapper()))) {
+ if (!wrappedJS->IsAggregatedToNative() || !isRootWrappedJS) {
return true;
} else {
nsISupports* agg = wrappedJS->GetAggregatedNativeObject();
Please sign in to comment.
Something went wrong with that request. Please try again.