async Task <IResponse> PrepareAsync(IRequester requester, Url url, CancellationToken cancel) { if (_parserInserted && !IsAsync) { if (IsDeferred) { Owner.AddScript(this); } } else if (!IsAsync && !_forceAsync) { //Add to end of list of scripts (in order) --> sufficient Owner.AddScript(this); } else { //Just add to the set of scripts Owner.AddScript(this); } var response = await requester.LoadWithCorsAsync(url, CrossOrigin.ToEnum(CorsSetting.None), Owner.Origin, OriginBehavior.Taint, cancel); if (_parserInserted && !IsAsync) { _readyToBeExecuted = true; } return(response); }
/// <summary> /// Performs a potentially CORS-enabled fetch from the given URI by using an asynchronous GET request. /// </summary> /// <param name="requester">The requester to use.</param> /// <param name="url">The url that yields the path to the desired action.</param> /// <param name="cors">The cross origin settings to use.</param> /// <param name="origin">The origin of the page that requests the loading.</param> /// <param name="defaultBehavior">The default behavior in case it is undefined.</param> /// <returns>The task which will eventually return the stream.</returns> public static Task <IResponse> LoadWithCorsAsync(this IRequester requester, Url url, CorsSetting cors, String origin, OriginBehavior defaultBehavior) { return(requester.LoadWithCorsAsync(url, cors, origin, defaultBehavior, CancellationToken.None)); }