Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UI for the cursorToolOnLoad pref in the Chrome extension + migration logic #8653

Conversation

Rob--W
Copy link
Member

@Rob--W Rob--W commented Jul 15, 2017

While preparing for a release, I encountered the "Don't know how to handle cursorToolOnLoad!" error in the console of the options page. After an investigation, I found that the hand tool preference was converted from a boolean to an integer in #7635.

I fixed the UI and added migration logic - see the commit message for more details.

Test:

  1. Run gulp chromium

  2. Go to chrome://extensions in Chrome, enable Developer mode and load the extension from build/chromium/.

  3. Click on Inspect background page of the extension, and run the following code:

    chrome.storage.local.set({enableHandToolOnLoad: true}, function() {location.reload();});
  4. Run the following code to confirm that the preference has been migrated:

    chrome.storage.local.get('enableHandToolOnLoad', console.log); // Should be an empty {}.
  5. Click on the "Options" link and confirm that the "Cursor tool on load" dropdown is set to "Hand Tool".

Optional (to check that the migration logic does not interfere with a normal functioning of the migrated pref):

  1. Change the dropdown to "Text selection tool", close the options page, reload the extension and open the options page.
  2. Confirm that the dropdown value is still at "Text selection".
  3. Repeat step 6 and 7, but change from "Text selection" to "Hand tool" instead.

Add UI for the cursorToolOnLoad pref in the UI of the Chrome extension.

Add logic to migrate the enableHandToolOnLoad pref to cursorToolOnLoad.
For past values in the mutable extension storage area:
1. If enableHandToolOnLoad=true, save cursorToolOnLoad=1.
2. Remove enableHandToolOnLoad.

For the managed extension storage, which is immutable since it is based
on administrative policies, use the following logic:
1. If enableHandToolOnLoad=true and cursorToolOnLoad=0 (default).
   set cursorToolOnLoad=0 and assume enableHandToolOnLoad=false.
2. As usual, managed preferences can (and will) be overridden by the user.

The first migration logic is in extensions/chromium/options/migration.js
and can be removed after a few months / less than many years.

The second migration logic is in web/chromecom.js, and should be kept
around for a long while (many years).

The need for this migration logic arises from the change by:
mozilla#7635
@timvandermeij timvandermeij merged commit 4a74cc4 into mozilla:master Jul 16, 2017
@timvandermeij
Copy link
Contributor

I verified this and it works as intended. Thank you for fixing this!

@timvandermeij timvandermeij removed the request for review from Snuffleupagus July 16, 2017 20:41
movsb pushed a commit to movsb/pdf.js that referenced this pull request Jul 14, 2018
…ndToolOnLoad-to-cursorToolOnLoad

Add UI for the cursorToolOnLoad pref in the Chrome extension + migration logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants