Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: Source/web/WebEmbeddedWorkerImpl.cpp

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 m_mainFrame = WebLocalFrame::create(this); 274 m_mainFrame = WebLocalFrame::create(this);
275 m_webView->setMainFrame(m_mainFrame); 275 m_webView->setMainFrame(m_mainFrame);
276 276
277 WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame()); 277 WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame());
278 278
279 // Construct substitute data source for the 'shadow page'. We only need it 279 // Construct substitute data source for the 'shadow page'. We only need it
280 // to have same origin as the worker so the loading checks work correctly. 280 // to have same origin as the worker so the loading checks work correctly.
281 CString content(""); 281 CString content("");
282 int length = static_cast<int>(content.length()); 282 int length = static_cast<int>(content.length());
283 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length)); 283 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length));
284 webFrame->frame()->loader().load(FrameLoadRequest(0, ResourceRequest(m_worke rStartData.scriptURL), SubstituteData(buffer, "text/html", "UTF-8", KURL()))); 284 ResourceRequest request = ResourceRequest::createMainResourceRequest(
285 m_workerStartData.scriptURL, !webFrame->parent());
286 webFrame->frame()->loader().load(FrameLoadRequest(0, request, SubstituteData (buffer, "text/html", "UTF-8", KURL())));
285 } 287 }
286 288
287 void WebEmbeddedWorkerImpl::willSendRequest( 289 void WebEmbeddedWorkerImpl::willSendRequest(
288 WebLocalFrame* frame, unsigned, WebURLRequest& request, 290 WebLocalFrame* frame, unsigned, WebURLRequest& request,
289 const WebURLResponse& redirectResponse) 291 const WebURLResponse& redirectResponse)
290 { 292 {
291 if (m_networkProvider) 293 if (m_networkProvider)
292 m_networkProvider->willSendRequest(frame->dataSource(), request); 294 m_networkProvider->willSendRequest(frame->dataSource(), request);
293 } 295 }
294 296
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 m_mainScriptLoader.clear(); 356 m_mainScriptLoader.clear();
355 357
356 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient); 358 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient);
357 m_loaderProxy = LoaderProxy::create(*this); 359 m_loaderProxy = LoaderProxy::create(*this);
358 360
359 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release()); 361 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release());
360 m_workerThread->start(); 362 m_workerThread->start();
361 } 363 }
362 364
363 } // namespace blink 365 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698