OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 #include "core/fetch/FontResource.h" | 44 #include "core/fetch/FontResource.h" |
45 #include "core/fetch/ImageResource.h" | 45 #include "core/fetch/ImageResource.h" |
46 #include "core/fetch/MemoryCache.h" | 46 #include "core/fetch/MemoryCache.h" |
47 #include "core/fetch/Resource.h" | 47 #include "core/fetch/Resource.h" |
48 #include "core/fetch/ResourceFetcher.h" | 48 #include "core/fetch/ResourceFetcher.h" |
49 #include "core/fetch/ScriptResource.h" | 49 #include "core/fetch/ScriptResource.h" |
50 #include "core/frame/FrameView.h" | 50 #include "core/frame/FrameView.h" |
51 #include "core/frame/LocalFrame.h" | 51 #include "core/frame/LocalFrame.h" |
52 #include "core/frame/Settings.h" | 52 #include "core/frame/Settings.h" |
53 #include "core/html/HTMLFrameOwnerElement.h" | 53 #include "core/html/HTMLFrameOwnerElement.h" |
| 54 #include "core/html/VoidCallback.h" |
54 #include "core/html/imports/HTMLImport.h" | 55 #include "core/html/imports/HTMLImport.h" |
55 #include "core/html/imports/HTMLImportLoader.h" | 56 #include "core/html/imports/HTMLImportLoader.h" |
56 #include "core/html/imports/HTMLImportsController.h" | 57 #include "core/html/imports/HTMLImportsController.h" |
57 #include "core/html/parser/TextResourceDecoder.h" | 58 #include "core/html/parser/TextResourceDecoder.h" |
58 #include "core/inspector/ContentSearchUtils.h" | 59 #include "core/inspector/ContentSearchUtils.h" |
59 #include "core/inspector/DOMPatchSupport.h" | 60 #include "core/inspector/DOMPatchSupport.h" |
60 #include "core/inspector/IdentifiersFactory.h" | 61 #include "core/inspector/IdentifiersFactory.h" |
61 #include "core/inspector/InjectedScriptManager.h" | 62 #include "core/inspector/InjectedScriptManager.h" |
62 #include "core/inspector/InspectorClient.h" | 63 #include "core/inspector/InspectorClient.h" |
63 #include "core/inspector/InspectorInstrumentation.h" | 64 #include "core/inspector/InspectorInstrumentation.h" |
64 #include "core/inspector/InspectorOverlay.h" | 65 #include "core/inspector/InspectorOverlay.h" |
| 66 #include "core/inspector/InspectorResourceContentLoader.h" |
65 #include "core/inspector/InspectorState.h" | 67 #include "core/inspector/InspectorState.h" |
66 #include "core/inspector/InstrumentingAgents.h" | 68 #include "core/inspector/InstrumentingAgents.h" |
67 #include "core/loader/CookieJar.h" | 69 #include "core/loader/CookieJar.h" |
68 #include "core/loader/DocumentLoader.h" | 70 #include "core/loader/DocumentLoader.h" |
69 #include "core/loader/FrameLoadRequest.h" | 71 #include "core/loader/FrameLoadRequest.h" |
70 #include "core/loader/FrameLoader.h" | 72 #include "core/loader/FrameLoader.h" |
71 #include "core/page/Page.h" | 73 #include "core/page/Page.h" |
72 #include "platform/Cookie.h" | 74 #include "platform/Cookie.h" |
73 #include "platform/JSONValues.h" | 75 #include "platform/JSONValues.h" |
74 #include "platform/UserGestureIndicator.h" | 76 #include "platform/UserGestureIndicator.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 110 |
109 KURL urlWithoutFragment(const KURL& url) | 111 KURL urlWithoutFragment(const KURL& url) |
110 { | 112 { |
111 KURL result = url; | 113 KURL result = url; |
112 result.removeFragmentIdentifier(); | 114 result.removeFragmentIdentifier(); |
113 return result; | 115 return result; |
114 } | 116 } |
115 | 117 |
116 } | 118 } |
117 | 119 |
| 120 class InspectorPageAgent::GetResourceContentLoadListener FINAL : public VoidCall
back { |
| 121 public: |
| 122 GetResourceContentLoadListener(InspectorPageAgent*, const String& frameId, c
onst String& url, PassRefPtr<GetResourceContentCallback>); |
| 123 virtual void handleEvent() OVERRIDE; |
| 124 private: |
| 125 InspectorPageAgent* m_pageAgent; |
| 126 String m_frameId; |
| 127 String m_url; |
| 128 RefPtr<GetResourceContentCallback> m_callback; |
| 129 }; |
| 130 |
| 131 InspectorPageAgent::GetResourceContentLoadListener::GetResourceContentLoadListen
er(InspectorPageAgent* pageAgent, const String& frameId, const String& url, Pass
RefPtr<GetResourceContentCallback> callback) |
| 132 : m_pageAgent(pageAgent) |
| 133 , m_frameId(frameId) |
| 134 , m_url(url) |
| 135 , m_callback(callback) |
| 136 { |
| 137 } |
| 138 |
| 139 void InspectorPageAgent::GetResourceContentLoadListener::handleEvent() |
| 140 { |
| 141 if (!m_callback->isActive()) |
| 142 return; |
| 143 m_pageAgent->getResourceContentAfterResourcesContentLoaded(m_frameId, m_url,
m_callback); |
| 144 } |
| 145 |
118 static bool decodeBuffer(const char* buffer, unsigned size, const String& textEn
codingName, String* result) | 146 static bool decodeBuffer(const char* buffer, unsigned size, const String& textEn
codingName, String* result) |
119 { | 147 { |
120 if (buffer) { | 148 if (buffer) { |
121 WTF::TextEncoding encoding(textEncodingName); | 149 WTF::TextEncoding encoding(textEncodingName); |
122 if (!encoding.isValid()) | 150 if (!encoding.isValid()) |
123 encoding = WindowsLatin1Encoding(); | 151 encoding = WindowsLatin1Encoding(); |
124 *result = encoding.decode(buffer, size); | 152 *result = encoding.decode(buffer, size); |
125 return true; | 153 return true; |
126 } | 154 } |
127 return false; | 155 return false; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 { | 274 { |
247 return adoptPtr(new InspectorPageAgent(page, injectedScriptManager, client,
overlay)); | 275 return adoptPtr(new InspectorPageAgent(page, injectedScriptManager, client,
overlay)); |
248 } | 276 } |
249 | 277 |
250 // static | 278 // static |
251 void InspectorPageAgent::resourceContent(ErrorString* errorString, LocalFrame* f
rame, const KURL& url, String* result, bool* base64Encoded) | 279 void InspectorPageAgent::resourceContent(ErrorString* errorString, LocalFrame* f
rame, const KURL& url, String* result, bool* base64Encoded) |
252 { | 280 { |
253 DocumentLoader* loader = assertDocumentLoader(errorString, frame); | 281 DocumentLoader* loader = assertDocumentLoader(errorString, frame); |
254 if (!loader) | 282 if (!loader) |
255 return; | 283 return; |
| 284 |
256 if (!cachedResourceContent(cachedResource(frame, url), result, base64Encoded
)) | 285 if (!cachedResourceContent(cachedResource(frame, url), result, base64Encoded
)) |
257 *errorString = "No resource with given URL found"; | 286 *errorString = "No resource with given URL found"; |
258 } | 287 } |
259 | 288 |
260 Resource* InspectorPageAgent::cachedResource(LocalFrame* frame, const KURL& url) | 289 Resource* InspectorPageAgent::cachedResource(LocalFrame* frame, const KURL& url) |
261 { | 290 { |
262 Resource* cachedResource = frame->document()->fetcher()->cachedResource(url)
; | 291 Document* document = frame->document(); |
| 292 if (!document) |
| 293 return 0; |
| 294 Resource* cachedResource = document->fetcher()->cachedResource(url); |
| 295 if (!cachedResource) { |
| 296 Vector<Document*> allImports = InspectorPageAgent::importsForFrame(frame
); |
| 297 for (Vector<Document*>::const_iterator it = allImports.begin(); it != al
lImports.end(); ++it) { |
| 298 Document* import = *it; |
| 299 cachedResource = import->fetcher()->cachedResource(url); |
| 300 if (cachedResource) |
| 301 break; |
| 302 } |
| 303 } |
263 if (!cachedResource) | 304 if (!cachedResource) |
264 cachedResource = memoryCache()->resourceForURL(url); | 305 cachedResource = memoryCache()->resourceForURL(url); |
265 return cachedResource; | 306 return cachedResource; |
266 } | 307 } |
267 | 308 |
268 TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::resourceTypeJson(Inspe
ctorPageAgent::ResourceType resourceType) | 309 TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::resourceTypeJson(Inspe
ctorPageAgent::ResourceType resourceType) |
269 { | 310 { |
270 switch (resourceType) { | 311 switch (resourceType) { |
271 case DocumentResource: | 312 case DocumentResource: |
272 return TypeBuilder::Page::ResourceType::Document; | 313 return TypeBuilder::Page::ResourceType::Document; |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 updateViewMetricsFromState(); | 437 updateViewMetricsFromState(); |
397 updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touc
hEventEmulationEnabled)); | 438 updateTouchEventEmulationInPage(m_state->getBoolean(PageAgentState::touc
hEventEmulationEnabled)); |
398 } | 439 } |
399 } | 440 } |
400 | 441 |
401 void InspectorPageAgent::enable(ErrorString*) | 442 void InspectorPageAgent::enable(ErrorString*) |
402 { | 443 { |
403 m_enabled = true; | 444 m_enabled = true; |
404 m_state->setBoolean(PageAgentState::pageAgentEnabled, true); | 445 m_state->setBoolean(PageAgentState::pageAgentEnabled, true); |
405 m_instrumentingAgents->setInspectorPageAgent(this); | 446 m_instrumentingAgents->setInspectorPageAgent(this); |
| 447 m_inspectorResourceContentLoader = adoptPtr(new InspectorResourceContentLoad
er(m_page)); |
406 } | 448 } |
407 | 449 |
408 void InspectorPageAgent::disable(ErrorString*) | 450 void InspectorPageAgent::disable(ErrorString*) |
409 { | 451 { |
410 m_enabled = false; | 452 m_enabled = false; |
411 m_state->setBoolean(PageAgentState::pageAgentEnabled, false); | 453 m_state->setBoolean(PageAgentState::pageAgentEnabled, false); |
412 m_state->remove(PageAgentState::pageAgentScriptsToEvaluateOnLoad); | 454 m_state->remove(PageAgentState::pageAgentScriptsToEvaluateOnLoad); |
413 m_overlay->hide(); | 455 m_overlay->hide(); |
414 m_instrumentingAgents->setInspectorPageAgent(0); | 456 m_instrumentingAgents->setInspectorPageAgent(0); |
| 457 m_inspectorResourceContentLoader.clear(); |
415 m_deviceMetricsOverridden = false; | 458 m_deviceMetricsOverridden = false; |
416 | 459 |
417 setShowPaintRects(0, false); | 460 setShowPaintRects(0, false); |
418 setShowDebugBorders(0, false); | 461 setShowDebugBorders(0, false); |
419 setShowFPSCounter(0, false); | 462 setShowFPSCounter(0, false); |
420 setEmulatedMedia(0, String()); | 463 setEmulatedMedia(0, String()); |
421 setContinuousPaintingEnabled(0, false); | 464 setContinuousPaintingEnabled(0, false); |
422 setShowScrollBottleneckRects(0, false); | 465 setShowScrollBottleneckRects(0, false); |
423 setShowViewportSizeOnResize(0, false, 0); | 466 setShowViewportSizeOnResize(0, false, 0); |
424 | 467 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 RefPtr<TypeBuilder::Array<TypeBuilder::Page::Cookie> > cookies = TypeBuilder
::Array<TypeBuilder::Page::Cookie>::create(); | 547 RefPtr<TypeBuilder::Array<TypeBuilder::Page::Cookie> > cookies = TypeBuilder
::Array<TypeBuilder::Page::Cookie>::create(); |
505 | 548 |
506 ListHashSet<Cookie>::iterator end = cookiesList.end(); | 549 ListHashSet<Cookie>::iterator end = cookiesList.end(); |
507 ListHashSet<Cookie>::iterator it = cookiesList.begin(); | 550 ListHashSet<Cookie>::iterator it = cookiesList.begin(); |
508 for (int i = 0; it != end; ++it, i++) | 551 for (int i = 0; it != end; ++it, i++) |
509 cookies->addItem(buildObjectForCookie(*it)); | 552 cookies->addItem(buildObjectForCookie(*it)); |
510 | 553 |
511 return cookies; | 554 return cookies; |
512 } | 555 } |
513 | 556 |
514 static void cachedResourcesForDocument(Document* document, Vector<Resource*>& re
sult) | 557 static void cachedResourcesForDocument(Document* document, Vector<Resource*>& re
sult, bool skipXHRs) |
515 { | 558 { |
516 const ResourceFetcher::DocumentResourceMap& allResources = document->fetcher
()->allResources(); | 559 const ResourceFetcher::DocumentResourceMap& allResources = document->fetcher
()->allResources(); |
517 ResourceFetcher::DocumentResourceMap::const_iterator end = allResources.end(
); | 560 ResourceFetcher::DocumentResourceMap::const_iterator end = allResources.end(
); |
518 for (ResourceFetcher::DocumentResourceMap::const_iterator it = allResources.
begin(); it != end; ++it) { | 561 for (ResourceFetcher::DocumentResourceMap::const_iterator it = allResources.
begin(); it != end; ++it) { |
519 Resource* cachedResource = it->value.get(); | 562 Resource* cachedResource = it->value.get(); |
520 | 563 |
521 switch (cachedResource->type()) { | 564 switch (cachedResource->type()) { |
522 case Resource::Image: | 565 case Resource::Image: |
523 // Skip images that were not auto loaded (images disabled in the use
r agent). | 566 // Skip images that were not auto loaded (images disabled in the use
r agent). |
524 if (toImageResource(cachedResource)->stillNeedsLoad()) | 567 if (toImageResource(cachedResource)->stillNeedsLoad()) |
525 continue; | 568 continue; |
526 break; | 569 break; |
527 case Resource::Font: | 570 case Resource::Font: |
528 // Skip fonts that were referenced in CSS but never used/downloaded. | 571 // Skip fonts that were referenced in CSS but never used/downloaded. |
529 if (toFontResource(cachedResource)->stillNeedsLoad()) | 572 if (toFontResource(cachedResource)->stillNeedsLoad()) |
530 continue; | 573 continue; |
531 break; | 574 break; |
| 575 case Resource::Raw: |
| 576 if (skipXHRs) |
| 577 continue; |
| 578 break; |
532 default: | 579 default: |
533 // All other Resource types download immediately. | 580 // All other Resource types download immediately. |
534 break; | 581 break; |
535 } | 582 } |
536 | 583 |
537 result.append(cachedResource); | 584 result.append(cachedResource); |
538 } | 585 } |
539 } | 586 } |
540 | 587 |
541 static Vector<Document*> importsForFrame(LocalFrame* frame) | 588 // static |
| 589 Vector<Document*> InspectorPageAgent::importsForFrame(LocalFrame* frame) |
542 { | 590 { |
543 Vector<Document*> result; | 591 Vector<Document*> result; |
544 Document* rootDocument = frame->document(); | 592 Document* rootDocument = frame->document(); |
545 | 593 |
546 if (HTMLImportsController* controller = rootDocument->importsController()) { | 594 if (HTMLImportsController* controller = rootDocument->importsController()) { |
547 for (size_t i = 0; i < controller->loaderCount(); ++i) { | 595 for (size_t i = 0; i < controller->loaderCount(); ++i) { |
548 if (Document* document = controller->loaderAt(i)->document()) | 596 if (Document* document = controller->loaderAt(i)->document()) |
549 result.append(document); | 597 result.append(document); |
550 } | 598 } |
551 } | 599 } |
552 | 600 |
553 return result; | 601 return result; |
554 } | 602 } |
555 | 603 |
556 static Vector<Resource*> cachedResourcesForFrame(LocalFrame* frame) | 604 static Vector<Resource*> cachedResourcesForFrame(LocalFrame* frame, bool skipXHR
s) |
557 { | 605 { |
558 Vector<Resource*> result; | 606 Vector<Resource*> result; |
559 Document* rootDocument = frame->document(); | 607 Document* rootDocument = frame->document(); |
560 Vector<Document*> loaders = importsForFrame(frame); | 608 Vector<Document*> loaders = InspectorPageAgent::importsForFrame(frame); |
561 | 609 |
562 cachedResourcesForDocument(rootDocument, result); | 610 cachedResourcesForDocument(rootDocument, result, skipXHRs); |
563 for (size_t i = 0; i < loaders.size(); ++i) | 611 for (size_t i = 0; i < loaders.size(); ++i) |
564 cachedResourcesForDocument(loaders[i], result); | 612 cachedResourcesForDocument(loaders[i], result, skipXHRs); |
565 | 613 |
566 return result; | 614 return result; |
567 } | 615 } |
568 | 616 |
569 static Vector<KURL> allResourcesURLsForFrame(LocalFrame* frame) | 617 static Vector<KURL> allResourcesURLsForFrame(LocalFrame* frame) |
570 { | 618 { |
571 Vector<KURL> result; | 619 Vector<KURL> result; |
572 | 620 |
573 result.append(urlWithoutFragment(frame->loader().documentLoader()->url())); | 621 result.append(urlWithoutFragment(frame->loader().documentLoader()->url())); |
574 | 622 |
575 Vector<Resource*> allResources = cachedResourcesForFrame(frame); | 623 Vector<Resource*> allResources = cachedResourcesForFrame(frame, false); |
576 for (Vector<Resource*>::const_iterator it = allResources.begin(); it != allR
esources.end(); ++it) | 624 for (Vector<Resource*>::const_iterator it = allResources.begin(); it != allR
esources.end(); ++it) |
577 result.append(urlWithoutFragment((*it)->url())); | 625 result.append(urlWithoutFragment((*it)->url())); |
578 | 626 |
579 return result; | 627 return result; |
580 } | 628 } |
581 | 629 |
582 void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<Type
Builder::Page::Cookie> >& cookies) | 630 void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<Type
Builder::Page::Cookie> >& cookies) |
583 { | 631 { |
584 ListHashSet<Cookie> rawCookiesList; | 632 ListHashSet<Cookie> rawCookiesList; |
585 | 633 |
(...skipping 23 matching lines...) Expand all Loading... |
609 if (frame->isLocalFrame()) | 657 if (frame->isLocalFrame()) |
610 WebCore::deleteCookie(toLocalFrame(frame)->document(), parsedURL, co
okieName); | 658 WebCore::deleteCookie(toLocalFrame(frame)->document(), parsedURL, co
okieName); |
611 } | 659 } |
612 } | 660 } |
613 | 661 |
614 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page:
:FrameResourceTree>& object) | 662 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page:
:FrameResourceTree>& object) |
615 { | 663 { |
616 object = buildObjectForFrameTree(m_page->deprecatedLocalMainFrame()); | 664 object = buildObjectForFrameTree(m_page->deprecatedLocalMainFrame()); |
617 } | 665 } |
618 | 666 |
619 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const Stri
ng& frameId, const String& url, String* content, bool* base64Encoded) | 667 void InspectorPageAgent::getResourceContentAfterResourcesContentLoaded(const Str
ing& frameId, const String& url, PassRefPtr<GetResourceContentCallback> callback
) |
620 { | 668 { |
621 LocalFrame* frame = assertFrame(errorString, frameId); | 669 ErrorString errorString; |
622 if (!frame) | 670 LocalFrame* frame = assertFrame(&errorString, frameId); |
| 671 if (!frame) { |
| 672 callback->sendFailure(errorString); |
623 return; | 673 return; |
624 resourceContent(errorString, frame, KURL(ParsedURLString, url), content, bas
e64Encoded); | 674 } |
| 675 String content; |
| 676 bool base64Encoded; |
| 677 resourceContent(&errorString, frame, KURL(ParsedURLString, url), &content, &
base64Encoded); |
| 678 if (!errorString.isEmpty()) { |
| 679 callback->sendFailure(errorString); |
| 680 return; |
| 681 } |
| 682 callback->sendSuccess(content, base64Encoded); |
| 683 } |
| 684 |
| 685 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const Stri
ng& frameId, const String& url, PassRefPtr<GetResourceContentCallback> callback) |
| 686 { |
| 687 if (!m_inspectorResourceContentLoader) { |
| 688 callback->sendFailure("Agent was not enabled before sending content requ
ests."); |
| 689 return; |
| 690 } |
| 691 m_inspectorResourceContentLoader->addListener(adoptPtr(new GetResourceConten
tLoadListener(this, frameId, url, callback))); |
625 } | 692 } |
626 | 693 |
627 static bool textContentForResource(Resource* cachedResource, String* result) | 694 static bool textContentForResource(Resource* cachedResource, String* result) |
628 { | 695 { |
629 if (hasTextContent(cachedResource)) { | 696 if (hasTextContent(cachedResource)) { |
630 String content; | 697 String content; |
631 bool base64Encoded; | 698 bool base64Encoded; |
632 if (InspectorPageAgent::cachedResourceContent(cachedResource, result, &b
ase64Encoded)) { | 699 if (InspectorPageAgent::cachedResourceContent(cachedResource, result, &b
ase64Encoded)) { |
633 ASSERT(!base64Encoded); | 700 ASSERT(!base64Encoded); |
634 return true; | 701 return true; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 | 917 |
851 void InspectorPageAgent::loadEventFired(LocalFrame* frame) | 918 void InspectorPageAgent::loadEventFired(LocalFrame* frame) |
852 { | 919 { |
853 if (!frame->isMainFrame()) | 920 if (!frame->isMainFrame()) |
854 return; | 921 return; |
855 m_frontend->loadEventFired(currentTime()); | 922 m_frontend->loadEventFired(currentTime()); |
856 } | 923 } |
857 | 924 |
858 void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader) | 925 void InspectorPageAgent::didCommitLoad(LocalFrame*, DocumentLoader* loader) |
859 { | 926 { |
860 // FIXME: If "frame" is always guarenteed to be in the same Page as loader->
frame() | 927 // FIXME: If "frame" is always guaranteed to be in the same Page as loader->
frame() |
861 // then all we need to check here is loader->frame()->isMainFrame() | 928 // then all we need to check here is loader->frame()->isMainFrame() |
862 // and we don't need "frame" at all. | 929 // and we don't need "frame" at all. |
863 if (loader->frame() == m_page->mainFrame()) { | 930 if (loader->frame() == m_page->mainFrame()) { |
864 m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce; | 931 m_scriptToEvaluateOnLoadOnce = m_pendingScriptToEvaluateOnLoadOnce; |
865 m_scriptPreprocessorSource = m_pendingScriptPreprocessor; | 932 m_scriptPreprocessorSource = m_pendingScriptPreprocessor; |
866 m_pendingScriptToEvaluateOnLoadOnce = String(); | 933 m_pendingScriptToEvaluateOnLoadOnce = String(); |
867 m_pendingScriptPreprocessor = String(); | 934 m_pendingScriptPreprocessor = String(); |
| 935 if (m_inspectorResourceContentLoader) |
| 936 m_inspectorResourceContentLoader->stop(); |
868 } | 937 } |
869 m_frontend->frameNavigated(buildObjectForFrame(loader->frame())); | 938 m_frontend->frameNavigated(buildObjectForFrame(loader->frame())); |
870 } | 939 } |
871 | 940 |
872 void InspectorPageAgent::frameAttachedToParent(LocalFrame* frame) | 941 void InspectorPageAgent::frameAttachedToParent(LocalFrame* frame) |
873 { | 942 { |
874 Frame* parentFrame = frame->tree().parent(); | 943 Frame* parentFrame = frame->tree().parent(); |
875 if (!parentFrame->isLocalFrame()) | 944 if (!parentFrame->isLocalFrame()) |
876 parentFrame = 0; | 945 parentFrame = 0; |
877 m_frontend->frameAttached(frameId(frame), frameId(toLocalFrame(parentFrame))
); | 946 m_frontend->frameAttached(frameId(frame), frameId(toLocalFrame(parentFrame))
); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 } | 1164 } |
1096 | 1165 |
1097 PassRefPtr<TypeBuilder::Page::FrameResourceTree> InspectorPageAgent::buildObject
ForFrameTree(LocalFrame* frame) | 1166 PassRefPtr<TypeBuilder::Page::FrameResourceTree> InspectorPageAgent::buildObject
ForFrameTree(LocalFrame* frame) |
1098 { | 1167 { |
1099 RefPtr<TypeBuilder::Page::Frame> frameObject = buildObjectForFrame(frame); | 1168 RefPtr<TypeBuilder::Page::Frame> frameObject = buildObjectForFrame(frame); |
1100 RefPtr<TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree::Resources> >
subresources = TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree::Resourc
es>::create(); | 1169 RefPtr<TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree::Resources> >
subresources = TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree::Resourc
es>::create(); |
1101 RefPtr<TypeBuilder::Page::FrameResourceTree> result = TypeBuilder::Page::Fra
meResourceTree::create() | 1170 RefPtr<TypeBuilder::Page::FrameResourceTree> result = TypeBuilder::Page::Fra
meResourceTree::create() |
1102 .setFrame(frameObject) | 1171 .setFrame(frameObject) |
1103 .setResources(subresources); | 1172 .setResources(subresources); |
1104 | 1173 |
1105 Vector<Resource*> allResources = cachedResourcesForFrame(frame); | 1174 Vector<Resource*> allResources = cachedResourcesForFrame(frame, true); |
1106 for (Vector<Resource*>::const_iterator it = allResources.begin(); it != allR
esources.end(); ++it) { | 1175 for (Vector<Resource*>::const_iterator it = allResources.begin(); it != allR
esources.end(); ++it) { |
1107 Resource* cachedResource = *it; | 1176 Resource* cachedResource = *it; |
1108 | 1177 |
1109 RefPtr<TypeBuilder::Page::FrameResourceTree::Resources> resourceObject =
TypeBuilder::Page::FrameResourceTree::Resources::create() | 1178 RefPtr<TypeBuilder::Page::FrameResourceTree::Resources> resourceObject =
TypeBuilder::Page::FrameResourceTree::Resources::create() |
1110 .setUrl(urlWithoutFragment(cachedResource->url()).string()) | 1179 .setUrl(urlWithoutFragment(cachedResource->url()).string()) |
1111 .setType(cachedResourceTypeJson(*cachedResource)) | 1180 .setType(cachedResourceTypeJson(*cachedResource)) |
1112 .setMimeType(cachedResource->response().mimeType()); | 1181 .setMimeType(cachedResource->response().mimeType()); |
1113 if (cachedResource->wasCanceled()) | 1182 if (cachedResource->wasCanceled()) |
1114 resourceObject->setCanceled(true); | 1183 resourceObject->setCanceled(true); |
1115 else if (cachedResource->status() == Resource::LoadError) | 1184 else if (cachedResource->status() == Resource::LoadError) |
1116 resourceObject->setFailed(true); | 1185 resourceObject->setFailed(true); |
1117 subresources->addItem(resourceObject); | 1186 subresources->addItem(resourceObject); |
1118 } | 1187 } |
1119 | 1188 |
1120 Vector<Document*> allImports = importsForFrame(frame); | 1189 Vector<Document*> allImports = InspectorPageAgent::importsForFrame(frame); |
1121 for (Vector<Document*>::const_iterator it = allImports.begin(); it != allImp
orts.end(); ++it) { | 1190 for (Vector<Document*>::const_iterator it = allImports.begin(); it != allImp
orts.end(); ++it) { |
1122 Document* import = *it; | 1191 Document* import = *it; |
1123 RefPtr<TypeBuilder::Page::FrameResourceTree::Resources> resourceObject =
TypeBuilder::Page::FrameResourceTree::Resources::create() | 1192 RefPtr<TypeBuilder::Page::FrameResourceTree::Resources> resourceObject =
TypeBuilder::Page::FrameResourceTree::Resources::create() |
1124 .setUrl(urlWithoutFragment(import->url()).string()) | 1193 .setUrl(urlWithoutFragment(import->url()).string()) |
1125 .setType(resourceTypeJson(InspectorPageAgent::DocumentResource)) | 1194 .setType(resourceTypeJson(InspectorPageAgent::DocumentResource)) |
1126 .setMimeType(import->suggestedMIMEType()); | 1195 .setMimeType(import->suggestedMIMEType()); |
1127 subresources->addItem(resourceObject); | 1196 subresources->addItem(resourceObject); |
1128 } | 1197 } |
1129 | 1198 |
1130 RefPtr<TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree> > childrenAr
ray; | 1199 RefPtr<TypeBuilder::Array<TypeBuilder::Page::FrameResourceTree> > childrenAr
ray; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 } | 1339 } |
1271 | 1340 |
1272 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co
nst bool* showGrid) | 1341 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co
nst bool* showGrid) |
1273 { | 1342 { |
1274 m_state->setBoolean(PageAgentState::showSizeOnResize, show); | 1343 m_state->setBoolean(PageAgentState::showSizeOnResize, show); |
1275 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid)
; | 1344 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid)
; |
1276 } | 1345 } |
1277 | 1346 |
1278 } // namespace WebCore | 1347 } // namespace WebCore |
1279 | 1348 |
OLD | NEW |