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

Side by Side Diff: Source/bindings/v8/ScriptSourceCode.h

Issue 26538007: [devtools] Remove trailing fragment identifier from script urls (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase; remove inflightResourceForURL Created 7 years, 1 month 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
« no previous file with comments | « LayoutTests/inspector/debugger/debug-inlined-scripts-fragment-id-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 namespace WebCore { 43 namespace WebCore {
44 44
45 class ScriptSourceCode { 45 class ScriptSourceCode {
46 public: 46 public:
47 ScriptSourceCode(const String& source, const KURL& url = KURL(), const TextP osition& startPosition = TextPosition::minimumPosition()) 47 ScriptSourceCode(const String& source, const KURL& url = KURL(), const TextP osition& startPosition = TextPosition::minimumPosition())
48 : m_source(source) 48 : m_source(source)
49 , m_resource(0) 49 , m_resource(0)
50 , m_url(url) 50 , m_url(url)
51 , m_startPosition(startPosition) 51 , m_startPosition(startPosition)
52 { 52 {
53 if (!m_url.isEmpty())
54 m_url.removeFragmentIdentifier();
53 } 55 }
54 56
55 // We lose the encoding information from ScriptResource. 57 // We lose the encoding information from ScriptResource.
56 // Not sure if that matters. 58 // Not sure if that matters.
57 ScriptSourceCode(ScriptResource* cs) 59 ScriptSourceCode(ScriptResource* cs)
58 : m_source(cs->script()) 60 : m_source(cs->script())
59 , m_resource(cs) 61 , m_resource(cs)
60 , m_url(cs->url())
61 , m_startPosition(TextPosition::minimumPosition()) 62 , m_startPosition(TextPosition::minimumPosition())
62 { 63 {
63 } 64 }
64 65
65 bool isEmpty() const { return m_source.isEmpty(); } 66 bool isEmpty() const { return m_source.isEmpty(); }
66 67
67 const String& source() const { return m_source; } 68 const String& source() const { return m_source; }
68 ScriptResource* resource() const { return m_resource.get(); } 69 ScriptResource* resource() const { return m_resource.get(); }
69 const KURL& url() const 70 const KURL& url() const
70 { 71 {
71 if (m_resource) 72 if (m_url.isEmpty() && m_resource) {
72 return m_resource->response().url(); 73 m_url = m_resource->response().url();
74 if (!m_url.isEmpty())
75 m_url.removeFragmentIdentifier();
76 }
73 return m_url; 77 return m_url;
74 } 78 }
75 int startLine() const { return m_startPosition.m_line.oneBasedInt(); } 79 int startLine() const { return m_startPosition.m_line.oneBasedInt(); }
76 const TextPosition& startPosition() const { return m_startPosition; } 80 const TextPosition& startPosition() const { return m_startPosition; }
77 81
78 private: 82 private:
79 String m_source; 83 String m_source;
80 ResourcePtr<ScriptResource> m_resource; 84 ResourcePtr<ScriptResource> m_resource;
81 KURL m_url; 85 mutable KURL m_url;
82 TextPosition m_startPosition; 86 TextPosition m_startPosition;
83 }; 87 };
84 88
85 } // namespace WebCore 89 } // namespace WebCore
86 90
87 #endif // ScriptSourceCode_h 91 #endif // ScriptSourceCode_h
OLDNEW
« no previous file with comments | « LayoutTests/inspector/debugger/debug-inlined-scripts-fragment-id-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698