B2G/gecko/content/base/src/contentSecurityPolicy.js
/**
   * Given a new policy, intersects the currently enforced policy with the new
   * one and stores the result.  The effect is a "tightening" or refinement of
   * an old policy.  This is called any time a new policy is encountered and
   * the effective policy has to be refined.
   */
Given a new policy, intersects the currently enforced policy with the new
one and stores the result.  The effect is a "tightening" or refinement of
an old policy.  This is called any time a new policy is encountered and
the effective policy has to be refined.
Given a new policy intersects the currently enforced policy with the new one and stores the result . The effect is a " tightening " or refinement of an old policy . This is called any time a new policy is encountered and the effective policy has to be refined .
function csp_refinePolicy(aPolicy, selfURI) {
    CSPdebug("REFINE POLICY: " + aPolicy);
    CSPdebug("         SELF: " + selfURI.asciiSpec);
    if (selfURI instanceof Ci.nsINestedURI) {
      CSPdebug("        INNER: " + selfURI.innermostURI.asciiSpec);
      selfURI = selfURI.innermostURI;
    }
    this._isInitialized = false;
    var newpolicy = CSPRep.fromString(aPolicy,
				      selfURI,
                                      this._docRequest,
                                      this);
    var intersect = this._policy.intersectWith(newpolicy);
    this._policy = intersect;
    this._isInitialized = true;
    this._cache = {};
  }
function csp_refinePolicy ( aPolicy , selfURI ) { CSPdebug ( "REFINE POLICY: " + aPolicy ) ; CSPdebug ( "         SELF: " + selfURI . asciiSpec ) ; if ( selfURI instanceof Ci . nsINestedURI ) { CSPdebug ( "        INNER: " + selfURI . innermostURI . asciiSpec ) ; selfURI = selfURI . innermostURI ; } this . _isInitialized = false ; var newpolicy = CSPRep . fromString ( aPolicy , selfURI , this . _docRequest , this ) ; var intersect = this . _policy . intersectWith ( newpolicy ) ; this . _policy = intersect ; this . _isInitialized = true ; this . _cache = { } ; }
Given a new policy, intersects the currently enforced policy with the new
 one and stores the result.
Given a new policy intersects the currently enforced policy with the new one and stores the result .
// For nested schemes such as view-source: make sure we are taking the // innermost URI to use as 'self' since that's where we will extract the // scheme, host and port from // stay uninitialized until policy merging is done // If there is a policy-uri, fetch the policy, then re-call this function. // (1) parse and create a CSPRep object // Note that we pass the full URI since when it's parsed as 'self' to construct a  // CSPSource only the scheme, host, and port are kept.  // (2) Intersect the currently installed CSPRep object with the new one // (3) Save the result