code: function() {
          let docDomain = this.getDocDomain();
          if ( docDomain === '' ) { docDomain = this.docHostname; }
          if ( this.domain !== undefined && this.domain !== '' ) {
              return this.domain !== docDomain;
          }
          const hostname = this.getHostname();
          if ( hostname.endsWith(docDomain) === false ) { return true; }
          const i = hostname.length - docDomain.length;
          if ( i === 0 ) { return false; }
          return hostname.charCodeAt(i - 1) !== 0x2E /* '.' */;
      }
docs: The idea is to minimize the amout of work done to figure out whether the resource is 3rd-party to the document.