Skip to content
Permalink
Browse files

Add Blink support, including mapping from WebKit to Blink paths.

  • Loading branch information
mihaip committed Apr 19, 2013
1 parent c5db83a commit 82d8d1534f997c8082412f612f014efb493b4bbf
Showing with 179 additions and 67 deletions.
  1. +4 −3 README.md
  2. +5 −1 extension/js/background.js
  3. +136 −44 extension/js/link.js
  4. +2 −2 extension/manifest.json
  5. +32 −17 extension/tests/link-tests.js
@@ -1,17 +1,18 @@
A Chrome extension that adds a page action that allows cross-referencing of source files from the following open-source projects:

* [Chromium](http://www.chromium.org/)
* [Blink](http://www.chromium.org/blink)
* [WebKit](http://trac.webkit.org/)
* [V8](http://code.google.com/p/v8)

Adds links between:

* [Chromium code search](http://code.google.com/p/chromium/source/search), which also includes all of Chromium's dependencies (WebKit, V8, etc.)
* Annotations, logs and revisions on [trac.webkit.org](https://trac.webkit.org)
* [Chromium code search](http://code.google.com/p/chromium/source/search), which also includes all of Chromium's dependencies (Blink, V8, etc.)
* Annotations, logs and revisions on [trac.webkit.org](https://trac.webkit.org), including a mapping from Blink to WebKit source paths
* Annotations, logs and revisions on [src.chromium.org](https://src.chromium.org)
* Annotations, logs and revisions on [git.chromium.org](https://git.chromium.org)
* Logs and revisions on [code.google.com/p/v8](https://code.google.com/p/v8)

Available [in the Chrome Web Store](https://chrome.google.com/webstore/detail/ncjnjlfeffaclcioiphpaofhkebnmknj).

Also adds a `sql` search/Omnibox keyword for triggering searches in the above repositories (by contents, file name, and author).
Also adds a `sql` search/Omnibox keyword for triggering searches in the above repositories (by contents, file name, and author).
@@ -48,7 +48,7 @@ chrome.omnibox.onInputChanged.addListener(function(text, suggest) {
},
{
content: getCodeSearchUrl('file:^src/third_party/WebKit ' + text),
description: '<match>' + text + '</match> in the WebKit repository'
description: '<match>' + text + '</match> in the Blink repository'
},
{
content: getCodeSearchUrl('file:' + text),
@@ -62,6 +62,10 @@ chrome.omnibox.onInputChanged.addListener(function(text, suggest) {
content: 'http://git.chromium.org/gitweb/?p=chromium.git&a=search&h=HEAD&st=author&s=' + text,
description: 'Changes by <match>' + text + '</match> in the Chromium repository'
},
{
content: 'http://svnsearch.org/svnsearch/repos/BLINK/search?author=' + text,
description: 'Changes by <match>' + text + '</match> in the Blink repository'
},
{
content: 'http://trac.webkit.org/search?q=' + text + '&noquickjump=1&changeset=on',
description: 'Changes by <match>' + text + '</match> in the WebKit repository'
@@ -7,13 +7,15 @@ var EXTRACTORS_BY_HOSTNAME = {

var CHROMIUM_CODE_SEARCH_PATH_PREFIX = "chromium";

var WEBKIT_REPOSITORY_PREFIX = 'chrome/trunk/src/third_party/WebKit/';
var WEBKIT_LAYOUT_PREFIX = 'LayoutTests/';
var BLINK_REPOSITORY_PREFIX = 'chrome/trunk/src/third_party/WebKit/';
var BLINK_LAYOUT_TEST_PREFIX = 'LayoutTests/';
var FLAKINESS_DASHBOARD_PATH = 'http://test-results.appspot.com/dashboards/flakiness_dashboard.html';

var WEBKIT_TRAC_BASE_BROWSER_PATH = 'http://trac.webkit.org/browser/trunk/';
var WEBKIT_TRAC_BASE_LOG_PATH = 'http://trac.webkit.org/log/trunk/';

var CHROMIUM_REPOSITORY_PREFIX = 'chrome/trunk/';
var CHROMIUM_VIEWEVC_PATH = 'http://src.chromium.org/viewvc/chrome/trunk/';
var CHROMIUM_VIEWVC_PATH = 'http://src.chromium.org/viewvc/chrome/trunk/';
var CHROMIUM_GIT_PATH = 'http://git.chromium.org/gitweb/?p=chromium.git;hb=HEAD;f=';

var V8_REPOSITORY_PREFIX = 'chrome/trunk/src/v8/';
@@ -22,6 +24,17 @@ var V8_CODESITE_BASE_PATH = '/trunk/';
var V8_CODESITE_BROWSE_PATH = '/p/v8/source/browse' + V8_CODESITE_BASE_PATH;
var V8_CODESITE_BASE_LOG_PATH = 'http://code.google.com/p/v8/source/list?path=' + V8_CODESITE_BASE_PATH;

var BLINK_VIEWVC_PATH = 'http://src.chromium.org/viewvc/blink/trunk/';
// Map of the moves described in http://goo.gl/T4VfS.
var BLINK_PATH_TO_WEBKIT_PATH = {
'Source/core': 'Source/WebCore',
'Source/yarr': 'Source/JavaScriptCore/yarr',
'Source/devtools': 'Source/WebCore/inspector',
'Source/modules': 'Source/WebCore/Modules',
'Source/wtf': 'Source/WTF/wtf',
'Source/bindings': 'Source/WebCore/bindings'
};

var TRAC_ICON_URL = 'http://trac.webkit.org/chrome/common/trac.ico';
var CHROMIUM_ICON_URL = 'http://build.chromium.org/favicon.ico';
var GIT_ICON_URL = 'http://git.chromium.org/gitweb/static/git-favicon.png';
@@ -37,12 +50,12 @@ function extractFromChromiumRepositoryPath(path) {
return new V8Link(goog.string.removeAt(path, 0, V8_REPOSITORY_PREFIX.length));
}

if (goog.string.startsWith(path, WEBKIT_REPOSITORY_PREFIX)) {
var webKitPath =
goog.string.removeAt(path, 0, WEBKIT_REPOSITORY_PREFIX.length);
return WebKitLayoutTestLink.getTestPath(webKitPath)
? new WebKitLayoutTestLink(webKitPath)
: new WebKitLink(webKitPath);
if (goog.string.startsWith(path, BLINK_REPOSITORY_PREFIX)) {
var blinkPath =
goog.string.removeAt(path, 0, BLINK_REPOSITORY_PREFIX.length);
return BlinkLayoutTestLink.getTestPath(blinkPath)
? new BlinkLayoutTestLink(blinkPath)
: new BlinkLink(blinkPath);
}

// Should be last
@@ -67,11 +80,16 @@ function extractFromWebKitTrac(url) {
function extractFromChromium(url) {
var path = goog.uri.utils.getPath(url);

var VIEWVC_TRUNK_SRC_RE = new RegExp('/viewvc/chrome/trunk/(.+)');
var match = VIEWVC_TRUNK_SRC_RE.exec(path);
var CHROMIUM_VIEWVC_TRUNK_SRC_RE = new RegExp('/viewvc/chrome/trunk/(.+)');
var match = CHROMIUM_VIEWVC_TRUNK_SRC_RE.exec(path);
if (match) {
return new ChromiumLink(match[1]);
}
var BLINK_VIEWVC_TRUNK_SRC_RE = new RegExp('/viewvc/blink/trunk/(.+)');
var match = BLINK_VIEWVC_TRUNK_SRC_RE.exec(path);
if (match) {
return new BlinkLink(match[1]);
}

return null;
}
@@ -127,10 +145,9 @@ function extractFromCodesite(url) {
return null;
}


function WebKitLink(path) {
Link.call(this, path);
this.chromiumRepositoryPath = 'src/third_party/WebKit/' + path;
this.chromiumRepositoryPath = null;
}
goog.inherits(WebKitLink, Link);

@@ -151,31 +168,27 @@ WebKitLink.prototype.addRelatedLinks = function(relatedLinks) {
'Annotation (Trac)',
TRAC_ICON_URL)
]);
};

function WebKitLayoutTestLink(path) {
WebKitLink.call(this, path);
this.testPath = WebKitLayoutTestLink.getTestPath(path);
}
goog.inherits(WebKitLayoutTestLink, WebKitLink);

WebKitLayoutTestLink.getTestPath = function(path) {
if (goog.string.startsWith(path, WEBKIT_LAYOUT_PREFIX)) {
return goog.string.removeAt(path, 0, WEBKIT_LAYOUT_PREFIX.length);
} else {
return null;
var blinkPath = this.path;
for (var p in BLINK_PATH_TO_WEBKIT_PATH) {
blinkPath = blinkPath.replace(BLINK_PATH_TO_WEBKIT_PATH[p], p);
}
};

WebKitLayoutTestLink.prototype.addRelatedLinks = function(relatedLinks) {
WebKitLayoutTestLink.superClass_.addRelatedLinks.call(this, relatedLinks);

relatedLinks.push(new RelatedLink(
'http://test-results.appspot.com/dashboards/flakiness_dashboard.html' +
'#useWebKitCanary=true&tests=' + encodeURIComponent(this.testPath),
'Chromium/WebKit Test History',
CHROMIUM_ICON_URL));
}
goog.array.extend(relatedLinks, [
new RelatedLink(
BLINK_VIEWVC_PATH + blinkPath + '?view=markup',
'Blink equivalent - current version',
CHROMIUM_ICON_URL),
new RelatedLink(
BLINK_VIEWVC_PATH + blinkPath + '?view=log',
'Blink equivalent - revision log',
CHROMIUM_ICON_URL),
new RelatedLink(
BLINK_VIEWVC_PATH + blinkPath + '?view=annotate',
'Blink equivalent - annotation',
CHROMIUM_ICON_URL)
]);
};

function ChromiumLink(path) {
Link.call(this, path);
@@ -187,15 +200,15 @@ ChromiumLink.prototype.addRelatedLinks = function(relatedLinks) {
ChromiumLink.superClass_.addRelatedLinks.call(this, relatedLinks);
goog.array.extend(relatedLinks, [
new RelatedLink(
CHROMIUM_VIEWEVC_PATH + this.path + '?view=markup',
CHROMIUM_VIEWVC_PATH + this.path + '?view=markup',
'Current version (ViewVC)',
CHROMIUM_ICON_URL),
new RelatedLink(
CHROMIUM_VIEWEVC_PATH + this.path + '?view=log',
CHROMIUM_VIEWVC_PATH + this.path + '?view=log',
'Revision log (ViewVC)',
CHROMIUM_ICON_URL),
new RelatedLink(
CHROMIUM_VIEWEVC_PATH + this.path + '?view=annotate',
CHROMIUM_VIEWVC_PATH + this.path + '?view=annotate',
'Annotation (ViewVC)',
CHROMIUM_ICON_URL)
]);
@@ -241,6 +254,83 @@ V8Link.prototype.addRelatedLinks = function(relatedLinks) {
]);
};

function BlinkLink(path) {
Link.call(this, path);
this.chromiumRepositoryPath = 'src/third_party/WebKit/' + path;
}
goog.inherits(BlinkLink, Link);

BlinkLink.prototype.addRelatedLinks = function(relatedLinks) {
BlinkLink.superClass_.addRelatedLinks.call(this, relatedLinks);

goog.array.extend(relatedLinks, [
new RelatedLink(
BLINK_VIEWVC_PATH + this.path + '?view=markup',
'Current version (ViewVC)',
CHROMIUM_ICON_URL),
new RelatedLink(
BLINK_VIEWVC_PATH + this.path + '?view=log',
'Revision log (ViewVC)',
CHROMIUM_ICON_URL),
new RelatedLink(
BLINK_VIEWVC_PATH + this.path + '?view=annotate',
'Annotation (ViewVC)',
CHROMIUM_ICON_URL)
]);

var webKitPath = this.path;
for (var p in BLINK_PATH_TO_WEBKIT_PATH) {
webKitPath = webKitPath.replace(p, BLINK_PATH_TO_WEBKIT_PATH[p]);
}

goog.array.extend(relatedLinks, [
new RelatedLink(
WEBKIT_TRAC_BASE_BROWSER_PATH + webKitPath,
'WebKit equivalent - current version',
TRAC_ICON_URL),
new RelatedLink(
WEBKIT_TRAC_BASE_LOG_PATH + webKitPath,
'WebKit equivalent - revision log',
TRAC_ICON_URL),
new RelatedLink(
WEBKIT_TRAC_BASE_BROWSER_PATH + webKitPath + '?annotate=blame',
'WebKit equivalent - annotation',
TRAC_ICON_URL),
]);
};

function BlinkLayoutTestLink(path) {
BlinkLink.call(this, path);
this.testPath = BlinkLayoutTestLink.getTestPath(path);
}
goog.inherits(BlinkLayoutTestLink, BlinkLink);

BlinkLayoutTestLink.getTestPath = function(path) {
if (goog.string.startsWith(path, BLINK_LAYOUT_TEST_PREFIX)) {
return goog.string.removeAt(path, 0, BLINK_LAYOUT_TEST_PREFIX.length);
} else {
return null;
}
};

BlinkLayoutTestLink.prototype.addRelatedLinks = function(relatedLinks) {
BlinkLayoutTestLink.superClass_.addRelatedLinks.call(this, relatedLinks);

var encodedPath = encodeURIComponent(this.testPath)
goog.array.extend(relatedLinks, [
new RelatedLink(
FLAKINESS_DASHBOARD_PATH + '#group=%40ToT%20-%20chromium.org&tests=' +
encodedPath,
'Flakiness Dashboard (@ToT)',
CHROMIUM_ICON_URL),
new RelatedLink(
FLAKINESS_DASHBOARD_PATH + '#group=%40DEPS%20-%20chromium.org&tests=' +
encodedPath,
'Flakiness Dashboard (@DEPS)',
CHROMIUM_ICON_URL)
]);
}

function RelatedLink(url, title, iconUrl) {
this.url = url;
this.title = title;
@@ -252,12 +342,14 @@ function Link(path) {
}

Link.prototype.addRelatedLinks = function(relatedLinks) {
relatedLinks.push(
new RelatedLink(
'https://code.google.com/p/chromium/codesearch#chromium/' +
this.chromiumRepositoryPath,
'Code Search',
CODE_SEARCH_ICON_URL));
if (this.chromiumRepositoryPath) {
relatedLinks.push(
new RelatedLink(
'https://code.google.com/p/chromium/codesearch#chromium/' +
this.chromiumRepositoryPath,
'Code Search',
CODE_SEARCH_ICON_URL));
}
};

Link.prototype.getRelatedLinks = function() {
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "Source Quicklinks",
"version": "1.4.2",
"description": "Allows quick jumping between WebKit, Chrome, V8, etc. source links",
"version": "1.5",
"description": "Allows quick jumping between Chrome, Blink, WebKit, V8, etc. source links",
"icons": {
"16": "icon16.png",
"32": "icon32.png",
@@ -46,35 +46,51 @@ function assertLinkFromUrl(url, expectedType, expectedPath, expectedRelatedLinkU
}

function runTests() {
// WebKit from Google Project Hosting Code Search (and related links)
assertLinkFromUrl(
'https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/WebCore/dom/ExceptionCode.h&q=exceptioncode',
WebKitLink,
'Source/WebCore/dom/ExceptionCode.h',
['http://trac.webkit.org/log/trunk/Source/WebCore/dom/ExceptionCode.h',
// Blink from ViewVC (and related links)
assertLinkFromUrl(
'https://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ExceptionCode.h',
BlinkLink,
'Source/core/dom/ExceptionCode.h',
['http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ExceptionCode.h?view=annotate',
'http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ExceptionCode.h?view=log',
'http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ExceptionCode.h?view=markup',
'http://trac.webkit.org/log/trunk/Source/WebCore/dom/ExceptionCode.h',
'http://trac.webkit.org/browser/trunk/Source/WebCore/dom/ExceptionCode.h',
'https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/WebCore/dom/ExceptionCode.h']);
'https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/dom/ExceptionCode.h']);

// Blink from Google Project Hosting Code Search
assertLinkFromUrl(
'https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/dom/ExceptionCode.h&q=exceptioncode',
BlinkLink,
'Source/core/dom/ExceptionCode.h',
[]);

// WebKit layout test from Google Project Hosting Code Search (and related links)
// Blink layout test from Google Project Hosting Code Search (and related links)
assertLinkFromUrl(
'https://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-first-time.html&q=canGet.*location%20file:LayoutTests%20-file:expected&sq=package:chromium&type=cs&l=39',
WebKitLayoutTestLink,
BlinkLayoutTestLink,
'LayoutTests/http/tests/security/cross-frame-access-first-time.html',
['http://test-results.appspot.com/dashboards/flakiness_dashboard.html#useWebKitCanary=true&tests=http%2Ftests%2Fsecurity%2Fcross-frame-access-first-time.html']);
['http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=%40ToT%20-%20chromium.org&tests=http%2Ftests%2Fsecurity%2Fcross-frame-access-first-time.html',
'http://test-results.appspot.com/dashboards/flakiness_dashboard.html#group=%40DEPS%20-%20chromium.org&tests=http%2Ftests%2Fsecurity%2Fcross-frame-access-first-time.html']);

// WebKit from HTTP (not HTTPS) Code Search with no extra params
assertLinkFromUrl(
'http://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/WebCore/dom/ExceptionCode.h',
WebKitLink,
'Source/WebCore/dom/ExceptionCode.h',
'http://code.google.com/p/chromium/codesearch#chromium/src/third_party/WebKit/Source/core/dom/ExceptionCode.h',
BlinkLink,
'Source/core/dom/ExceptionCode.h',
[]);

// WebKit from WebKit Trac
assertLinkFromUrl(
'http://trac.webkit.org/log/trunk/WebCore/dom/ExceptionCode.h?rev=64763',
'http://trac.webkit.org/log/trunk/Source/WebCore/dom/ExceptionCode.h?rev=64763',
WebKitLink,
'WebCore/dom/ExceptionCode.h',
[]);
'Source/WebCore/dom/ExceptionCode.h',
['http://trac.webkit.org/log/trunk/Source/WebCore/dom/ExceptionCode.h',
'http://trac.webkit.org/browser/trunk/Source/WebCore/dom/ExceptionCode.h',
'http://trac.webkit.org/browser/trunk/Source/WebCore/dom/ExceptionCode.h?annotate=blame',
'http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ExceptionCode.h?view=annotate',
'http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ExceptionCode.h?view=log',
'http://src.chromium.org/viewvc/blink/trunk/Source/core/dom/ExceptionCode.h?view=markup']);
assertLinkFromUrl(
'http://trac.webkit.org/browser/trunk/LayoutTests/http/tests/security/cross-frame-access-location-get.html',
WebKitLink,
@@ -160,7 +176,6 @@ function runTests() {
'include/v8.h',
[]);


log('\nTESTS COMPLETE', 'green');
}

0 comments on commit 82d8d15

Please sign in to comment.
You can’t perform that action at this time.