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

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: 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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 m_mainFrame = WebLocalFrame::create(this); 263 m_mainFrame = WebLocalFrame::create(this);
264 m_webView->setMainFrame(m_mainFrame); 264 m_webView->setMainFrame(m_mainFrame);
265 265
266 WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame()); 266 WebLocalFrameImpl* webFrame = toWebLocalFrameImpl(m_webView->mainFrame());
267 267
268 // Construct substitute data source for the 'shadow page'. We only need it 268 // Construct substitute data source for the 'shadow page'. We only need it
269 // to have same origin as the worker so the loading checks work correctly. 269 // to have same origin as the worker so the loading checks work correctly.
270 CString content(""); 270 CString content("");
271 int length = static_cast<int>(content.length()); 271 int length = static_cast<int>(content.length());
272 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length)); 272 RefPtr<SharedBuffer> buffer(SharedBuffer::create(content.data(), length));
273 webFrame->frame()->loader().load(FrameLoadRequest(0, ResourceRequest(m_worke rStartData.scriptURL), SubstituteData(buffer, "text/html", "UTF-8", KURL()))); 273 ResourceRequest request = ResourceRequest(m_workerStartData.scriptURL);
274 request.initializeForMainResource(!webFrame->parent());
275 webFrame->frame()->loader().load(FrameLoadRequest(0, request, SubstituteData (buffer, "text/html", "UTF-8", KURL())));
274 } 276 }
275 277
276 void WebEmbeddedWorkerImpl::willSendRequest( 278 void WebEmbeddedWorkerImpl::willSendRequest(
277 WebLocalFrame* frame, unsigned, WebURLRequest& request, 279 WebLocalFrame* frame, unsigned, WebURLRequest& request,
278 const WebURLResponse& redirectResponse) 280 const WebURLResponse& redirectResponse)
279 { 281 {
280 if (m_networkProvider) 282 if (m_networkProvider)
281 m_networkProvider->willSendRequest(frame->dataSource(), request); 283 m_networkProvider->willSendRequest(frame->dataSource(), request);
282 } 284 }
283 285
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 m_mainScriptLoader.clear(); 330 m_mainScriptLoader.clear();
329 331
330 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient); 332 m_workerGlobalScopeProxy = ServiceWorkerGlobalScopeProxy::create(*this, *toW ebLocalFrameImpl(m_mainFrame)->frame()->document(), *m_workerContextClient);
331 m_loaderProxy = LoaderProxy::create(*this); 333 m_loaderProxy = LoaderProxy::create(*this);
332 334
333 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release()); 335 m_workerThread = ServiceWorkerThread::create(*m_loaderProxy, *m_workerGlobal ScopeProxy, startupData.release());
334 m_workerThread->start(); 336 m_workerThread->start();
335 } 337 }
336 338
337 } // namespace blink 339 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698