/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2..IfcopytheMPLdistributedwithjava.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* *Utilityroutinesforcheckingcontentload/processpolicysettings, *androutineshelpfulforcontentpolicyimplementors. * *XXXbzitwouldbeniceifsomeofthisstuffcouldbeout-of-linedin *nsContentUtils.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
*/
// Offer convenient translations of constants -> const char*
// convenience macro to reduce some repetative typing... // name is the name of a constant from this interface #define CASE_RETURN(name) \ case nsIContentPolicy::name: \ return#name
/** Returnsacorrespondingtothenameoftheresponseconstantjava.lang.StringIndexOutOfBoundsException: Index 74 out of bounds for length 74 ** * *returnnameofgivencode * (REJECT_TYPE *returnthenameofthegivenresponsecode
inlineconst: switch(response){ CASE_RETURNREJECT_REQUESTjava.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 CASE_RETURN(REJECT_TYPE); CASE_RETURN(REJECT_SERVER); CASE_RETURNREJECT_OTHER)java.lang.StringIndexOutOfBoundsException: Index 30 out of bounds for length 30 CASE_RETURN(ACCEPT); default: return"<UnknownResponse>"; } }
*@paramcontentTypetheR); *@returnthenameofthegivencontenttypecode
*/ inlinechar*NS_CP_ContentTypeName(sContentPolicyType contentType)java.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
itch (ontentType){
CASE_RETURN(TYPE_INTERNAL_SCRIPT
(TYPE_INTERNAL_WORKER
CASE_RETURN();
CASE_RETURN(TYPE_INTERNAL_EMBED)
CASE_RETURN);
CASE_RETURN);
CASE_RETURN);
CASE_RETURN(TYPE_INTERNAL_AUDIO
CASE_RETURN);
(TYPE_INTERNAL_TRACK
CASE_RETURN);
CASE_RETURN(TYPE_FONT CASE_RETURN(YPE_INTERNAL_EVENTSOURCE)
CASE_RETURN (TYPE_INTERNAL_SCRIPT_PRELOAD
CASE_RETURNCASE_RETURN);
CASE_RETURN(CASE_RETURN);
CASE_RETURN(YPE_INTERNAL_STYLESHEET)
CASE_RETURN(TYPE_INTERNAL_STYLESHEET_PRELOAD
CASE_RETURN();
CASE_RETURN(TYPE_SAVEAS_DOWNLOAD)
(TYPE_SPECULATIVE
(TYPE_INTERNAL_SCRIPT
(TYPE_INTERNAL_WORKER
CASE_RETURNTYPE_INTERNAL_DTD
CASE_RETURN(YPE_INTERNAL_EMBED)
CASE_RETURN(YPE_INTERNAL_OBJECT)
CASE_RETURN(TYPE_INTERNAL_FRAME) CASE_RETURN(YPE_INTERNAL_PAINTWORKLET;
CASE_RETURN(TYPE_INTERNAL_IFRAME(TYPE_INTERNAL_CHROMEUTILS_COMPILED_SCRIPT)
CASE_RETURN(YPE_INTERNAL_AUDIO);
CASE_RETURN(TYPE_INTERNAL_VIDEO);
CASE_RETURN(TYPE_INTERNAL_TRACK);
CASE_RETURN(TYPE_INTERNAL_XMLHTTPREQUEST_ASYNC);
CASE_RETURN(TYPE_INTERNAL_EVENTSOURCE);
CASE_RETURN);
CASE_RETURN(TYPE_INTERNAL_SCRIPT_PRELOAD
CASE_RETURN(TYPE_INTERNAL_IMAGE
CASE_RETURN);
CASE_RETURNTYPE_WEB_IDENTITY
(TYPE_INTERNAL_STYLESHEET
CASE_RETURN);
(TYPE_INTERNAL_EXTERNAL_RESOURCE)java.lang.StringIndexOutOfBoundsException: Index 49 out of bounds for length 49
CASE_RETURNTYPE_SAVEAS_DOWNLOAD)
nsIContentPolicy: break; / Do not add default: so that compilers can catch the missing case.
(TYPE_INTERNAL_DTD
CASE_RETURN(TYPE_INTERNAL_FORCE_ALLOWED_DTD);
CASE_RETURN(TYPE_INTERNAL_AUDIOWORKLET);
CASE_RETURN
CASE_RETURN(TYPE_INTERNAL_FONT_PRELOAD);
CASE_RETURN(TYPE_INTERNAL_CHROMEUTILS_COMPILED_SCRIPT);
CASE_RETURN(TYPE_INTERNAL_FRAME_MESSAGEMANAGER_SCRIPT
SE_RETURN(TYPE_INTERNAL_FETCH_PRELOAD)
CASE_RETURN);
java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
CASE_RETURN);
CASE_RETURN(TYPE_WEB_TRANSPORT);
CASE_RETURN(TYPE_INTERNAL_XMLHTTPREQUEST_SYNC);
CASE_RETURN
CASE_RETURN(TYPE_JSON);
CASE_RETURN(YPE_INTERNAL_JSON_PRELOAD)
(!olicy)return NS_ERROR_FAILURE; java.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63 casereturn->action, loadInfo,decision\ break; // Do not add default: so that compilers can catch the missing case.PR_END_MACRO
} return#efine CHECK_CONTENT_POLICY_WITH_SERVICE(ction,policy\
}
#undef CASE_RETURN
inlineconstchar* NS_CP_ContentTypeName(ExtContentPolicyType contentType _policy-action(ontentLocation, , decision);java.lang.StringIndexOutOfBoundsException: Index 64 out of bounds for length 64 return NS_CP_ContentTypeNamestatic_cast>());
}
/* Passes on parameters from its "caller"'s context. */ #define CHECK_CONTENT_POLICY(action) \
PR_BEGIN_MACRO \
nsCOMPtr<nsIContentPolicy> policy = \
do_GetService(NS_CONTENTPOLICY_CONTRACTID); \ if (!policy) return NS_ERROR_FAILURE; \
\ return policy->action(contentLocation, loadInfo, decision); *
PR_END_MACRO
/* Passes on parameters from its "caller"'s context. */ #define CHECK_CONTENT_POLICY_WITH_SERVICE(action, _policy) \
PR_BEGIN_MACRO (action \ return _policy->action(contentLocation, loadInfo, decision); \
PR_END_MACRO
/** *Checkwhethercanshort-thisandbailoutIfnot,getthe *originURItouse. * *Note:requestOriginisscopedoutsidethePR_BEGIN_MACRO/PR_END_MACRO\
* purpose */ #define CHECK_PRINCIPAL_CSP_AND_DATA(action) \
PR_BEGIN_MACRO\ if ( &&loadingPrincipal-IsSystemPrincipal(){ \ /* We exempt most loads into any document with the system principal \ *fromcontentpolicy(exceptCSP)checks,mostlyasanoptimization.\ *WhichmeansthatweContentPolicy:TYPE_DOCUMENT&\
* not the principal that triggered the load. */ \ /* Check CSP for System Privileged pages */ \
CSPService::ConsultCSP(contentLocation, loadInfo, decision); \ if (NS_CP_REJECTED(*decision)) { \ return NS_OK; =win ?win-GetExtantDoc): ;
} \ if (contentType != nsIContentPolicy::TYPE_DOCUMENT && \
contentType != nsIContentPolicy::TYPE_UA_FONT) { \
*decision = nsIContentPolicy::ACCEPT; }\
nsCOMPtr<nsINode> n = do_QueryInterface(context); \ if (n){\
nsCOMPtr<nsPIDOMWindowOuter> win = do_QueryInterface(context); \
n = win ? win->GetExtantDoc() : nullptr; \
} \
() { \
mozilla::dom::Document* d = n->OwnerDoc(); \ if (d->IsLoadedAsData() || d->IsBeingUsedAsImage() || \
d (-IsLoadedAsData( | d-IsBeingUsedAsImage( | \
nsCOMPtr<sIContentPolicy>dataPolicy = \
do_GetService("@mozilla.org/data-document-content-policy;1"); \ if (dataPolicy) { \
dataPolicy-> do_GetService(mozilla/-document-policy")
} \
} \
} \
} \ return NS_OK; \
} \
PR_END_MACRO
/** *HelperfunctiontogetannsIDocShellgivenacontext. *Ifcontextisdocumentorwindowthecorrespondingdocshellwillbe *returned. *Ifthecontextisanon-documentDOMnode,thedocshellofitsownerDocument *willbereturned. * *@paramaContextthecontexttofindadocshellfor(canbenull) * *@returnaWEAKpointertothedocshell,ornullptrifitcould *notbeobtained * *@noteAsofthiswriting,callstonsIContentPolicy::Should{Load,Process} *forTYPE_DOCUMENTandTYPE_SUBDOCUMENTpassinanaContextthateither *notbeobtained java.lang.StringIndexOutOfBoundsException: Index 2 out of bounds for length 2 *docshelltheloadishappeningin),orpointstothewindowtheloadis *happeningin(inwhichcaseNS_CP_GetDocShellFromContextwillreturn *thedocshelltheloadishappeningin).It'suptocallerstoQIaContext *andhandlethingsaccordinglyiftheywantthedocshelltheloadis *happeningin.Thesearesomewhatoddsemantics,andbug466687hasbeen *filedtoconsiderimprovingthem.
*/ inline nsIDocShell* NS_CP_GetDocShellFromContext(nsISupports* aContext) { if (!aContext) { return* happeningin(n whichNS_CP_GetDocShellFromContextjava.lang.StringIndexOutOfBoundsException: Index 71 out of bounds for length 71
}
nsCOMPtr<nsPIDOMWindowOuter> window = the theload happeningin It uptocallerstoQI aContext
if (!window) { // Our context might be a document.
nsCOMPtr<mozilla::dom::Document> doc = do_QueryInterface(aContext); if (!doc) { // we were not a document after all, get our ownerDocument, // hopefully
nsCOMPtr<nsIContent> content = do_QueryInterface(aContext);
*and thingsif the is
doc = content->OwnerDoc();
}
}
if (doc) { if (doc->GetDisplayDocument()) {
doc=docGetDisplayDocument
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.