[XPCOM | C++] nsIContentPolicy - ShouldLoad
저장소/잡다한거nsIContentPolicy의 ShouldLoad함수는 그냥 그때그때 상황에 맞는 상태만 확인할 수 있음.
navigate 제어나 뭐 그딴건 안됨.
aContentType에 따라서 aContext로 들어오는 DOMNode가 달라짐.
어쨌든 제어 안됨.
*_retval = REJECT_REQUEST or REJECT_SERVER로 return하게되면 현재 동작에 대해 진행이 안됨.
aExtra에 뭔짓을 하면 ShouldLoad()를 벗어나 뭔가 할 수 있다 하는 것 같은데
어이 하는지 모르는 관계로 걍 Observer()를 통해 처리하기로 함.
/************************************************************************/
/* nsIContentPolicy interface */
/************************************************************************/
/**
* Should the resource at this location be loaded?
* ShouldLoad will be called before loading the resource at aContentLocation
* to determine whether to start the load at all.
*
* @param aContentType the type of content being tested. This will be one
* one of the TYPE_* constants.
*
* @param aContentLocation the location of the content being checked; must
* not be null
*
* @param aRequestOrigin OPTIONAL. the location of the resource that
* initiated this load request; can be null if
* inapplicable
*
* @param aContext OPTIONAL. the nsIDOMNode or nsIDOMWindow that
* initiated the request, or something that can QI
* to one of those; can be null if inapplicable.
*
* @param aMimeTypeGuess OPTIONAL. a guess for the requested content's
* MIME type, based on information available to
* the request initiator (e.g., an OBJECT's type
* attribute); does not reliably reflect the
* actual MIME type of the requested content
*
* @param aExtra an OPTIONAL argument, pass-through for non-Gecko
* callers to pass extra data to callees.
*
* @return ACCEPT or REJECT_*
*
* @note shouldLoad can be called while the DOM and layout of the document
* involved is in an inconsistent state. This means that implementors of
* this method MUST NOT do any of the following:
* 1) Modify the DOM in any way (e.g. setting attributes is a no-no).
* 2) Query any DOM properties that depend on layout (e.g. offset*
* properties).
* 3) Query any DOM properties that depend on style (e.g. computed style).
* 4) Query any DOM properties that depend on the current state of the DOM
* outside the "context" node (e.g. lengths of node lists).
* 5) [JavaScript implementations only] Access properties of any sort on any
* object without using XPCNativeWrapper (either explicitly or
* implicitly). Due to various DOM0 things, this leads to item 4.
* If you do any of these things in your shouldLoad implementation, expect
* unpredictable behavior, possibly including crashes, content not showing
* up, content showing up doubled, etc. If you need to do any of the things
* above, do them off timeout or event.
**/
/* short shouldLoad (in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra); */
NS_IMETHODIMP XXXXXXX::ShouldLoad(PRUint32 aContentType,
nsIURI *aContentLocation,
nsIURI *aRequestOrigin,
nsISupports *aContext,
const nsACString & aMimeTypeGuess,
nsISupports *aExtra,
PRInt16 *_retval)
navigate 제어나 뭐 그딴건 안됨.
aContentType에 따라서 aContext로 들어오는 DOMNode가 달라짐.
어쨌든 제어 안됨.
*_retval = REJECT_REQUEST or REJECT_SERVER로 return하게되면 현재 동작에 대해 진행이 안됨.
aExtra에 뭔짓을 하면 ShouldLoad()를 벗어나 뭔가 할 수 있다 하는 것 같은데
어이 하는지 모르는 관계로 걍 Observer()를 통해 처리하기로 함.
/************************************************************************/
/* nsIContentPolicy interface */
/************************************************************************/
/**
* Should the resource at this location be loaded?
* ShouldLoad will be called before loading the resource at aContentLocation
* to determine whether to start the load at all.
*
* @param aContentType the type of content being tested. This will be one
* one of the TYPE_* constants.
*
* @param aContentLocation the location of the content being checked; must
* not be null
*
* @param aRequestOrigin OPTIONAL. the location of the resource that
* initiated this load request; can be null if
* inapplicable
*
* @param aContext OPTIONAL. the nsIDOMNode or nsIDOMWindow that
* initiated the request, or something that can QI
* to one of those; can be null if inapplicable.
*
* @param aMimeTypeGuess OPTIONAL. a guess for the requested content's
* MIME type, based on information available to
* the request initiator (e.g., an OBJECT's type
* attribute); does not reliably reflect the
* actual MIME type of the requested content
*
* @param aExtra an OPTIONAL argument, pass-through for non-Gecko
* callers to pass extra data to callees.
*
* @return ACCEPT or REJECT_*
*
* @note shouldLoad can be called while the DOM and layout of the document
* involved is in an inconsistent state. This means that implementors of
* this method MUST NOT do any of the following:
* 1) Modify the DOM in any way (e.g. setting attributes is a no-no).
* 2) Query any DOM properties that depend on layout (e.g. offset*
* properties).
* 3) Query any DOM properties that depend on style (e.g. computed style).
* 4) Query any DOM properties that depend on the current state of the DOM
* outside the "context" node (e.g. lengths of node lists).
* 5) [JavaScript implementations only] Access properties of any sort on any
* object without using XPCNativeWrapper (either explicitly or
* implicitly). Due to various DOM0 things, this leads to item 4.
* If you do any of these things in your shouldLoad implementation, expect
* unpredictable behavior, possibly including crashes, content not showing
* up, content showing up doubled, etc. If you need to do any of the things
* above, do them off timeout or event.
**/
/* short shouldLoad (in unsigned long aContentType, in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra); */
NS_IMETHODIMP XXXXXXX::ShouldLoad(PRUint32 aContentType,
nsIURI *aContentLocation,
nsIURI *aRequestOrigin,
nsISupports *aContext,
const nsACString & aMimeTypeGuess,
nsISupports *aExtra,
PRInt16 *_retval)
'저장소 > 잡다한거' 카테고리의 다른 글
원격 데스크톱 Port 변경과 사용 (0) | 2009.12.22 |
---|---|
Byte Order Mark (BOM) (0) | 2009.10.07 |
[펌] 시스템이 부팅되는 동안 파일 시스템에서 일어나는 일 (0) | 2009.09.27 |
eMail 발송 실패 에러 메시지 (0) | 2009.09.22 |
Windows 파일 또는 폴더 복사 오류 (0) | 2009.09.22 |