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

Side by Side Diff: third_party/WebKit/Source/core/testing/Internals.cpp

Issue 2338623004: Add Blink setting to block doc.written scripts on 2g-like networks (Closed)
Patch Set: Nit Created 4 years, 3 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #include "core/inspector/MainThreadDebugger.h" 101 #include "core/inspector/MainThreadDebugger.h"
102 #include "core/layout/LayoutMenuList.h" 102 #include "core/layout/LayoutMenuList.h"
103 #include "core/layout/LayoutObject.h" 103 #include "core/layout/LayoutObject.h"
104 #include "core/layout/LayoutTreeAsText.h" 104 #include "core/layout/LayoutTreeAsText.h"
105 #include "core/layout/api/LayoutMenuListItem.h" 105 #include "core/layout/api/LayoutMenuListItem.h"
106 #include "core/layout/api/LayoutViewItem.h" 106 #include "core/layout/api/LayoutViewItem.h"
107 #include "core/layout/compositing/CompositedLayerMapping.h" 107 #include "core/layout/compositing/CompositedLayerMapping.h"
108 #include "core/layout/compositing/PaintLayerCompositor.h" 108 #include "core/layout/compositing/PaintLayerCompositor.h"
109 #include "core/loader/DocumentLoader.h" 109 #include "core/loader/DocumentLoader.h"
110 #include "core/loader/FrameLoader.h" 110 #include "core/loader/FrameLoader.h"
111 #include "core/loader/FrameLoaderClient.h"
111 #include "core/loader/HistoryItem.h" 112 #include "core/loader/HistoryItem.h"
112 #include "core/page/ChromeClient.h" 113 #include "core/page/ChromeClient.h"
113 #include "core/page/FocusController.h" 114 #include "core/page/FocusController.h"
114 #include "core/page/NetworkStateNotifier.h" 115 #include "core/page/NetworkStateNotifier.h"
115 #include "core/page/Page.h" 116 #include "core/page/Page.h"
116 #include "core/page/PrintContext.h" 117 #include "core/page/PrintContext.h"
117 #include "core/page/scrolling/ScrollState.h" 118 #include "core/page/scrolling/ScrollState.h"
118 #include "core/paint/PaintLayer.h" 119 #include "core/paint/PaintLayer.h"
119 #include "core/svg/SVGImageElement.h" 120 #include "core/svg/SVGImageElement.h"
120 #include "core/testing/DictionaryTest.h" 121 #include "core/testing/DictionaryTest.h"
(...skipping 14 matching lines...) Expand all
135 #include "platform/RuntimeEnabledFeatures.h" 136 #include "platform/RuntimeEnabledFeatures.h"
136 #include "platform/TraceEvent.h" 137 #include "platform/TraceEvent.h"
137 #include "platform/geometry/IntRect.h" 138 #include "platform/geometry/IntRect.h"
138 #include "platform/geometry/LayoutRect.h" 139 #include "platform/geometry/LayoutRect.h"
139 #include "platform/graphics/GraphicsLayer.h" 140 #include "platform/graphics/GraphicsLayer.h"
140 #include "platform/heap/Handle.h" 141 #include "platform/heap/Handle.h"
141 #include "platform/scroll/ProgrammaticScrollAnimator.h" 142 #include "platform/scroll/ProgrammaticScrollAnimator.h"
142 #include "platform/weborigin/SchemeRegistry.h" 143 #include "platform/weborigin/SchemeRegistry.h"
143 #include "public/platform/Platform.h" 144 #include "public/platform/Platform.h"
144 #include "public/platform/WebConnectionType.h" 145 #include "public/platform/WebConnectionType.h"
146 #include "public/platform/WebEffectiveConnectionType.h"
145 #include "public/platform/WebGraphicsContext3DProvider.h" 147 #include "public/platform/WebGraphicsContext3DProvider.h"
146 #include "public/platform/WebLayer.h" 148 #include "public/platform/WebLayer.h"
147 #include "wtf/InstanceCounter.h" 149 #include "wtf/InstanceCounter.h"
148 #include "wtf/PtrUtil.h" 150 #include "wtf/PtrUtil.h"
149 #include "wtf/dtoa.h" 151 #include "wtf/dtoa.h"
150 #include "wtf/text/StringBuffer.h" 152 #include "wtf/text/StringBuffer.h"
151 #include <deque> 153 #include <deque>
152 #include <memory> 154 #include <memory>
153 #include <v8.h> 155 #include <v8.h>
154 156
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 return; 2458 return;
2457 } 2459 }
2458 networkStateNotifier().setOverride(onLine, webtype, downlinkMaxMbps); 2460 networkStateNotifier().setOverride(onLine, webtype, downlinkMaxMbps);
2459 } 2461 }
2460 2462
2461 void Internals::clearNetworkConnectionInfoOverride() 2463 void Internals::clearNetworkConnectionInfoOverride()
2462 { 2464 {
2463 networkStateNotifier().clearOverride(); 2465 networkStateNotifier().clearOverride();
2464 } 2466 }
2465 2467
2468 void Internals::setEffectiveConnectionTypeOverride(const String& type, Exception State& exceptionState)
2469 {
2470 WebEffectiveConnectionType webtype = WebEffectiveConnectionType::TypeUnknown ;
2471 if (type == "TypeUnknown") {
2472 webtype = WebEffectiveConnectionType::TypeUnknown;
2473 } else if (type == "TypeOffline") {
2474 webtype = WebEffectiveConnectionType::TypeOffline;
2475 } else if (type == "TypeSlow2G") {
2476 webtype = WebEffectiveConnectionType::TypeSlow2G;
2477 } else if (type == "Type2G") {
2478 webtype = WebEffectiveConnectionType::Type2G;
2479 } else if (type == "Type3G") {
2480 webtype = WebEffectiveConnectionType::Type3G;
2481 } else if (type == "Type4G") {
2482 webtype = WebEffectiveConnectionType::Type4G;
2483 } else {
2484 exceptionState.throwDOMException(NotFoundError, ExceptionMessages::faile dToEnumerate("effective connection type", type));
2485 }
2486 if (!frame())
2487 return;
2488 frame()->loader().client()->setEffectiveConnectionTypeOverride(webtype);
2489 }
2490 void Internals::clearEffectiveConnectionTypeOverride()
2491 {
2492 if (!frame())
2493 return;
2494 frame()->loader().client()->clearEffectiveConnectionTypeOverride();
2495 }
2496
2466 unsigned Internals::countHitRegions(CanvasRenderingContext* context) 2497 unsigned Internals::countHitRegions(CanvasRenderingContext* context)
2467 { 2498 {
2468 return context->hitRegionsCount(); 2499 return context->hitRegionsCount();
2469 } 2500 }
2470 2501
2471 bool Internals::isInCanvasFontCache(Document* document, const String& fontString ) 2502 bool Internals::isInCanvasFontCache(Document* document, const String& fontString )
2472 { 2503 {
2473 return document->canvasFontCache()->isInCache(fontString); 2504 return document->canvasFontCache()->isInCache(fontString);
2474 } 2505 }
2475 2506
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2652 2683
2653 return ClientRect::create(FloatRect(node->layoutObject()->visualRect())); 2684 return ClientRect::create(FloatRect(node->layoutObject()->visualRect()));
2654 } 2685 }
2655 2686
2656 void Internals::crash() 2687 void Internals::crash()
2657 { 2688 {
2658 CHECK(false) << "Intentional crash"; 2689 CHECK(false) << "Intentional crash";
2659 } 2690 }
2660 2691
2661 } // namespace blink 2692 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698