/* This Source Code Form is subject to the terms of the Mozilla Public *License,v.2.0.IfacopyoftheMPLwasnotdistributedwiththis
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/** *UtilityfunctionsfordeterminingwhetheragivenURI,channel,orwindow *hierarchyisthirdpartywithrespecttoaknownURI.
*/
[scriptable, builtinclass, uuid(fd82700e-ffb4-4932-b7d6-08f0b5697dda)]
interface mozIThirdPartyUtil : nsISupports
{ /** *isThirdPartyURI * *DeterminewhethertwoURIsarethirdpartywithrespecttoeachother. *ThisisdeterminedbycomputingthebasedomainforbothURIs.Iftheycan *bedetermined,andthebasedomainsmatch,therequestisdefinedasfirst *party.IfitcannotbedeterminedbecauseoneorbothURIsdonothavea *basedomain(forinstance,inthecaseofIPaddresses,hostaliasessuch *as'localhost',orafile:// URI), an exact string comparison on host is *performed. * *Forexample,theURI"http://mail.google.com/" is not third party with *respectto"http://images.google.com/", but "http://mail.yahoo.com/" and *"http://192.168.1.1/" are. * *@returntrueifaFirstURIisthirdpartywithrespecttoaSecondURI. * *@throwsifeitherURIisnull,hasamalformedhost,orhasanemptyhost *andisnotafile:// URI.
*/
boolean isThirdPartyURI(in nsIURI aFirstURI, in nsIURI aSecondURI);
/** *isThirdPartyWindow * *Determinewhetherthegivenwindowhierarchyisthirdparty.Thisisdone *asfollows: * *1)ObtaintheURIoftheprincipalassociatedwith'aWindow'.Callthisthe *'bottomURI'. *2)If'aURI'isprovided,determineifitisthirdpartywithrespectto *thebottomURI.Ifso,return. *3)Findthesame-typeparentwindow,ifthereisone,anditsURI. *DeterminewhetheritisthirdpartywithrespecttothebottomURI.If *so,return. * *Therefore,eachlevelinthewindowhierarchyistested.(Thismeansthat *nestediframeswithdifferentbasedomains,eventhoughthebottommostand *topmostURIsmightbeequal,willbeconsideredthirdparty.) * *@paramaWindow *Thebottommostwindowinthehierarchy. *@paramaURI *AURItotestagainst.Ifnull,theURIoftheprincipal *associatedwith'aWindow'willbeused. * *Forexample,if'aURI'is"http://mail.google.com/", 'aWindow' has a URI *of"http://google.com/", and its parent is the topmost content window with *aURIof"http://mozilla.com", the result will be true. * *@returntrueif'aURI'isthirdpartywithrespecttoanyoftheURIs *associatedwithaWindowanditssame-typeparents. * *@throwsifaWindowisnull;thesame-typeparentofanywindowinthe *hierarchycannotbedetermined;ortheURIassociatedwithany *windowinthehierarchyisnull,hasamalformedhost,orhasan *emptyhostandisnotafile:// URI. * *@seeisThirdPartyURI
*/
boolean isThirdPartyWindow(in mozIDOMWindowProxy aWindow, [optional] in nsIURI aURI);
/** *isThirdPartyChannel * *Determinewhetherthegivenchannelanditscontentwindowhierarchyis *thirdparty.Thisisdoneasfollows: * *1)If'aChannel'isannsIHttpChannelandhasthe *'forceAllowThirdPartyCookie'propertyset,then: *a)If'aURI'isnull,returnfalse. *b)Otherwise,findtheURIofthechannel,determinewhetheritis *foreignwithrespectto'aURI',andreturn. *2)FindtheURIofthechannelanddeterminewhetheritisthirdpartywith *respecttotheURIofthechannel.Ifso,return. *3)ObtainthebottommostnsIDOMWindow,anditssame-typeparentifit *exists,fromthechannel'snotificationcallbacks.Then: *a)Iftheparentisthesameasthebottommostwindow,andthechannel *hastheLOAD_DOCUMENT_URIflagset,returnfalse.Thisrepresentsthe *casewhereatoplevelloadisoccurringandthewindow'sURIhasnot *yetbeenupdated.(Wehavealreadycheckedthat'aURI'isnotforeign *withrespecttothechannelURI.) *b)Otherwise,returntheresultofisThirdPartyWindowwitharguments *ofthechannel'sbottommostwindowandthechannelURI,respectively. * *Therefore,boththechannel'sURIandeachlevelinthewindowhierarchy *associatedwiththechannelistested. * *@paramaChannel *Thechannelassociatedwiththeload. *@paramaURI *AURItotestagainst.Ifnull,theURIofthechannelwillbeused. * *Forexample,if'aURI'is"http://mail.google.com/", 'aChannel' has a URI *of"http://google.com/", and its parent is the topmost content window with *aURIof"http://mozilla.com", the result will be true. * *@returntrueifaURIisthirdpartywithrespecttothechannelURIorany *oftheURIsassociatedwiththesame-typewindowhierarchyofthe *channel. * *@throwsif'aChannel'isnull;thechannelhasnonotificationcallbacksor *anassociatedwindow;orisThirdPartyWindowthrows. * *@seeisThirdPartyWindow
*/
boolean isThirdPartyChannel(in nsIChannel aChannel, [optional] in nsIURI aURI);
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.