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

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: reupload Created 7 years, 2 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
« no previous file with comments | « no previous file | Source/core/fetch/ScriptResource.h » ('j') | Source/core/fetch/ScriptResource.cpp » ('J')
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();
abarth-chromium 2013/10/17 01:06:55 Ah, much better.
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()) 62 , m_url(cs->url())
61 , m_startPosition(TextPosition::minimumPosition()) 63 , m_startPosition(TextPosition::minimumPosition())
62 { 64 {
65 if (!m_url.isEmpty())
66 m_url.removeFragmentIdentifier();
63 } 67 }
64 68
65 bool isEmpty() const { return m_source.isEmpty(); } 69 bool isEmpty() const { return m_source.isEmpty(); }
66 70
67 const String& source() const { return m_source; } 71 const String& source() const { return m_source; }
68 ScriptResource* resource() const { return m_resource.get(); } 72 ScriptResource* resource() const { return m_resource.get(); }
69 const KURL& url() const 73 const KURL& url() const
70 { 74 {
71 if (m_resource) 75 if (m_resource)
72 return m_resource->response().url(); 76 return m_resource->scriptURL();
73 return m_url; 77 return m_url;
abarth-chromium 2013/10/17 01:06:55 Why not store the data in m_url instead of in Scri
johnjbarton 2013/10/17 02:30:11 Maybe my C++ is rusty, but the method here is cons
abarth-chromium 2013/10/17 02:39:05 You can mark the m_url member as |mutable|.
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 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 | « no previous file | Source/core/fetch/ScriptResource.h » ('j') | Source/core/fetch/ScriptResource.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698