Previously, there was an issue where nagivating between diffs would
use the hash from the previous diff because the url had not been
updated when _paramsChanged was calls. Instead of getting the hash
from window.location, let the router handle it and pass it in as a
param.
Bug: Issue 6702
Change-Id: I03cb59e0f55813b0973eaf949e9e0958946d094e
Migrates all alert calls to toasts. Also corrects one test that checked
for an alert on the window.
Bug: Issue 6701
Change-Id: I4d41790f63edc15873014df4f98013ac2bb2af7c
Split the path at the last slash to provide only the basename as the
page title in diff-view.
Bug: Issue 4955
Change-Id: I242d38f5823415a53f837ad7d1a5b97bd16c6fa6
Polymer2 does not support type extension. As such, elements that rely on
it are updated.
Instead of
<select is="gr-select"><select>
This will now be..
<gr-select>
<select></select>
</gr-select>
This is similar to the implementation of iron-input, except that is more
complex, as it is supporting both type extention and non-type extension.
https://github.com/PolymerElements/iron-input/blob/master/iron-input.html
Bug: Issue 6371
Change-Id: I31091ff24791a9dc073b3325c7b0daa1580b69ef
This allows for the functions which rely on the properties to be called when
the properties are set.
Change-Id: I306550a246c4c535ae5f165ce3fbe5282eea25f2
window.PANEL_FLOATING_DISABLED=true prevents diff header detaching from
the page flow and sticking to the window top border.
Change-Id: Idafab7f73fb52a9165b7610ae609e0a8fe52bbd9
When the file list was very long, it could be hidden partially behind
horizontal scrollbars, and was generally difficult to use.
Limiting the dropdown content height to 70vh ensures the content stays
on screen.
Bug: Issue 6375
Change-Id: I3d8b22e6d829816821ef8f1d1343141721d07654
This is a partial roll-forward of c/106190
This replaces all loads of iron-test-helpers with a load of a file
that wraps it, and adds that file to test files that do not currently
load iron-test-helpers.
A future CL will also install polymer-resin via common-test-helpers.html.
I tested by running
$ WCT_ARGS="-l chrome" ./polygerrit-ui/app/run_test.sh
Change-Id: Ifb3cd2c8db13d724f57e56e7e78045470d103a43
- Create a shared style module that is included in every custom element
- Add the shared style module to each existing element
Change-Id: I1ee382955afe4ff630548a6640e7c4d03688849d
polymer-resin intercepts polymer property assignments
before they reach XSS-vulnerable sinks like `href="..."`
and text nodes in `<script>` elements.
This follows the instructions in WORKSPACE for adding a new bower
dependency with kaspern's tweak to use the dependency in a rule so
that it's found. //lib/js/bower_components.bzl has already been
rolled-back per those instructions.
The license is the polymer license as can be seen at
https://github.com/Polymer/polymer-resin/blob/master/LICENSE though
I'm not sure that //tools/js/bower2bazel.py recognizes it as such.
Docs for the added component are available at
https://github.com/Polymer/polymer-resin/blob/master/README.mdhttps://github.com/Polymer/polymer-resin/blob/master/getting-started.md
With this change, when I introduce an XSS vulnerability as below,
polymer-resin intercepts and stops it.
Patch that introduces a strawman vulnerability.
--- a/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js
+++ b/polygerrit-ui/app/elements/core/gr-main-header/gr-main-header.js
@@ -55,6 +55,10 @@
url: '/q/status:abandoned',
name: 'Abandoned',
},
+ {
+ url: location.hash.replace(/^#/, '') || 'http://example.com/#fragment_echoed_here',
+ name: 'XSS Me',
+ },
],
}];
---
Address kaspern's and paladox's comments.
---
Undo version bumps for bower dependencies.
---
Change Soy index template to parallel app/index.html.
---
update polymer-resin to version 1.1.1-beta
----
Load polymer-resin into polygerrit-ui/**/*_test.html
After this, I ran the tests with
-l chrome
-l firefox
I ran a handful of tests with -p and observed that the
console shows "initResin" is called before test cases start
executing.
These changes were done programmaticly by running the script below
(approximately) thus:
```
gerrit/ $ cd polygerrit-ui/app
app/ $ find . -name \*test.html | xargs perl hack-tests.pl
```
```
use strict;
sub removeResin($) {
my $s = $_[0];
$s =~ s@<link rel="import" href="[^"]*/polymer-resin/[^"]*"[^>]*>\n?@@;
$s =~ s@<script src="[^"]*/polymer-resin/[^"]*"></script>\n?@@;
$s =~ s@<script>\s*security\.polymer_resin.*?</script>\n?@@s;
return $s;
}
for my $f (@ARGV) {
next if $f =~ m@/bower_components/|/node_modules/@;
system('git', 'checkout', $f);
print "$f\n";
my @lines = ();
open(IN, "<$f") or die "$f: $!";
my $maxLineOfMatch = 0;
while (<IN>) {
push(@lines, $_);
# Put a marker after core loading directives.
$maxLineOfMatch = scalar(@lines)
if m@/webcomponentsjs/|/polymer[.]html\b|/browser[.]js@;
}
close(IN) or die "$f: $!";
die "$f missing loading directives" unless $maxLineOfMatch;
# Given ./a/b/c/my_test.html, $pathToRoot is "../../.."
# assuming no non-leading . or .. components in the path from find.
my $pathToRoot = $f;
$pathToRoot =~ s@^\.\/@@;
$pathToRoot =~ s@^(.*?/)?app/@@;
$pathToRoot =~ s@\/[^\/]*$@@;
$pathToRoot =~ s@[^/]+@..@g;
my $nLines = scalar(@lines);
open(OUT, ">$f") or die "$f: $!";
# Output the lines up to the last polymer-resin dependency
# loaded explicitly by this test.
my $before = join '', @lines[0..($maxLineOfMatch - 1)];
$before = removeResin($before);
print OUT "$before";
# Dump out the lines that load polymer-resin and configure it for
# polygerrit.
if (1) {
print OUT qq'<link rel="import" href="$pathToRoot/bower_components/polymer-resin/standalone/polymer-resin-debug.html"/>
<script>
security.polymer_resin.install({allowedIdentifierPrefixes: [\'\']});
</script>
';
}
# Emit any remaining lines.
my $after = join '', @lines[$maxLineOfMatch..$#lines];
$after = removeResin($after);
$after =~ s/^\n*//;
print OUT "$after";
close(OUT) or die "$f: $!";
}
```
---
update polymer-resin to version 1.2.1-beta
---
update Soy index template to new style polymer-resin initialization
----
fix lint warnings
----
Load test/common-test-setup.html into *_test.html
Instead of inserting instructions to load and initialize polymer-resin into
every test file, add a common-test-setup.html that does that and also fold
iron-test-helpers loading into it.
----
imported files do not need to load webcomponentsjs
Change-Id: I71221c36ed8a0fe7f8720c1064a2fcc9555bb8df
Diff header scrolls with content and sticks to the top, too.
Doesn't scroll the footer horizontally with the header.
Bug: Issue 4491
Change-Id: I5d76aad38a7ae76c15528abcb572cf993f7f595e
On Latin American keyboards, the square bracket cannot be typed without
a modifier. An added check to exit if modifiers are pressed meant that
the shortcut could thus not be used on these keyboards.
Instead, check only for the meta key to avoid overriding native Chrome
shortcuts in OSX.
Bug: Issue 6217
Change-Id: Ia737c4c411b73b2ba42fe5f33fff5082c488a5fb
Noteworthy decisions:
- Preferences are hidden when diff prefs are not loaded or the user is not
logged in.
- Preferences are hidden on small screens
- The trigger button is in gr-change-view but the gr-diff-preferences
is part of gr-file-list. This is because gr-file-list because diff
preferences and local preferences are more closely tied with that
than the change view. In order to put it in the change view, local
prefs would also have to be two-way bound back.
Also fixes computePrefsButtonHidden in gr-diff-view as well. The
function did not work as intended before. If preferences didn't exist,
the function would not get called, and the container would not be
hidden.
Bug: Issue 5426
Change-Id: I361cdf132c6e15b5ae2f15e62af318cfa05161ce
The Closure Compiler is very picky with regard to JSDoc formatting. This
change fixes a few invalid JSDoc issues, and removes the corresponding
suppresses from the BUILD file. Additionally, modify the transpilation
target language to ES5.
After this change, there should no longer be warnings from the Closure
Compiler during building of PolyGerrit.
Change-Id: If7566e40c2c419c55f2a634c0f558c6cc263f61c
Previously, gr-diff-preferences was the contents that was displayed in
an overlay contained in the gr-diff-view. There were a handful of
functions that crossed between the two-- the diff preferences element
would fire events that needed to be handled by the diff view.
Because the gr-diff-preferences element will be added to the change
view as well, the overlay has been moved to be part of the diff
preferences element. This way, the element can handle all of the actions
taken by the panel, and all the parent element needs to do is call
the open function.
A separate change will come with the addition of diff preferences in the
change view.
Bug: Issue 5426
Change-Id: Id7396147e73354122ea3825bde2c324b5daa1d26
This updates most of polygerrit links to use the implementation added in
I2b2d704fe33c90ea2f2a2183fc79897642a48175 .
Change-Id: Ib3bb694969e903fd76a1dad13cfb642bde086142
Previously, there was an issue where click events did not fire before
tap handlers closed a dropdown. If the dropdown was closed first, the
dropdown is gone and something random becomes the event target.
This change adds a short setTimeOut to ensure that the link is the click
target prior to closing the dropdown.
Bug: Issue 5932
Change-Id: I218893fd479eeb68361dd2c94d919740a8f542f2
GWT UI has this button but polygerrit dosen't. Makes it easier to view
your other diff's if you need to pick another file but it is way down
the list.
Change-Id: Ic62480315b3b00d7623d4ac444a0b554d255b4d1
In a recent change (Ib83ff5157), the promise strategy for processing and
rendering diffs changed so that they resolve after all the work (i.e.
processing, diff content, and syntax highlighting) had completed.
Beforehand the promise would actually resolve after the diff processing
had finished. The diff view would wait for this promise to resolve
(along with the resolution of network calls) before removing the
`_loading` flag.
Because the promise resolution now represents all of the diff rendering
work being complete, rather than the first step only, this use of the
promise was outdated.
With this change, the diff view sets `_loading` to `false` immediately
before starting the diff processing/content/syntax pipeline.
Bug: Issue 5533
Change-Id: I24fafe4d55166e2acbf1849e6a75fbcba122b997
In some cases, the reply dialog could be opened before all comment
drafts have been saved, causing the draft to not appear in the dialog.
This change maintains an array corresponding to each draft request and
refers to it before opening the reply dialog. If the array is populated,
a non-blocking alert is shown with the text 'Try again when all comments
have saved.'
Bug: Issue 5369
Change-Id: Ieb73e7d7b4f66daff6cc2278a84c2195b7d0e541
Adds keyboard shortcuts to the diff view to navigate to the next or
previous file in the change's file list that has comments in the current
patch range.
Feature: Issue 5235
Change-Id: I1ad39089c1ac227e335093f25b72311f7e98b3f7
If a user in diff view changes the diff range to one that no longer
includes the file that they are on, the Prev/Next links are grayed out
and they are forced to return to the change view to navigate the diff.
This change sets Next to direct to the first file in the list and Prev
to point to the last file in the list.
Bug: Issue 4932
Change-Id: Ifb460c9721bfafbc19afa68253402b9dcd2f2c3e
This change prevents the wrapping of prev/next text in the diff view so
that the links are placed consistently on each page.
Bug: Issue 5195
Change-Id: Ic5a2c896858c00e43b8506b227c80458a3b85aed
- Hide download link and file web links from patchsets.
- Add a full file path.
- Change next/prev buttons to be arrows on either side of full path
- Change subheader to flex/wrap so that the display mode wraps to the
next line instead of the second patch set item.
Bug: Issue 5114
Change-Id: Iefb8afe9d7e2417f8aa2070e52073708c052fa4f
Previously, there was logic regarding diff view defaults in both the
diff view and also the file list views. When the unified view became
the mobile default for the diff view, the file list was forgotten, and
if a user visited a change view first and then a diff view (without
refreshing the page) they wouldn't get defaulted to unified on mobile.
This change fixes the issue and moves the logic for which view type to
display to the rest interface, so that it doesn't have to be implemented
in multiple places.
Bug: Issue 5119
Change-Id: I95bfe1540cc9439bd6d3e3e39d13a5e32962b7fa
Previously, the file path was truncated and often the file name was cut
off completely, which had made it hard to tell what files were actually
changed. With this change, the text appearing on the file list just
show ellipsis and the file name (ex: '.../filename.txt').
Additionally, for both mobile and larger screens, the full filename
appears (line wrapped if needed) when the file list item is expanded.
This way, if enough content is cut off that it's still not useful, there
is a way to see the path in it's entirety.
Bug: Issue 4609
Change-Id: Ic4aaf45bafbc3c5b31add8f7c43b18c9d2b2913b