Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Long bookmarklets are removed immediately upon saving #3332

Closed
8thHalfHour opened this issue Feb 21, 2021 · 3 comments · Fixed by #3349
Closed

Long bookmarklets are removed immediately upon saving #3332

8thHalfHour opened this issue Feb 21, 2021 · 3 comments · Fixed by #3349

Comments

@8thHalfHour
Copy link

8thHalfHour commented Feb 21, 2021

Yes, I have searched for and find many bookmarklet-related issues. This one did not seem to be present.

Description:

When entering a short bookmarklet such as javascript:(function(){ alert("hello"); })(), the bookmarklet executes and a window is displayed in iOS versions of Brave for a short time; eventually, it, too stops working. However, when a long bookmarklet (that fully functions in iOS versions of Firefox, Chrome, and Safari — 100% reproducible) such as the Bookmark Ninja bookmarklet is entered either upon creation of a bookmark or when editing a bookmark that already exists, the URL is removed entirely when saved.

(The bookmarklet in question is listed in Additional Information, since it is quite long.)

Steps to Reproduce

Example #1 — Save the bookmark and add the bookmarklet URL during edit

  1. Go to the Ninja Bookmarklets page.
  2. Choose Add Bookmark in Brave menu and Save. Bookmark adds flawlessly.
  3. Go back to the Ninja Bookmarklets screen Press the “Copy to Clipboard” button (or select and copy the bookmarklet URL manually).
  4. Go to Bookmarks in the Brave menu, click the pencil icon, select the “Add to Ninja” bookmark.
  5. In the bookmark edit screen, press the small x at the end of the URL to delete the current contents and paste in the bookmarklet.
  6. Click Save.
  7. The Bookmark is saved, but there is now no URL in the bookmark.

Example #2 — Make the bookmarklet while saving the bookmark

  1. Complete step Update Readme #1 as shown above.
  2. Press Copy to clipboard or select and copy the bookmarklet URL manually).
  3. This time, while saving the bookmark, replace the URL with the bookmarklet URL that was copied.
  4. Press Save. The bookmark URL is now empty.

Example #3 — Copy the bookmarklet from another iOS browser and paste that into the URL of the bookmark

  1. Open the Ninja Bookmarklets page in Firefox, Chrome, or Safari (tested all three where the bookmarklet works properly) and copy the bookmarklet URL (either by clicking Copy to Clipboard or by selecting and copying the URL manually.
  2. Then, when creating the bookmark as described in the previous examples, either use the bookmarklet as the URL while creating a new bookmark -OR- when editing a pre-existing bookmark (both were described in the previous two examples), and save it.
  3. The bookmark has no URL upon saving.

Actual result:
Actual results already described in previous section.

Screenshot of empty URL:

662BDD5F-BA26-47AE-B8B0-089261225E0C

Expected result:

The bookmarklet opens the Add to Ninja screen in a new window in order to set parameters and save the bookmark in Ninja Bookmarks.

Reproduces how often: [Easily reproduced, Intermittent Issue]

Reproducible 100% of the time in Brave stable and Brave Beta on iOS.

Brave Version:

Brave v1.23 (21.2.12.22)
Brave Beta v1.23 (21.2.5.15) — TestFlight

Device details:

iPhone 7 Plus (iOS 14.4)

Website problems only:

  • did you check with Brave Shields down? Yes.
  • did you check in Safari/Firefox (WkWebView-based browsers)? Yes; Firefox, Chrome, and Safari.

Additional Information

Interestingly, JavaScript loaded from pages executes with no problem — including the message bubble that appears after pressing Copy to Clipboard from the Bookmark Ninja bookmarklet page.

The full Bookmark Ninja bookmarklet (for reference):

javascript:%20(function(){var%20title=encodeURIComponent(window.document.title);var%20url=encodeURIComponent(window.location.href);var%20ua=navigator.userAgent;var%20ver="2.5";if%20(isM())%20mAdd();%20else%20dAdd();function%20dAdd(){var%20br=getBrowser();var%20w=579;var%20h=467;if%20(br=='firefox'){if%20(isMac())%20h=462;else%20h=495;}else%20if%20(br=='opera'){w=600;h=554;}else%20if(br=='safari'){h=488;}else%20if%20(br=='chrome'%20&&%20isMac()){h=467;}else%20if%20(br=='ie'){h=452;}var%20left=(screen.width-w)/2;var%20tops=(screen.height-h)/3;win=window.open('https://www.bookmarkninja.com/addbookmark?title='+title+'&url='+url+'&bv='+ver,%20'_blank',%20'top='+tops+',%20left='+left+',%20width='+w+',%20height='+h+'%20resizable=1,%20location=no,%20menubar=0,%20scrollbars=0,%20status=0,%20toolbar=0');if%20(br=='ie')%20setTimeout(function(){win.focus();},5);}function%20mAdd(){void(window.open('https://www.bookmarkninja.com/m-addbookmark?title='+title+'&url='+url+'&bv='+ver,%20'_blank'));}function%20isM(){if%20(ua.match(/Android/i)%20||%20ua.match(/webOS/i)%20||%20ua.match(/iPhone/i)%20||%20ua.match(/iPad/i)%20||%20ua.match(/iPod/i)%20||%20ua.match(/BlackBerry/i)%20||%20ua.match(/Windows%20Phone/i))%20return%20true;else%20return%20false;}function%20getBrowser(){if%20(ua.match(/Edge/i))%20return%20'edge';if%20(ua.match(/Opera/i))%20return%20'opera';if%20(ua.match(/OPR/i))%20return%20'opera';if%20(ua.match(/Chrome/i))%20return%20'chrome';if%20(ua.match(/Firefox/i))%20return%20'firefox';if%20(ua.match(/MSIE/i))%20return%20'ie';if%20(ua.match(/Windows%20NT/i)%20&&%20ua.match(/rv:11/i))%20return%20'ie';if%20(!!ua.match(/Version\/[\d\.]+.*Safari/))%20return%20'safari';return%20'other';}function%20isMac(){if%20(ua.match(/Macintosh/i))%20return%20true;else%20return%20false;}})();

@8thHalfHour 8thHalfHour changed the title Long bookmarklets URLs are removed immediately upon saving Long bookmarklets are removed immediately upon saving Feb 21, 2021
@iccub iccub added this to the 1.24 milestone Feb 24, 2021
@iccub
Copy link
Contributor

iccub commented Feb 24, 2021

This is the best bug report i've seen this year, thanks for taking time to report it so thoroughly,
we localized the bug and fixed it, should be shipped to you in version 1.24

@8thHalfHour
Copy link
Author

You are very welcome. Thank you for fixing it!

@srirambv
Copy link
Contributor

Verification passed on iPhone 7+ with iOS 14.4 running 1.24(21.3.25.18)

  • Verified test plan from issue description

Verification passed on iPhone XR with iOS 13.5 running 1.24(21.3.25.18)

  • Verified test plan from issue description

Verification passed on iPad Pro with iOS 12.4.1 running 1.24(21.3.25.18)

  • Verified test plan from issue description

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.