Brave-browser: Unable to disable the `Scripts blocked` after upgrade to 0.68.133

Created on 10 Sep 2019  路  9Comments  路  Source: brave/brave-browser

Description


Unable to disable the Scripts blocked after upgrade to 0.68.33

Steps to Reproduce

  1. Clean profile 0.68.132
  2. Open https://brianbondy.com/
  3. Open BR panel and enable the scripts for https://brianbondy.com/
  4. Upgrade to 0.68.133
  5. Try disabling the Scripts blocked switch after upgrade
  6. Unable to disable the Scripts blocked after upgrade to 0.68.33

Actual result:

image

disable scripts not possible after upgrade

Expected result:

Should be able to disable the Scripts blocked after upgrade to 0.68.33

Reproduces how often:

Always

Brave version (brave://version info)

Brave | 0.68.133 Chromium: 77.0.3865.65聽(Official Build)聽(64-bit)
-- | --
Revision | 87a331a3169cab563505fb44011058b904011ba1-refs/branch-heads/3865@{#726}
OS | Windows聽10 OS Version 1803 (Build 17134.523)

Version/Channel Information:

  • Can you reproduce this issue with the current release? No
  • Can you reproduce this issue with the beta channel? Yes
  • Can you reproduce this issue with the dev channel? Yes
  • Can you reproduce this issue with the nightly channel? Yes

Other Additional Information:

  • Does the issue resolve itself when disabling Brave Shields? NA
  • Does the issue resolve itself when disabling Brave Rewards? NA
  • Is the issue reproducible on the latest version of Chrome? NA

Miscellaneous Information:


@brave/legacy_qa

QA Pass-Linux QA Pass-Win64 QA Pass-macOS QTest-Plan-Specified QYes bug featurshield!scripts regression release-noteexclude

Most helpful comment

Found a scenario that occurs on a clean profile with 0.68.133:

  1. Clean profile with 0.68.133
  2. Visit brianbondy.com
  3. Open shields, turn on script blocking.
  4. Page loads, nothing is shown as expected.
  5. From URL bar, allow scripts.
  6. Refresh page.
  7. Page shows content as expected.
  8. Open shields again.
  9. Attempt to turn on script blocking.
    ---> Script blocking does not turn on. Page loads and shows content. Toggle for script blocking still shows as off.

script-block-068133

For comparison, here's how this works on 0.68.132:
script-block-068132

All 9 comments

Reproduced on Ubuntu.

Steps used:

  1. Clean install 0.68.122
  2. Enable script blocking on https://brianbondy.com/
  3. Upgrade to 0.68.123
  4. Disable script blocking on https://brianbondy.com/

Brave | 0.68.133 Chromium: 77.0.3865.65聽(Official Build)聽(64-bit)
-- | --
Revision | 87a331a3169cab563505fb44011058b904011ba1-refs/branch-heads/3865@{#726}
OS | Ubuntu 18.04 LTS

Reproduced on macOS using STR from description when updating from 0.68.132 to 0.68.133

Brave | 0.68.133 Chromium: 77.0.3865.65聽(Official Build)聽(64-bit)
-- | --
Revision | 87a331a3169cab563505fb44011058b904011ba1-refs/branch-heads/3865@{#726}
OS | macOS Version 10.13.6 (Build 17G5019)

Note - close and restart of Brave did not resolve this.

Additionally, could not reproduce when updating from 0.68.131 to 0.68.132.

Found a scenario that occurs on a clean profile with 0.68.133:

  1. Clean profile with 0.68.133
  2. Visit brianbondy.com
  3. Open shields, turn on script blocking.
  4. Page loads, nothing is shown as expected.
  5. From URL bar, allow scripts.
  6. Refresh page.
  7. Page shows content as expected.
  8. Open shields again.
  9. Attempt to turn on script blocking.
    ---> Script blocking does not turn on. Page loads and shows content. Toggle for script blocking still shows as off.

script-block-068133

For comparison, here's how this works on 0.68.132:
script-block-068132

Confirmed this is a regression

Also confirmed this is a bug in Nightly

Here's what's happening in the code (using use-case from Laurens post above)

  1. Clean profile with 0.68.133
  2. Visit brianbondy.com
  3. Open shields, turn on script blocking.
  4. Page loads, nothing is shown as expected.
  5. From URL bar, allow scripts.
  6. Refresh page.
  7. Page shows content as expected.
  8. Open shields again.

(in brave/components/brave_shields/browser/brave_shields_util.cc)
in the method GetNoScriptControlType:
HostContentSettingsMapFactory::GetForProfile(profile)->GetContentSetting(url, GURL(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, "") is returning back CONTENT_SETTING_ALLOW

  1. Attempt to turn on script blocking.
  2. React UI does receive the event
  3. call is made setting to CONTENT_SETTING_BLOCK
    HostContentSettingsMapFactory::GetForProfile(profile) ->SetContentSettingCustomScope( primary_pattern, ContentSettingsPattern::Wildcard(), CONTENT_SETTINGS_TYPE_JAVASCRIPT, "", CONTENT_SETTING_BLOCK);
  4. setting does NOT appear to be persisted (also, UI does not update)
  5. page is reloaded
  6. CONTENT_SETTING_ALLOW is returned again (in calls to GetNoScriptControlType())

I believe I found the cause:

Here's what my content settings look like after making this change (from Default/Preferences):

{
  "profile": {
    "content_settings": {
      "exceptions": {
        "javascript": {
          "https://brianbondy.com,*": {
            "last_modified": "13212630641208984",
            "setting": 2
          },
          "https://brianbondy.com:443,*": {
            "last_modified": "13212622765957903",
            "setting": 1
          }
        }
      }
    }
  }
}

The top version (has setting 2) is what I set (block). The bottom one is what I did using the Chromium UI (allow). Only difference is the port is attached to the key

Closing as this issue is fixed in 0.68.x (there are some failing browser tests - those are being fixed right now)

Verification passed on

Brave | 0.68.135 Chromium: 77.0.3865.75聽(Official Build)聽(64-bit)
-- | --
Revision | 201e747d032611c5f2785cae06e894cf85be7f8a-refs/branch-heads/3865@{#776}
OS | Windows聽10 OS Version 1803 (Build 17134.523)

  • Verified the STR from the description

Verification passed on

Brave | 0.68.135 Chromium: 77.0.3865.75聽(Official Build)聽(64-bit)
-- | --
Revision | 201e747d032611c5f2785cae06e894cf85be7f8a-refs/branch-heads/3865@{#776}
OS | Ubuntu 18.04 LTS

  • Verified the STR from the description

Verification PASSED on macOS 10.14.6 x64 using the following build:

Brave | 0.68.138 Chromium: 77.0.3865.75聽(Official Build)聽(64-bit)
-- | --
Revision | 201e747d032611c5f2785cae06e894cf85be7f8a-refs/branch-heads/3865@{#776}
OS | macOS Version 10.14.6 (Build 18G95)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonathansampson picture jonathansampson  路  3Comments

GeetaSarvadnya picture GeetaSarvadnya  路  3Comments

kjozwiak picture kjozwiak  路  3Comments

AlexCombas picture AlexCombas  路  3Comments

fmarier picture fmarier  路  3Comments